From d353ad1db2daa206dd698ec4259bfb0cc39f8126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Sim=C3=B5es?= Date: Tue, 28 Jul 2026 08:38:27 +0100 Subject: [PATCH 1/2] Add GitHub Actions workflow running the grammar checks and corpus tests Runs 'make check' and 'make test' on pushes to main and on pull requests. ts-bnf-tool has no prebuilt binaries, so it and the tree-sitter CLI are cargo-installed at pinned versions (matching the local toolchain: ts-bnf-tool 0.4.0, tree-sitter-cli 0.26.11) and the resulting binaries cached, keyed on those versions. Action steps are pinned to commit SHAs. --- .github/workflows/tests.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..d1e162a --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,37 @@ +name: Tests + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + env: + TS_BNF_TOOL_VERSION: 0.4.0 + TREE_SITTER_VERSION: 0.26.11 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + # ts-bnf-tool has no prebuilt binaries, so both tools are built with + # cargo once and cached; the key pins the exact versions, so bumping + # the env vars above invalidates the cache and rebuilds. + - name: Cache cargo-installed tools + id: cache-tools + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: | + ~/.cargo/bin/ts-bnf-tool + ~/.cargo/bin/tree-sitter + key: cargo-tools-${{ runner.os }}-ts-bnf-tool-${{ env.TS_BNF_TOOL_VERSION }}-tree-sitter-${{ env.TREE_SITTER_VERSION }} + + - name: Install ts-bnf-tool and tree-sitter CLI + if: steps.cache-tools.outputs.cache-hit != 'true' + run: cargo install --locked ts-bnf-tool@${TS_BNF_TOOL_VERSION} tree-sitter-cli@${TREE_SITTER_VERSION} + + - name: Static grammar checks + run: make check + + - name: Corpus tests + run: make test From aecab15e140e237ccc415be6a9d44c2d467a32f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Sim=C3=B5es?= Date: Tue, 28 Jul 2026 09:19:13 +0100 Subject: [PATCH 2/2] Bump CI's ts-bnf-tool to 0.5.0 The published 0.4.0 predates the diamond-include fix (ambs/ tree-sitter-bnf-tools#302), so it merged literals.bnf and pou.bnf twice (each is %included via two paths) and 'make check' failed with 248 'rule defined more than once' warnings - locally invisible because the local install was built from a post-fix checkout. 0.5.0 includes the fix; verified clean against this grammar with the actual crates.io binary before bumping. --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d1e162a..10af8db 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ jobs: test: runs-on: ubuntu-latest env: - TS_BNF_TOOL_VERSION: 0.4.0 + TS_BNF_TOOL_VERSION: 0.5.0 TREE_SITTER_VERSION: 0.26.11 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1