Skip to content

Commit 9b26321

Browse files
committed
Verify committed mocks are up to date in CI
Instead of blindly regenerating mocks (which conflicts with the repo's approach of committing them), run build_runner then check git diff --exit-code so CI fails clearly if committed mocks are stale rather than silently running tests against outdated files.
1 parent 51db6c7 commit 9b26321

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/test.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ jobs:
6666
run: bash prebuild.sh
6767
working-directory: scripts
6868

69+
- name: Verify committed mocks are up to date
70+
run: |
71+
dart run build_runner build --delete-conflicting-outputs
72+
if ! git diff --exit-code -- '*.mocks.dart'; then
73+
echo "Committed mocks are out of date. Run 'dart run build_runner build --delete-conflicting-outputs' locally and commit the regenerated files."
74+
exit 1
75+
fi
76+
6977
- name: Check formatting of changed files
7078
run: |
7179
if [ "${{ github.event_name }}" = "pull_request" ]; then

0 commit comments

Comments
 (0)