Skip to content

Commit 7a8ec61

Browse files
authored
Check for unused baselines in CI, remove unused baselines (microsoft#735)
1 parent 4553b5b commit 7a8ec61

File tree

214 files changed

+52
-9567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+52
-9567
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,58 @@ jobs:
214214

215215
- run: go -C ./_tools run ./cmd/checkmodpaths $PWD
216216

217+
baselines:
218+
runs-on: ubuntu-latest
219+
steps:
220+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
221+
with:
222+
submodules: true
223+
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
224+
- uses: ./.github/actions/setup-go
225+
with:
226+
cache-name: baselines
227+
228+
- run: npm ci
229+
230+
- name: Remove all baselines
231+
run: rm -rf testdata/baselines/reference
232+
233+
- name: Run tests
234+
run: npx hereby test &> /dev/null || exit 0
235+
236+
- name: Accept baselines
237+
run: |
238+
npx hereby baseline-accept
239+
git add testdata/baselines/reference
240+
241+
- name: Run tests
242+
run: npx hereby test
243+
244+
- name: Check baselines
245+
id: check-baselines
246+
run: |
247+
function print_diff() {
248+
if ! git diff --staged --exit-code --quiet --diff-filter=$1; then
249+
echo "$2:"
250+
git diff --staged --name-only --diff-filter=$1
251+
fi
252+
}
253+
254+
if ! git diff --staged --exit-code --quiet; then
255+
print_diff ACR "Missing baselines"
256+
print_diff MTUXB "Modified baselines"
257+
print_diff D "Unused baselines"
258+
git diff --staged > fix_baselines.patch
259+
exit 1
260+
fi
261+
262+
- name: Upload baseline diff artifact
263+
if: ${{ failure() && steps.check-baselines.conclusion == 'failure' }}
264+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
265+
with:
266+
name: fix_baselines.patch
267+
path: fix_baselines.patch
268+
217269
required:
218270
runs-on: ubuntu-latest
219271
if: ${{ always() }}

testdata/baselines/reference/module/resolver/allowJsCrossMonorepoPackage.trace.json

Lines changed: 0 additions & 79 deletions
This file was deleted.

testdata/baselines/reference/module/resolver/bundlerConditionsExcludesNode(module=esnext).trace.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

testdata/baselines/reference/module/resolver/bundlerConditionsExcludesNode(module=preserve).trace.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

testdata/baselines/reference/module/resolver/bundlerDirectoryModule(moduleresolution=bundler).trace.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)