From e3867b172d5a54455e412182ef328858f0bc735d Mon Sep 17 00:00:00 2001 From: Harutaka Kawamura Date: Sun, 1 Jan 2023 16:43:07 +0900 Subject: [PATCH] Simplify unused snapshot check (#1525) --- .github/workflows/ci.yaml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6e198bf259..efe2a43258 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -116,18 +116,12 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- + - run: cargo install cargo-insta - run: pip install black[d]==22.12.0 - name: Run tests run: | - export INSTA_SNAPSHOT_REFERENCES_FILE="$(mktemp)" - cargo test --all - USED_SNAPSHOTS=$(cat $INSTA_SNAPSHOT_REFERENCES_FILE | xargs realpath --relative-to $PWD) - UNUSED_SNAPSHOTS=$(cat <(git ls-files '*.snap') <(echo "$USED_SNAPSHOTS") | sort | uniq -u) - if [ ! -z "$UNUSED_SNAPSHOTS" ]; then - echo "Found unused snapshots:" - echo "$UNUSED_SNAPSHOTS" - exit 1 - fi + cargo insta test --all --delete-unreferenced-snapshots + git diff --exit-code - run: cargo test --package ruff --test black_compatibility_test -- --ignored # TODO(charlie): Re-enable the `wasm-pack` tests.