@@ -31,14 +31,27 @@ jobs:
3131
3232 - run : npx hereby build
3333
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+
3444 test :
3545 strategy :
3646 fail-fast : false
3747 matrix :
3848 include :
3949 - os : ubuntu-latest
50+ coverage : true
4051 - os : windows-latest
52+ coverage : true
4153 - os : macos-latest
54+ coverage : true
4255 - os : ubuntu-latest
4356 name : ' no submodules'
4457 no-submodules : true
@@ -50,12 +63,23 @@ jobs:
5063 noembed : true
5164 - os : ubuntu-latest
5265 name : ' concurrent test programs'
53- concurrent-test-program : true
66+ concurrent-test-programs : true
67+ coverage : true
5468
5569 name : test (${{ matrix.name || matrix.os }})
5670
5771 runs-on : ${{ matrix.os }}
5872
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+
5983 steps :
6084 - run : git config --system core.longpaths true
6185 if : ${{ matrix.os == 'windows-latest' }}
@@ -79,13 +103,17 @@ jobs:
79103
80104 - name : Tests
81105 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
87107
88108 - 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+
89117 - run : git diff --staged --exit-code --stat
90118
91119 - name : Print baseline diff on failure
94122 npx hereby baseline-accept
95123 git add testdata/baselines/reference
96124 git diff --staged --exit-code
97- - uses : actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
125+ - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
98126 if : ${{ failure() && steps.test.conclusion == 'failure' }}
99127 with :
100128 name : ${{ matrix.os }}-${{ (matrix.race && 'race') || 'norace' }}-new-baselines-artifact
@@ -116,6 +144,9 @@ jobs:
116144
117145 runs-on : ${{ matrix.os }}
118146
147+ env :
148+ TSGO_HEREBY_NOEMBED : ${{ (matrix.noembed && 'true') || 'false' }}
149+
119150 steps :
120151 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
121152 - uses : actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
@@ -125,10 +156,7 @@ jobs:
125156
126157 - run : npm ci
127158
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
132160
133161 format :
134162 runs-on : ubuntu-latest
@@ -204,6 +232,58 @@ jobs:
204232
205233 - run : go -C ./_tools run ./cmd/checkmodpaths $PWD
206234
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+
207287 required :
208288 runs-on : ubuntu-latest
209289 if : ${{ always() }}
0 commit comments