Skip to content

Check for unused baselines in CI, remove unused baselines #735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,58 @@ jobs:

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

baselines:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
- uses: ./.github/actions/setup-go
with:
cache-name: baselines

- run: npm ci

- name: Remove all baselines
run: rm -rf testdata/baselines/reference

- name: Run tests
run: npx hereby test &> /dev/null || exit 0

- name: Accept baselines
run: |
npx hereby baseline-accept
git add testdata/baselines/reference

- name: Run tests
run: npx hereby test

- name: Check baselines
id: check-baselines
run: |
function print_diff() {
if ! git diff --staged --exit-code --quiet --diff-filter=$1; then
echo "$2:"
git diff --staged --name-only --diff-filter=$1
fi
}

if ! git diff --staged --exit-code --quiet; then
print_diff ACR "Missing baselines"
print_diff MTUXB "Modified baselines"
print_diff D "Unused baselines"
git diff --staged > fix_baselines.patch
exit 1
fi

- name: Upload baseline diff artifact
if: ${{ failure() && steps.check-baselines.conclusion == 'failure' }}
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: fix_baselines.patch
path: fix_baselines.patch

required:
runs-on: ubuntu-latest
if: ${{ always() }}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading