-
Notifications
You must be signed in to change notification settings - Fork 8
153 lines (141 loc) · 4.07 KB
/
ci.yml
File metadata and controls
153 lines (141 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: CI
on:
push:
branches: ['master']
pull_request:
branches: ['master']
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: dtolnay/[email protected]
id: toolchain
with:
components: clippy
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
- run: cargo clippy --tests --no-deps -- -D warnings
format:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: dtolnay/[email protected]
id: toolchain
with:
components: rustfmt
- run: cargo fmt --check
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: dtolnay/[email protected]
id: toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
- 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@v2
with:
install-lib: false
- uses: dtolnay/[email protected]
id: toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
- name: Compile
run: |
cargo build --release
echo ${{ github.workspace }}/target/release >> $GITHUB_PATH
- name: Clone nvim-treesitter corpus
uses: actions/checkout@v6
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 --max-jobs=10
- 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
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: dtolnay/[email protected]
id: toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
- name: Check schema generation
run: |
# Generate schema
cargo xtask schema
# Check for uncommitted changes
if [[ -n "$(git status --porcelain)" ]]; then
echo '❌ Uncommitted changes detected after running `cargo xtask schema`:'
git --no-pager diff
exit 1
else
echo "✅ No changes; schema is up to date."
fi