Skip to content

Commit cf0dd38

Browse files
committed
ci: migrate to nvim-treesitter
1 parent 7cb246e commit cf0dd38

File tree

7 files changed

+90
-216
lines changed

7 files changed

+90
-216
lines changed

.github/workflows/check_query_files.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,50 @@
1-
name: Linting and style checking
1+
name: Lint
22

33
on:
4+
push:
5+
branches:
6+
- "main"
47
pull_request:
58
branches:
69
- "main"
10+
workflow_dispatch:
711

812
jobs:
9-
luacheck:
10-
name: Luacheck
13+
lua:
14+
name: Lint Lua files
1115
runs-on: ubuntu-latest
1216
steps:
1317
- uses: actions/checkout@v4
1418

15-
- name: Prepare
19+
- name: Format
1620
run: |
17-
sudo apt-get update
18-
sudo add-apt-repository universe
19-
sudo apt install luarocks -y
20-
sudo luarocks install luacheck
21+
make formatlua
22+
git diff --exit-code
2123
22-
- name: Run Luacheck
23-
run: sudo ./scripts/style-check.sh
24+
- name: Lint
25+
run: make checklua
2426

25-
stylua:
26-
name: StyLua
27+
queries:
28+
name: Lint query files
2729
runs-on: ubuntu-latest
2830
steps:
2931
- uses: actions/checkout@v4
30-
- name: Lint with stylua
31-
uses: JohnnyMorganz/stylua-action@v4
32-
with:
33-
token: ${{ secrets.GITHUB_TOKEN }}
34-
version: latest
35-
args: --check .
36-
37-
format-queries:
38-
name: Lint queries
32+
33+
- name: Format
34+
run: |
35+
make formatquery
36+
git diff --exit-code
37+
38+
- name: Lint
39+
run: make lintquery
40+
41+
readme:
42+
name: Lint docs
3943
runs-on: ubuntu-latest
40-
env:
41-
NVIM_TAG: stable
4244
steps:
4345
- uses: actions/checkout@v4
44-
- name: Prepare
45-
run: |
46-
bash ./scripts/ci-install-ubuntu-latest.sh
47-
wget -P scripts/ https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/main/scripts/format-queries.lua
48-
mkdir -p ~/.local/share/nvim/site/pack/nvim-treesitter/start
49-
cd ~/.local/share/nvim/site/pack/nvim-treesitter/start
50-
git clone https://github.com/nvim-treesitter/nvim-treesitter.git
5146

52-
- name: Lint
47+
- name: Check SUPPORTED_LANGUAGES
5348
run: |
54-
nvim --headless -c "TSInstallSync query" -c "q"
55-
nvim -l scripts/format-queries.lua queries
49+
make docs
5650
git diff --exit-code

.github/workflows/test.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
on:
2+
push:
3+
branches:
4+
- "main"
5+
pull_request:
6+
branches:
7+
- "main"
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-build-${{ github.ref }}
12+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
13+
14+
defaults:
15+
run:
16+
shell: bash
17+
18+
jobs:
19+
check_compilation:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ubuntu-latest]
24+
nvim_tag: [nightly]
25+
name: ${{ matrix.os }}
26+
runs-on: ${{ matrix.os }}
27+
env:
28+
NVIM: '
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: tree-sitter/setup-action/cli@v1
32+
- uses: ilammy/msvc-dev-cmd@v1
33+
34+
- name: Install and prepare Neovim
35+
env:
36+
NVIM_TAG: ${{ matrix.nvim_tag }}
37+
run: |
38+
bash ./scripts/ci-install.sh
39+
40+
- name: Setup Parsers Cache
41+
id: parsers-cache
42+
uses: actions/cache@v4
43+
with:
44+
path: ~/.local/share/nvim/site/parser/
45+
key: parsers-${{ hashFiles('parsers.lua') }}
46+
47+
- name: Compile parsers
48+
if: steps.parsers-cache.outputs.cache-hit != 'true'
49+
run: $NVIM -l ./scripts/install-parsers.lua --max-jobs=10
50+
51+
- name: Check queries
52+
run: make checkquery
53+
54+
- name: Run tests
55+
run: make tests
56+

.github/workflows/tests.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/update-readme.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.luacheckrc

Lines changed: 0 additions & 17 deletions
This file was deleted.

scripts/install_parsers.lua

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
#!/usr/bin/env -S nvim -l
2+
vim.opt.runtimepath:append(os.getenv('NVIM_TS'))
3+
vim.opt.runtimepath:append('.')
24

3-
local languages = _G.arg
4-
languages[0] = nil
5+
local parsers = {}
6+
for i = 1, #_G.arg do
7+
parsers[#parsers + 1] = _G.arg[i] ---@type string
8+
end
59

6-
-- needed on CI
7-
vim.fn.mkdir(vim.fn.stdpath('cache'), 'p')
8-
9-
local done = false
10-
require('nvim-treesitter.install').install(languages, { force = true }, function()
11-
done = true
12-
end)
13-
14-
vim.wait(6000000, function()
15-
return done
16-
end)
10+
require('nvim-treesitter').install(parsers, { force = true }):wait(1800000) -- wait max. 30 minutes

0 commit comments

Comments
 (0)