Skip to content

Commit a19bc92

Browse files
committed
ci: Add fuzzy and queries testing
1 parent b3837cb commit a19bc92

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,60 @@ concurrency:
2222

2323
jobs:
2424
test:
25-
name: Run tests
26-
runs-on: ubuntu-latest
25+
name: Test parser
26+
runs-on: ${{matrix.os}}
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
os: [ubuntu-latest, windows-latest, macos-latest]
2731
steps:
2832
- name: Checkout repository
29-
uses: actions/checkout@v5
33+
uses: actions/checkout@v6
3034
- name: Set up tree-sitter
3135
uses: tree-sitter/setup-action/cli@v2
3236
- uses: actions/checkout@v4
3337
- uses: tree-sitter/parser-test-action@v3
3438
with:
3539
generate: true
36-
test-rust: true
40+
test-rust: ${{runner.os == 'Linux'}}
3741
test-node: true
3842
node-version: 20
43+
test-python: true
44+
python-version: "3.10"
45+
46+
fuzz:
47+
name: Fuzz scanner
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v6
52+
- name: Check for scanner changes
53+
id: scanner-check
54+
shell: sh
55+
run: |-
56+
{
57+
test -f src/scanner.c && ! git diff --quiet HEAD^ -- "$_" &&
58+
printf 'changed=true\n' || printf 'changed=false\n'
59+
} >> "$GITHUB_OUTPUT"
60+
- name: Run fuzzer
61+
uses: tree-sitter/fuzz-action@v4
62+
if: steps.scanner-check.outputs.changed == 'true'
63+
64+
query:
65+
name: Validate queries
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Set up repository
69+
uses: actions/checkout@v6
70+
71+
- name: Set up tree-sitter
72+
uses: tree-sitter/setup-action/cli@v2
73+
74+
- name: Build parser
75+
run: tree-sitter build
76+
77+
- name: Set up ts_query_ls
78+
run: curl -fL https://github.com/ribru17/ts_query_ls/releases/latest/download/ts_query_ls-x86_64-unknown-linux-gnu.tar.gz | tar -xz
79+
80+
- name: Check queries
81+
run: ./ts_query_ls check -f queries/

update.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/sh
2+
set -e
23

34
VERSION=$1
45
if [ -z $VERSION ]; then
@@ -9,6 +10,7 @@ fi
910
tree-sitter version $VERSION
1011
npx tree-sitter-cli@0.26.7 generate
1112
cargo test
13+
ts_query_ls check -f queries/
1214
git commit -am "Release $VERSION"
1315
git tag -- v$VERSION
1416
git push --tags origin main

0 commit comments

Comments
 (0)