-
-
Notifications
You must be signed in to change notification settings - Fork 528
291 lines (290 loc) · 9.99 KB
/
continuous-integration.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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
name: Continuous Integration
on:
# branches pushed by collaborators
push:
branches:
- main
# pull request from non-collaborators
pull_request: {}
# nightly
schedule:
- cron: '0 0 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
lint-build:
name: "Lint & Build"
runs-on: ubuntu-latest
steps:
# checkout code
- uses: actions/checkout@v2
# install node
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: 16
- run: |
npm config set cache "$( node -p "process.cwd()" )/temp/npm-cache"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: temp/npm-cache
key: npm-cache-packaging-${{ hashFiles('package-lock.json') }}
restore-keys: npm-cache-packaging-
# lint, build, test
- run: npm ci
- run: npm run lint
- run: npm run build-pack
- name: Upload package artifact
uses: actions/upload-artifact@v1
with:
name: ts-node-packed.tgz
path: tests/ts-node-packed.tgz
test-1:
needs: lint-build
name: "Test: ${{ matrix.os }}, node ${{ matrix.node }}, TS ${{ matrix.typescript }}"
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows]
# Don't forget to add all new flavors to this list!
flavor: [12]
include:
# Node 17
- flavor: 12
node: 17
nodeFlag: 17
typescript: latest
typescriptFlag: latest
downgradeNpm: true
steps:
# checkout code
- uses: actions/checkout@v2
# install node
- name: Use Node.js ${{ matrix.node }}
if: matrix.node != 'nightly'
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Use Node.js 16, will be subsequently overridden by download of nightly
if: matrix.node == 'nightly'
uses: actions/setup-node@v1
with:
node-version: 16
- name: Download Node.js nightly
if: matrix.node == 'nightly' && matrix.os == 'ubuntu'
run: |
export N_PREFIX=$(pwd)/n
npm install -g n
n nightly
sudo cp "${N_PREFIX}/bin/node" "$(which node)"
node --version
- name: Download Node.js nightly
if: matrix.node == 'nightly' && matrix.os == 'windows'
run: |
$version = (Invoke-WebRequest https://nodejs.org/download/nightly/index.json | ConvertFrom-json)[0].version
$url = "https://nodejs.org/download/nightly/$version/win-x64/node.exe"
$targetPath = (Get-Command node.exe).Source
Invoke-WebRequest -Uri $url -OutFile $targetPath -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::Chrome)
node --version
# lint, build, test
# Downgrade from npm 7 to 6 because 7 still seems buggy to me
- if: ${{ matrix.downgradeNpm }}
run: npm install -g npm@6
- run: |
npm config set cache "$( node -p "process.cwd()" )/temp/npm-cache"
- name: Cache dependencies
if: ${{ matrix.os != 'windows' }}
uses: actions/cache@v2
with:
path: temp/npm-cache
key: npm-cache-${{ matrix.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: npm-cache-${{matrix.os }}-
- run: npm ci --ignore-scripts
- name: Upload npm logs
if: ${{ failure() }}
uses: actions/upload-artifact@v1
with:
name: npm-logs
path: temp/npm-cache/_logs
- run: npm run build-tsc
- name: Download package artifact
uses: actions/download-artifact@v1
with:
name: ts-node-packed.tgz
path: tests/
- run: npm install typescript@${{ matrix.typescript }} --force
- run: npm run test-cov
- name: Upload npm logs
if: ${{ failure() }}
uses: actions/upload-artifact@v1
with:
name: npm-logs-${{ matrix.os }}-node-${{ matrix.nodeFlag }}-typescript-${{ matrix.typescriptFlag }}
path: temp/npm-cache/_logs
- run: npm run coverage-report
if: ${{ always() }}
- name: Codecov
if: ${{ always() }}
uses: codecov/codecov-action@v1
with:
flags: ${{ matrix.os }},node_${{ matrix.nodeFlag }},typescript_${{ matrix.typescriptFlag }}
test-2:
needs: test-1
name: "Test: ${{ matrix.os }}, node ${{ matrix.node }}, TS ${{ matrix.typescript }}"
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows]
# Don't forget to add all new flavors to this list!
flavor: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13]
include:
# Node 12.15
# TODO Add comments about why we test 12.15; I think git blame says it's because of an ESM behavioral change that happened at 12.16
- flavor: 1
node: 12.15
nodeFlag: 12_15
typescript: latest
typescriptFlag: latest
# Node 12.16
# Earliest version that supports getFormat, etc hooks: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V12.md#12.16.0
- flavor: 2
node: 12.16
nodeFlag: 12_16
typescript: latest
typescriptFlag: latest
# Node 12
- flavor: 3
node: 12
nodeFlag: 12
typescript: latest
typescriptFlag: latest
# Node 14.13.0
# To test ESM builtin module resolution immediately before a node behavioral change: https://github.com/TypeStrong/ts-node/issues/1130
- flavor: 4
node: 14.13.0
nodeFlag: 14_13_0
typescript: latest
typescriptFlag: latest
# Node 14
- flavor: 5
node: 14
nodeFlag: 14
typescript: latest
typescriptFlag: latest
- flavor: 6
node: 14
nodeFlag: 14
typescript: 2.7
typescriptFlag: 2_7
- flavor: 7
node: 14
nodeFlag: 14
typescript: next
typescriptFlag: next
# Node 16
# Node 16.11.1
# Earliest version that supports old ESM Loader Hooks API: https://github.com/TypeStrong/ts-node/pull/1522
- flavor: 8
node: 16.11.1
nodeFlag: 16_11_1
typescript: latest
typescriptFlag: latest
- flavor: 9
node: 16
nodeFlag: 16
typescript: latest
typescriptFlag: latest
downgradeNpm: true
- flavor: 10
node: 16
nodeFlag: 16
typescript: 2.7
typescriptFlag: 2_7
downgradeNpm: true
- flavor: 11
node: 16
nodeFlag: 16
typescript: next
typescriptFlag: next
downgradeNpm: true
# Node nightly
- flavor: 13
node: nightly
nodeFlag: nightly
typescript: latest
typescriptFlag: latest
downgradeNpm: true
steps:
# checkout code
- uses: actions/checkout@v2
# install node
- name: Use Node.js ${{ matrix.node }}
if: matrix.node != 'nightly'
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Use Node.js 16, will be subsequently overridden by download of nightly
if: matrix.node == 'nightly'
uses: actions/setup-node@v1
with:
node-version: 16
- name: Download Node.js nightly
if: matrix.node == 'nightly' && matrix.os == 'ubuntu'
run: |
export N_PREFIX=$(pwd)/n
npm install -g n
n nightly
sudo cp "${N_PREFIX}/bin/node" "$(which node)"
node --version
- name: Download Node.js nightly
if: matrix.node == 'nightly' && matrix.os == 'windows'
run: |
$version = (Invoke-WebRequest https://nodejs.org/download/nightly/index.json | ConvertFrom-json)[0].version
$url = "https://nodejs.org/download/nightly/$version/win-x64/node.exe"
$targetPath = (Get-Command node.exe).Source
Invoke-WebRequest -Uri $url -OutFile $targetPath -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::Chrome)
node --version
# lint, build, test
# Downgrade from npm 7 to 6 because 7 still seems buggy to me
- if: ${{ matrix.downgradeNpm }}
run: npm install -g npm@6
- run: |
npm config set cache "$( node -p "process.cwd()" )/temp/npm-cache"
- name: Cache dependencies
if: ${{ matrix.os != 'windows' }}
uses: actions/cache@v2
with:
path: temp/npm-cache
key: npm-cache-${{ matrix.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: npm-cache-${{matrix.os }}-
- run: npm ci --ignore-scripts
- name: Upload npm logs
if: ${{ failure() }}
uses: actions/upload-artifact@v1
with:
name: npm-logs
path: temp/npm-cache/_logs
- run: npm run build-tsc
- name: Download package artifact
uses: actions/download-artifact@v1
with:
name: ts-node-packed.tgz
path: tests/
- run: npm install typescript@${{ matrix.typescript }} --force
- run: npm run test-cov
- name: Upload npm logs
if: ${{ failure() }}
uses: actions/upload-artifact@v1
with:
name: npm-logs-${{ matrix.os }}-node-${{ matrix.nodeFlag }}-typescript-${{ matrix.typescriptFlag }}
path: temp/npm-cache/_logs
- run: npm run coverage-report
if: ${{ always() }}
- name: Codecov
if: ${{ always() }}
uses: codecov/codecov-action@v1
with:
flags: ${{ matrix.os }},node_${{ matrix.nodeFlag }},typescript_${{ matrix.typescriptFlag }}