diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e1fb18..41b28b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: branches: ['master'] pull_request: branches: ['master'] + permissions: contents: read @@ -42,6 +43,54 @@ jobs: id: toolchain - run: cargo test + corpus: + name: Corpus test + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + NVIM_TS_DIR: .test/nvim-treesitter + steps: + - uses: actions/checkout@v4 + - uses: tree-sitter/setup-action/cli@v1 + - uses: dtolnay/rust-toolchain@1.86.0 + id: toolchain + + - name: Compile + run: | + cargo build --release + echo ${{ github.workspace }}/target/release >> $GITHUB_PATH + + - name: Clone nvim-treesitter corpus + uses: actions/checkout@v4 + with: + repository: nvim-treesitter/nvim-treesitter + ref: main + path: ${{ env.NVIM_TS_DIR }} + + - name: Setup parsers cache + id: parsers-cache + uses: actions/cache@v4 + with: + path: ~/.local/share/nvim/site/parser/ + key: parsers-${{ hashFiles('**/lua/nvim-treesitter/parsers.lua') }} + + - name: Compile parsers + if: steps.parsers-cache.outputs.cache-hit != 'true' + working-directory: ${{ env.NVIM_TS_DIR }} + run: | + bash ./scripts/ci-install.sh + nvim -l ./scripts/install-parsers.lua + + - name: Check corpus + working-directory: ${{ env.NVIM_TS_DIR }} + run: ts_query_ls check runtime/queries + + - name: Format corpus + working-directory: ${{ env.NVIM_TS_DIR }} + run: | + ts_query_ls format runtime/queries + git diff --exit-code + generate-schema: name: Generate schema runs-on: ubuntu-latest