Skip to content

Commit 393d7df

Browse files
ci: update workflows
1 parent 3fa47ca commit 393d7df

File tree

6 files changed

+111
-130
lines changed

6 files changed

+111
-130
lines changed

.github/workflows/ci.yml

Lines changed: 94 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,105 @@ name: CI
33
on:
44
push:
55
branches: [main]
6+
paths:
7+
- grammar.js
8+
- src/**
9+
- test/**
10+
- bindings/**
11+
- binding.gyp
612
pull_request:
7-
branches: [main]
13+
paths:
14+
- grammar.js
15+
- src/**
16+
- test/**
17+
- bindings/**
18+
- binding.gyp
19+
20+
concurrency:
21+
group: ${{github.workflow}}-${{github.ref}}
22+
cancel-in-progress: true
823

924
jobs:
1025
test:
11-
name: Test
12-
runs-on: ubuntu-latest
26+
name: Test parser
27+
runs-on: ${{matrix.os}}
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
os: [ubuntu-latest, windows-latest, macos-14]
1332
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v3
16-
- name: Setup Node
17-
uses: actions/setup-node@v3
18-
with:
19-
node-version: '16.x'
20-
- name: Install Dependencies
21-
run: npm install
22-
- name: Test
23-
run: npm run test
33+
- name: Set up repository
34+
uses: tree-sitter/[email protected]
35+
with:
36+
node-version: ${{vars.NODE_VERSION}}
37+
- name: Clone apisix corpus
38+
uses: actions/checkout@v4
39+
with:
40+
path: examples/apisix
41+
repository: apache/apisix
42+
sparse-checkout: apisix/
43+
- name: Clone kong corpus
44+
uses: actions/checkout@v4
45+
with:
46+
path: examples/kong
47+
repository: Kong/kong
48+
sparse-checkout: kong/
49+
- name: Clone lua corpus
50+
uses: actions/checkout@v4
51+
with:
52+
path: examples/lua
53+
repository: lua/lua
54+
sparse-checkout: testes/
55+
- name: Clone luvit corpus
56+
uses: actions/checkout@v4
57+
with:
58+
path: examples/luvit
59+
repository: luvit/luvit
60+
- name: Clone neovim corpus
61+
uses: actions/checkout@v4
62+
with:
63+
path: examples/neovim
64+
repository: neovim/neovim
65+
sparse-checkout-cone-mode: false
66+
sparse-checkout: |-
67+
/test/**/*.lua
68+
/scripts/**/*.lua
69+
/runtime/**/*.lua
70+
- name: Clone xmake corpus
71+
uses: actions/checkout@v4
72+
if: runner.os != 'Windows'
73+
with:
74+
path: examples/xmake
75+
repository: xmake-io/xmake
76+
- name: Run tests
77+
uses: tree-sitter/[email protected]
78+
with:
79+
test-library: ${{runner.os == 'Linux'}}
80+
corpus-files: |-
81+
examples/apisix/**/*.lua
82+
examples/kong/**/*.lua
83+
examples/lua/**/*.lua
84+
examples/luvit/**/*.lua
85+
examples/neovim/**/*.lua
86+
examples/xmake/**/*.lua
87+
invalid-files: |-
88+
examples/neovim/test/functional/fixtures/lua/syntax_error.lua
2489
25-
bindings-rust:
26-
name: Rust Bindings
90+
fuzz:
2791
runs-on: ubuntu-latest
2892
steps:
29-
- name: Checkout
30-
uses: actions/checkout@v3
31-
- name: Setup Rust
32-
uses: actions-rs/toolchain@v1
33-
with:
34-
profile: minimal
35-
toolchain: stable
36-
override: true
37-
- name: Test
38-
uses: actions-rs/cargo@v1
39-
with:
40-
command: test
93+
- name: Checkout repository
94+
uses: actions/checkout@v4
95+
with:
96+
fetch-depth: 2
97+
- name: Check for scanner changes
98+
id: scanner-changes
99+
run: |-
100+
if git diff --quiet HEAD^ -- src/scanner.c; then
101+
printf 'changed=false\n' >> "$GITHUB_OUTPUT"
102+
else
103+
printf 'changed=true\n' >> "$GITHUB_OUTPUT"
104+
fi
105+
- name: Fuzz parser
106+
uses: tree-sitter/fuzz-action@v4
107+
if: steps.scanner-changes.outputs.changed == 'true'

.github/workflows/publish.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Publish package
2+
3+
on:
4+
push:
5+
tags: ["*"]
6+
7+
jobs:
8+
npm:
9+
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main
10+
with:
11+
package-name: "@muniftanjim/tree-sitter-lua"
12+
secrets:
13+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
14+
crates:
15+
uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main
16+
secrets:
17+
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_TOKEN}}

examples/init.lua

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

script/known_failures.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

script/parse-examples

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

script/release.sh

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

0 commit comments

Comments
 (0)