mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
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).
71 lines
2 KiB
YAML
71 lines
2 KiB
YAML
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 == 'build'
|
|
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 == 'build'
|
|
name: Compile parsers
|
|
run: $NVIM -l ./scripts/install-parsers.lua
|
|
|
|
- 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
|