Skip to content

Commit 6255c5f

Browse files
authored
chore: cache fixtures build in CI (#296)
* chore: cache fixtures * chore: also rebuild on changes to prepare.mjs
1 parent 5b26311 commit 6255c5f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/run-tests.yml

+12
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,19 @@ jobs:
8282
run: npm run build
8383
- name: 'Lint'
8484
run: npm run lint
85+
- name: Compute Fixtures Cache Key
86+
id: fixture-cache-key
87+
# Fixtures only need to be rebuilt if anything in the tests/fixtures directory changes,
88+
# so we're using a hash of the files in that directory as the cache key.
89+
run: echo "key=$(git ls-files -s tests/fixtures/ tests/prepare.mjs | git hash-object --stdin)" >> "$GITHUB_OUTPUT"
90+
- name: Cache Fixtures
91+
id: cache-fixtures
92+
uses: actions/cache@v4
93+
with:
94+
path: tests/fixtures
95+
key: integration-fixtures-${{ runner.os }}-${{ steps.fixture-cache-key.outputs.key }}
8596
- name: 'Prepare Fixtures'
97+
if: steps.cache-fixtures.outputs.cache-hit != 'true'
8698
run: npm run pretest
8799
- name: 'Test'
88100
run: npm run test:ci -- --shard=${{ matrix.shard }}

0 commit comments

Comments
 (0)