ci: cache fixtures

Only generate fixtures if any grammar from any parser or the parser
generation itself has changed.
This commit is contained in:
dundargoc 2024-02-17 16:03:19 +01:00 committed by dundargoc
parent 48a1f12ca3
commit d4067a6ae6
3 changed files with 36 additions and 8 deletions

25
.github/actions/cache/action.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: 'Cache'
description: "This action caches fixtures"
outputs:
cache-hit:
description: 'Cache hit'
value: ${{ steps.cache_output.outputs.cache-hit }}
runs:
using: "composite"
steps:
- uses: actions/cache@v4
id: cache_fixtures
with:
path: |
test/fixtures/grammars
target/release/tree-sitter-*.wasm
key: fixtures-${{ join(matrix.*, '_') }}-${{ hashFiles(
'.github/workflows/builds.yml',
'.github/workflows/sanitize.yml',
'cli/src/generate/**',
'script/generate-fixtures*',
'test/fixtures/grammars/*/**/src/*.c') }}
- run: echo "cache-hit=${{ steps.cache_fixtures.outputs.cache-hit }}" >> $GITHUB_OUTPUT
shell: bash
id: cache_output