229 lines (216 loc) · 7.26 KB
/
mocha.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
name: Tests
'on':
push:
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
prepare-commit-msg:
name: Retrieve head commit message
runs-on: ubuntu-latest
# Run 'pull-request' event only on external PRs from forked repos.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
outputs:
HEAD_COMMIT_MSG: '${{ steps.commitMsg.outputs.HEAD_COMMIT_MSG }}'
steps:
- uses: actions/checkout@v2
if: github.event_name == 'pull_request'
- name: find commit msg for PR
id: commitMsg
if: github.event_name == 'pull_request'
run: >-
echo "::set-output name=HEAD_COMMIT_MSG::$(git log --no-merges -1
--oneline)"
check-skip:
name: Check to skip CI
needs: prepare-commit-msg
runs-on: ubuntu-latest
if: >-
${{ !contains(github.event.head_commit.message, '[ci skip]') &&
!contains(needs.prepare-commit-msg.outputs.HEAD_COMMIT_MSG, '[ci skip]')
}}
steps:
- run: 'echo "${{ github.event.head_commit.message }}"'
smoke:
name: 'Smoke [Node.js v${{ matrix.node }} / ${{ matrix.os }}]'
needs: check-skip
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-latest
- windows-2019
node:
- 10
- 12
- 14
- 15
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '${{ matrix.node }}'
- run: npm install --production
- run: npm run test:smoke
eslint:
name: ESLint Check
runs-on: ubuntu-latest
needs: smoke
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.4.2
with:
issueSummary: false
npmInstall: false
markdown:
name: Markdown Check
runs-on: ubuntu-latest
needs: smoke
steps:
- uses: actions/setup-node@v1
with:
node-version: 14
- uses: actions/checkout@v2
- name: 'Cache node_modules'
uses: actions/cache@v2
with:
path: '~/.npm'
key: "ubuntu-latest-node-v14-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-v14-
- name: Install Dependencies
run: npm ci --ignore-scripts
- name: 'Check Markdown'
run: npm start lint.markdown
test-node:
name: 'Node.js [v${{ matrix.node }} / ${{ matrix.os }}]'
needs: smoke
runs-on: '${{ matrix.os }}'
env:
NODE_OPTIONS: '--trace-warnings'
strategy:
matrix:
os:
- ubuntu-latest
- windows-2019
node:
- 10
- 12
- 14
- 15
include:
- os: ubuntu-latest
node: 14
env:
COVERAGE: 1
steps:
# - name: Cache Growl Installer (Windows)
# if: "${{ matrix.os == 'windows-2019' }}"
# id: cache-growl
# uses: actions/cache@v2
# with:
# path: GrowlInstaller
# key: '${{ runner.os }}-growl-installer'
# restore-keys: |
# ${{ runner.os }}-growl-installer
# - name: Download Growl Installer (Windows)
# if: "${{ matrix.os == 'windows-2019' && steps.cache-growl.outputs.cache-hit != 'true'}}"
# run: >
# echo "Downloading Growl installer..."
# mkdir GrowlInstaller | out-null
# $seaURL =
# "https://github.com/briandunnington/growl-for-windows/releases/download/final/GrowlInstaller.exe"
# $seaPath = "GrowlInstaller\GrowlInstaller.exe"
# $webclient = New-Object Net.WebClient
# $webclient.DownloadFile($seaURL, $seaPath)
# 7z x $seaPath -oGrowlInstaller | out-null
# echo "Done."
# - name: Retrieve Growl Installer (Windows)
# if: "${{ matrix.os == 'windows-2019' }}"
# uses: actions/cache@v2
# with:
# path: GrowlInstaller
# key: '${{ runner.os }}-growl-installer'
# restore-keys: |
# ${{ runner.os }}-growl-installer
# - name: Add Growl Installer to Path (Windows)
# if: "${{ matrix.os == 'windows-2019' }}"
# run: 'echo "C:\Program Files (x86)\Growl for Windows" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8'
# - name: Install Growl
# if: "${{ matrix.os == 'windows-2019' }}"
# run: |
# echo "Installing Growl..."
# cmd /c start /wait msiexec /i GrowlInstaller\Growl_v2.0.msi /quiet
# echo "Done."
# - name: Start Growl Service (Windows)
# if: "${{ matrix.os == 'windows-2019' }}"
# run: |
# echo "Starting Growl service..."
# Start-Process -NoNewWindow Growl
# ## Growl requires some time before it's ready to handle notifications
# echo "Verifying Growl responding"
# Start-Sleep -s 10
# growlnotify test
- name: Install libnotify-bin (Linux)
if: "${{ matrix.os == 'ubuntu-latest' }}"
run: sudo apt-get install libnotify-bin
- uses: actions/setup-node@v1
with:
node-version: '${{ matrix.node }}'
- uses: actions/checkout@v2
- name: 'Cache node_modules (Linux)'
if: "${{ matrix.os != 'windows-2019' }}"
uses: actions/cache@v2
with:
path: '~/.npm'
key: "${{ matrix.os }}-node-v${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
${{ matrix.os }}-node-v${{ matrix.node }}-
- name: Install Dependencies
run: npm ci --ignore-scripts
- name: Install Annotation Support
run: npm install mocha-github-actions-reporter
- name: Run All Node.js Tests
run: npm start test.node
env:
COVERAGE: '${{ matrix.env.COVERAGE }}'
MOCHA_REPORTER: mocha-github-actions-reporter
# this is so mocha-github-actions-reporter can find mocha
NODE_PATH: lib
- name: Generate Coverage Report (Linux + Node.js latest)
if: '${{ matrix.env.COVERAGE }}'
run: npm start coverage-report-lcov
- name: Upload Coverage to Coveralls (Linux + Node.js latest)
if: '${{ matrix.env.COVERAGE }}'
uses: coverallsapp/github-action@master
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
test-browser:
# TODO: configure to retain build artifacts in `.karma/` dir
name: 'Browser Tests'
needs: smoke
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: 14
- uses: actions/checkout@v2
- name: 'Cache node_modules'
uses: actions/cache@v2
with:
path: '~/.npm'
# this key is different than above, since we are running scripts
# (builds, postinstall lifecycle hooks, etc.)
key: "ubuntu-latest-node-full-v14-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-full-v14-
- name: Install Dependencies
run: npm ci
- name: Run Browser Tests
run: npm start test.browser
env:
SAUCE_USERNAME: '${{secrets.SAUCE_USERNAME}}'
SAUCE_ACCESS_KEY: '${{secrets.SAUCE_ACCESS_KEY}}'