Skip to content

Commit

Permalink
ci: cache fixtures
Browse files Browse the repository at this point in the history
Only generate fixtures if any grammar from any parser or the parser
generation itself has changed.
  • Loading branch information
dundargoc committed Feb 18, 2024
1 parent 48a1f12 commit 583ca63
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,21 @@ jobs:
- name: Build CLI
run: $BUILD_CMD build --release --target=${{ matrix.target }} --features=${CLI_FEATURES}

- name: Fetch fixtures
if: ${{ !matrix.cli-only && inputs.run_test }} # Don't fetch fixtures for only CLI building targets
run: script/fetch-fixtures
- run: script/fetch-fixtures

- uses: actions/cache@v4
id: cache_fixtures
with:
path: test/fixtures/grammars
key: fixtures-${{ join(matrix.*, '_') }}-${{ hashFiles('test/fixtures/grammars/*/**/src/*.c', 'cli/src/generate/**',
'script/generate-fixtures*', '.github/workflows/builds.yml') }}

- name: Generate fixtures
if: ${{ !matrix.cli-only && inputs.run_test }} # Can't natively run CLI on Github runner's host
if: ${{ !matrix.cli-only && inputs.run_test && steps.cache_fixtures.outputs.cache-hit != 'true' }} # Can't natively run CLI on Github runner's host
run: script/generate-fixtures

- name: Generate WASM fixtures
if: ${{ !matrix.cli-only && !matrix.use-cross && inputs.run_test }} # See comment for the "Build wasm library" step
if: ${{ !matrix.cli-only && !matrix.use-cross && inputs.run_test && steps.cache_fixtures.outputs.cache-hit != 'true' }} # See comment for the "Build wasm library" step
run: script/generate-fixtures-wasm

- name: Run main tests
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/sanitize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ jobs:
- name: Build CLI
run: cargo build --release

- name: Fetch fixtures
run: script/fetch-fixtures

- name: Generate fixtures
- run: script/fetch-fixtures
- uses: actions/cache@v4
id: cache_fixtures
with:
path: test/fixtures/grammars
key: fixtures-sanitize-${{ hashFiles('test/fixtures/grammars/*/**/src/*.c', 'cli/src/generate/**',
'script/generate-fixtures', '.github/workflows/sanitize.yml') }}

- if: ${{ steps.cache_fixtures.outputs.cache-hit != 'true' }}
run: script/generate-fixtures

- name: Run main tests with undefined behaviour sanitizer (UBSAN)
Expand Down

0 comments on commit 583ca63

Please sign in to comment.