aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2025-04-29 19:40:18 +0200
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:41 +0200
commit53dccb3a77da54a4e428275e8b44dbff77e0d47d (patch)
tree921e2ba83265f6cba3e828b3100692255e33f359 /.github/workflows
parentrefactor(locals): fix type annotations and warnings (diff)
downloadnvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar
nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar.gz
nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar.bz2
nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar.lz
nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar.xz
nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.tar.zst
nvim-treesitter-53dccb3a77da54a4e428275e8b44dbff77e0d47d.zip
feat(tests)!: new infrastructure based on makefile
Problem: Not easy to run all checks and tests locally. Redundant CI workflows. Solution: Separate CI into two workflows: * lint: Lua files (stylua, luals), query files (valid captures, predicates, directives using tsqueryls), docs (SUPPORTED_LANGUAGES.md) -- does not need parser installation * tests: parsers (ABI compatibility), query files (tsqueryls on Linux/macOS; nvim on Windows), highlight and indent tests (separated for better readability) -- needs parser installation (but only once) Switch to https://github.com/nvim-treesitter/highlight-assertions fork with ABI 15 support. Run all tests (on Linux and macOS) through `make` (`formatlua`, `checklua`, `lintquery`, `formatquery`, `checkquery`, `docs`, `tests`), which downloads and caches all necessary dependencies. Remove `update-readme` workflow (replaced by lint job on PRs).
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/lint.yml52
-rw-r--r--.github/workflows/test-core.yml22
-rw-r--r--.github/workflows/test-generate.yml6
-rw-r--r--.github/workflows/test-queries.yml10
-rw-r--r--.github/workflows/tests.yml60
-rw-r--r--.github/workflows/update-parsers.yml2
-rw-r--r--.github/workflows/update-readme.yml47
7 files changed, 55 insertions, 144 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 5c29559d0..cf9e9364f 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -1,52 +1,50 @@
name: Lint
on:
+ push:
+ branches:
+ - "main"
pull_request:
branches:
- "main"
+ workflow_dispatch:
jobs:
- luacheck:
- name: Luacheck
+ lua:
+ name: Lint Lua files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - name: Prepare
+ - name: Format
run: |
- sudo apt-get update
- sudo apt-get install luarocks -y
- sudo luarocks install luacheck
+ make formatlua
+ git diff --exit-code
- - name: Run Luacheck
- run: luacheck .
+ - name: Lint
+ run: make checklua
- stylua:
- name: StyLua
+ queries:
+ name: Lint query files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - name: Lint with stylua
- uses: JohnnyMorganz/stylua-action@v4
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- version: latest
- args: --check .
- format-queries:
- name: Format queries
+ - name: Format
+ run: |
+ make formatquery
+ git diff --exit-code
+
+ - name: Lint
+ run: make lintquery
+
+ readme:
+ name: Lint docs
runs-on: ubuntu-latest
- env:
- NVIM_TAG: nightly
steps:
- uses: actions/checkout@v4
- - uses: tree-sitter/setup-action/cli@v1
- - name: Prepare
- run: |
- bash ./scripts/ci-install.sh
- - name: Lint
+ - name: Check SUPPORTED_LANGUAGES
run: |
- nvim -l scripts/install-parsers.lua query
- nvim -l scripts/format-queries.lua
+ make docs
git diff --exit-code
diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml
index 313084dab..05f8078ce 100644
--- a/.github/workflows/test-core.yml
+++ b/.github/workflows/test-core.yml
@@ -35,7 +35,7 @@ jobs:
name: Generate and compile parsers
run: $NVIM -l ./scripts/install-parsers.lua --generate --max-jobs=2
- - if: inputs.type == 'queries'
+ - if: inputs.type == 'build'
name: Setup Parsers Cache
id: parsers-cache
uses: actions/cache@v4
@@ -47,9 +47,25 @@ jobs:
'./lua/nvim-treesitter/install.lua',
'./lua/nvim-treesitter/parsers.lua') }}
- - if: inputs.type == 'queries'
+ - if: inputs.type == 'build'
name: Compile parsers
run: $NVIM -l ./scripts/install-parsers.lua
- - name: Check query files
+ - name: Check parsers
+ run: $NVIM -l ./scripts/check-parsers.lua
+
+ - name: Check queries (nvim)
+ if: ${{ matrix.os == 'windows-latest' }}
run: $NVIM -l ./scripts/check-queries.lua
+
+ - name: Check queries (tsqueryls)
+ if: ${{ matrix.os != 'windows-latest' }}
+ run: make checkquery
+
+ - name: Run highlight tests
+ if: ${{ matrix.os != 'windows-latest' }}
+ run: make tests TESTS=query NVIM_BIN=$NVIM
+
+ - name: Run indents tests
+ if: ${{ matrix.os != 'windows-latest' }}
+ run: make tests TESTS=indent NVIM_BIN=$NVIM
diff --git a/.github/workflows/test-generate.yml b/.github/workflows/test-generate.yml
index ae2f7bd1f..0735f9f2c 100644
--- a/.github/workflows/test-generate.yml
+++ b/.github/workflows/test-generate.yml
@@ -1,4 +1,4 @@
-name: Generate from grammar
+name: Tests
on:
pull_request:
@@ -8,12 +8,12 @@ on:
workflow_dispatch:
concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
+ group: ${{ github.workflow }}-generate-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check_compilation:
- name: Build
+ name: Generate
if: contains(github.event.pull_request.labels.*.name, 'ci:generate') || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/test-core.yml
with:
diff --git a/.github/workflows/test-queries.yml b/.github/workflows/test-queries.yml
index a7d4ae79c..5d95bb351 100644
--- a/.github/workflows/test-queries.yml
+++ b/.github/workflows/test-queries.yml
@@ -1,12 +1,16 @@
-name: Check queries
+name: Tests
on:
+ push:
+ branches:
+ - "main"
pull_request:
branches:
- "main"
+ workflow_dispatch:
concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
+ group: ${{ github.workflow }}-build-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
@@ -14,4 +18,4 @@ jobs:
name: Build
uses: ./.github/workflows/test-core.yml
with:
- type: "queries"
+ type: "build"
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
deleted file mode 100644
index 7a946377c..000000000
--- a/.github/workflows/tests.yml
+++ /dev/null
@@ -1,60 +0,0 @@
-name: Tests
-
-on:
- # push:
- # branches:
- # - "main"
- pull_request:
- branches:
- - "main"
- workflow_dispatch:
-
-# Cancel any in-progress CI runs for a PR if it is updated
-concurrency:
- group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
- cancel-in-progress: true
-
-jobs:
- check_compilation:
- strategy:
- fail-fast: false
- matrix:
- os: [ubuntu-latest]
-
- name: Run tests
- runs-on: ${{ matrix.os }}
- steps:
- - uses: actions/checkout@v4
- - uses: tree-sitter/setup-action/cli@v1
-
- - name: Test Dependencies
- run: |
- mkdir -p ~/.local/share/nvim/site/pack/plenary.nvim/start
- cd ~/.local/share/nvim/site/pack/plenary.nvim/start
- git clone https://github.com/nvim-lua/plenary.nvim
- curl -L https://github.com/theHamsta/highlight-assertions/releases/download/v0.1.6/highlight-assertions_v0.1.6_x86_64-unknown-linux-gnu.tar.gz | tar -xz
- cp highlight-assertions /usr/local/bin
-
- - name: Install and prepare Neovim
- env:
- NVIM_TAG: nightly
- TREE_SITTER_CLI_TAG: v0.20.8
- run: |
- bash ./scripts/ci-install.sh
-
- - name: Setup Parsers Cache
- id: parsers-cache
- uses: actions/cache@v4
- with:
- path: |
- ~/.local/share/nvim/site/parser/
- ~/AppData/Local/nvim-data/site/parser/
- key: parsers-${{ join(matrix.*, '-') }}-${{ hashFiles(
- './lua/nvim-treesitter/install.lua',
- './lua/nvim-treesitter/parsers.lua') }}
-
- - name: Compile parsers
- run: nvim -l ./scripts/install-parsers.lua
-
- - name: Tests
- run: PATH=/usr/local/bin:$PATH ./scripts/run_tests.sh
diff --git a/.github/workflows/update-parsers.yml b/.github/workflows/update-parsers.yml
index 683c732c6..ba3286428 100644
--- a/.github/workflows/update-parsers.yml
+++ b/.github/workflows/update-parsers.yml
@@ -2,7 +2,7 @@ name: Update parsers
on:
schedule:
- - cron: "30 6 * * *"
+ - cron: "30 6 * * 6"
workflow_dispatch:
env:
diff --git a/.github/workflows/update-readme.yml b/.github/workflows/update-readme.yml
deleted file mode 100644
index 335756619..000000000
--- a/.github/workflows/update-readme.yml
+++ /dev/null
@@ -1,47 +0,0 @@
-name: Update README
-
-on:
- push:
- branches:
- - main
- workflow_dispatch:
-
-jobs:
- update-readme:
- name: Update README
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
-
- - uses: actions/create-github-app-token@v2
- id: app-token
- with:
- app-id: ${{ vars.TOKEN_ID }}
- private-key: ${{ secrets.TOKEN_PRIVATE_KEY }}
-
- - name: Prepare
- env:
- NVIM_TAG: nightly
- run: |
- bash ./scripts/ci-install.sh
-
- - name: Check README
- run: |
- nvim -l scripts/update-readme.lua || echo 'Needs update'
-
- - name: Create Pull Request
- uses: peter-evans/create-pull-request@v7
- with:
- add-paths: SUPPORTED_LANGUAGES.md
- token: ${{ steps.app-token.outputs.token }}
- sign-commits: true
- commit-message: "bot(readme): update"
- title: Update SUPPORTED_LANGUAGES.md
- body: "[beep boop](https://github.com/peter-evans/create-pull-request)"
- branch: update-readme-pr
- base: ${{ github.head_ref }}
-
- - name: Enable Pull Request Automerge
- env:
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: gh pr merge --rebase --auto update-readme-pr