@@ -31,14 +31,27 @@ jobs:
31
31
32
32
- run : npx hereby build
33
33
34
+ extension :
35
+ runs-on : ubuntu-latest
36
+ steps :
37
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38
+ - uses : actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
39
+
40
+ - run : npm ci
41
+
42
+ - run : npm run extension:build
43
+
34
44
test :
35
45
strategy :
36
46
fail-fast : false
37
47
matrix :
38
48
include :
39
49
- os : ubuntu-latest
50
+ coverage : true
40
51
- os : windows-latest
52
+ coverage : true
41
53
- os : macos-latest
54
+ coverage : true
42
55
- os : ubuntu-latest
43
56
name : ' no submodules'
44
57
no-submodules : true
@@ -50,12 +63,23 @@ jobs:
50
63
noembed : true
51
64
- os : ubuntu-latest
52
65
name : ' concurrent test programs'
53
- concurrent-test-program : true
66
+ concurrent-test-programs : true
67
+ coverage : true
54
68
55
69
name : test (${{ matrix.name || matrix.os }})
56
70
57
71
runs-on : ${{ matrix.os }}
58
72
73
+ permissions :
74
+ id-token : write
75
+ contents : read
76
+
77
+ env :
78
+ TSGO_HEREBY_RACE : ${{ (matrix.race && 'true') || 'false' }}
79
+ TSGO_HEREBY_NOEMBED : ${{ (matrix.noembed && 'true') || 'false' }}
80
+ TSGO_HEREBY_CONCURRENT_TEST_PROGRAMS : ${{ (matrix.concurrent-test-programs && 'true') || 'false' }}
81
+ TSGO_HEREBY_COVERAGE : ${{ (matrix.coverage && 'true') || 'false' }}
82
+
59
83
steps :
60
84
- run : git config --system core.longpaths true
61
85
if : ${{ matrix.os == 'windows-latest' }}
@@ -79,13 +103,17 @@ jobs:
79
103
80
104
- name : Tests
81
105
id : test
82
- run : npx hereby test:all ${RACE_FLAG:+"$RACE_FLAG"} ${NOEMBED_FLAG:+"$NOEMBED_FLAG"} ${CONCURRENTTESTPROGRAM_FLAG:+"$CONCURRENTTESTPROGRAM_FLAG"}
83
- env :
84
- RACE_FLAG : ${{ (matrix.race && '--race') || '' }}
85
- NOEMBED_FLAG : ${{ (matrix.noembed && '--noembed') || '' }}
86
- CONCURRENTTESTPROGRAM_FLAG : ${{ (matrix.concurrent-test-program && '--concurrentTestPrograms') || '' }}
106
+ run : npx hereby test:all
87
107
88
108
- run : git add .
109
+
110
+ - uses : codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
111
+ if : ${{ always() && matrix.coverage }}
112
+ with :
113
+ use_oidc : true
114
+ name : ${{ matrix.name || matrix.os }}
115
+ directory : ./coverage
116
+
89
117
- run : git diff --staged --exit-code --stat
90
118
91
119
- name : Print baseline diff on failure
94
122
npx hereby baseline-accept
95
123
git add testdata/baselines/reference
96
124
git diff --staged --exit-code
97
- - uses : actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
125
+ - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
98
126
if : ${{ failure() && steps.test.conclusion == 'failure' }}
99
127
with :
100
128
name : ${{ matrix.os }}-${{ (matrix.race && 'race') || 'norace' }}-new-baselines-artifact
@@ -116,6 +144,9 @@ jobs:
116
144
117
145
runs-on : ${{ matrix.os }}
118
146
147
+ env :
148
+ TSGO_HEREBY_NOEMBED : ${{ (matrix.noembed && 'true') || 'false' }}
149
+
119
150
steps :
120
151
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
121
152
- uses : actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
@@ -125,10 +156,7 @@ jobs:
125
156
126
157
- run : npm ci
127
158
128
- - run : npx hereby install-tools
129
- - run : npx hereby lint ${NOEMBED_FLAG:+"$NOEMBED_FLAG"}
130
- env :
131
- NOEMBED_FLAG : ${{ (matrix.noembed && '--noembed') || '' }}
159
+ - run : npx hereby lint
132
160
133
161
format :
134
162
runs-on : ubuntu-latest
@@ -204,6 +232,58 @@ jobs:
204
232
205
233
- run : go -C ./_tools run ./cmd/checkmodpaths $PWD
206
234
235
+ baselines :
236
+ runs-on : ubuntu-latest
237
+ steps :
238
+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
239
+ with :
240
+ submodules : true
241
+ - uses : actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
242
+ - uses : ./.github/actions/setup-go
243
+ with :
244
+ cache-name : baselines
245
+
246
+ - run : npm ci
247
+
248
+ - name : Remove all baselines
249
+ run : rm -rf testdata/baselines/reference
250
+
251
+ - name : Run tests
252
+ run : npx hereby test &> /dev/null || exit 0
253
+
254
+ - name : Accept baselines
255
+ run : |
256
+ npx hereby baseline-accept
257
+ git add testdata/baselines/reference
258
+
259
+ - name : Run tests
260
+ run : npx hereby test
261
+
262
+ - name : Check baselines
263
+ id : check-baselines
264
+ run : |
265
+ function print_diff() {
266
+ if ! git diff --staged --exit-code --quiet --diff-filter=$1; then
267
+ echo "$2:"
268
+ git diff --staged --name-only --diff-filter=$1
269
+ fi
270
+ }
271
+
272
+ if ! git diff --staged --exit-code --quiet; then
273
+ print_diff ACR "Missing baselines"
274
+ print_diff MTUXB "Modified baselines"
275
+ print_diff D "Unused baselines"
276
+ git diff --staged > fix_baselines.patch
277
+ exit 1
278
+ fi
279
+
280
+ - name : Upload baseline diff artifact
281
+ if : ${{ failure() && steps.check-baselines.conclusion == 'failure' }}
282
+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
283
+ with :
284
+ name : fix_baselines.patch
285
+ path : fix_baselines.patch
286
+
207
287
required :
208
288
runs-on : ubuntu-latest
209
289
if : ${{ always() }}
0 commit comments