Skip to content

Commit

Permalink
haskell.yml: fail if golden files are not up-to-date or are unused
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Apr 17, 2024
1 parent 0048f11 commit 48febd1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/haskell.yml
Expand Up @@ -149,6 +149,30 @@ jobs:
CREATE_GOLDEN_FILES: 1
run: cabal test all --enable-tests --test-show-details=direct -j1

# We want this check to run first because $(git ls-files -m) (see below) returns both
# modified files *and* deleted files. So we want to fail on deleted files first.
# This makes sure we only report modified files (and not deleted ones) in the next step,
# which is more intuitive.
- name: Check golden files are all being used
run: |
NB_UNUSED_GOLDEN_FILES=$(git ls-files -d | wc -l)
if [[ "$NB_UNUSED_GOLDEN_FILES" != "0" ]]; then
echo -e "⚠️ The following golden files are not used anymore:\n"
git ls-files -d
echo -e "\nPlease delete them."
exit 1
fi
- name: Check golden files are up-to-date
run: |
NB_MODIFIED_GOLDEN_FILES=$(git ls-files -m | wc -l)
if [[ "$NB_MODIFIED_GOLDEN_FILES" != "0" ]]; then
echo -e "💣 The following golden files are not up-to-date:\n"
git ls-files -m
echo -e "\nPlease run the tests locally and update the golden files, or fix your changes."
exit 1
fi
- name: "Tar artifacts"
run: |
mkdir -p artifacts
Expand Down

0 comments on commit 48febd1

Please sign in to comment.