aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-08-18 13:01:29 +0200
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commitc5a8c9d01a12efbdee501d67dba7423b790fe500 (patch)
tree8e5b6cd719cbf256a6e3d1db2293014bdfa603a7 /.github
parentfeat(install): allow specifying max jobs (diff)
downloadnvim-treesitter-c5a8c9d01a12efbdee501d67dba7423b790fe500.tar
nvim-treesitter-c5a8c9d01a12efbdee501d67dba7423b790fe500.tar.gz
nvim-treesitter-c5a8c9d01a12efbdee501d67dba7423b790fe500.tar.bz2
nvim-treesitter-c5a8c9d01a12efbdee501d67dba7423b790fe500.tar.lz
nvim-treesitter-c5a8c9d01a12efbdee501d67dba7423b790fe500.tar.xz
nvim-treesitter-c5a8c9d01a12efbdee501d67dba7423b790fe500.tar.zst
nvim-treesitter-c5a8c9d01a12efbdee501d67dba7423b790fe500.zip
ci(tests): add optional workflow for generating grammars
run on PR by adding label `ci:generate` or manually
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/lint.yml4
-rw-r--r--.github/workflows/test-core.yml55
-rw-r--r--.github/workflows/test-generate.yml20
-rw-r--r--.github/workflows/test-queries.yml55
4 files changed, 84 insertions, 50 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index cd97cda06..5c29559d0 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -1,4 +1,4 @@
-name: Linting and style checking
+name: Lint
on:
pull_request:
@@ -34,7 +34,7 @@ jobs:
args: --check .
format-queries:
- name: Lint queries
+ name: Format queries
runs-on: ubuntu-latest
env:
NVIM_TAG: nightly
diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml
new file mode 100644
index 000000000..313084dab
--- /dev/null
+++ b/.github/workflows/test-core.yml
@@ -0,0 +1,55 @@
+on:
+ workflow_call:
+ inputs:
+ type:
+ type: string
+ workflow_dispatch:
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ check_compilation:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+ nvim_tag: [nightly]
+ name: ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ env:
+ NVIM: ${{ matrix.os == 'windows-latest' && 'nvim-win64\\bin\\nvim.exe' || 'nvim' }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: tree-sitter/setup-action/cli@v1
+ - uses: ilammy/msvc-dev-cmd@v1
+
+ - name: Install and prepare Neovim
+ env:
+ NVIM_TAG: ${{ matrix.nvim_tag }}
+ run: |
+ bash ./scripts/ci-install.sh
+
+ - if: inputs.type == 'generate'
+ name: Generate and compile parsers
+ run: $NVIM -l ./scripts/install-parsers.lua --generate --max-jobs=2
+
+ - if: inputs.type == 'queries'
+ 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') }}
+
+ - if: inputs.type == 'queries'
+ name: Compile parsers
+ run: $NVIM -l ./scripts/install-parsers.lua
+
+ - name: Check query files
+ run: $NVIM -l ./scripts/check-queries.lua
diff --git a/.github/workflows/test-generate.yml b/.github/workflows/test-generate.yml
new file mode 100644
index 000000000..ae2f7bd1f
--- /dev/null
+++ b/.github/workflows/test-generate.yml
@@ -0,0 +1,20 @@
+name: Generate from grammar
+
+on:
+ pull_request:
+ types: [unlabeled, labeled, opened, synchronize, reopened]
+ branches:
+ - "main"
+ workflow_dispatch:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+
+jobs:
+ check_compilation:
+ name: Build
+ if: contains(github.event.pull_request.labels.*.name, 'ci:generate') || github.event_name == 'workflow_dispatch'
+ uses: ./.github/workflows/test-core.yml
+ with:
+ type: "generate"
diff --git a/.github/workflows/test-queries.yml b/.github/workflows/test-queries.yml
index 819924c43..a7d4ae79c 100644
--- a/.github/workflows/test-queries.yml
+++ b/.github/workflows/test-queries.yml
@@ -1,58 +1,17 @@
-name: Test queries
+name: Check queries
on:
- # push:
- # branches:
- # - "main"
pull_request:
branches:
- "main"
-# 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
-
-defaults:
- run:
- shell: bash
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check_compilation:
- strategy:
- fail-fast: false
- matrix:
- os: [ubuntu-latest, windows-latest, macos-14]
- nvim_tag: [nightly]
-
- name: Parser compilation
- runs-on: ${{ matrix.os }}
- env:
- NVIM: ${{ matrix.os == 'windows-latest' && 'nvim-win64\\bin\\nvim.exe' || 'nvim' }}
- steps:
- - uses: actions/checkout@v4
- - uses: tree-sitter/setup-action/cli@v1
- - uses: ilammy/msvc-dev-cmd@v1
-
- - name: Install and prepare Neovim
- env:
- NVIM_TAG: ${{ matrix.nvim_tag }}
- 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: Check query files
- run: $NVIM -l ./scripts/check-queries.lua
+ name: Build
+ uses: ./.github/workflows/test-core.yml
+ with:
+ type: "queries"