Skip to content

Commit 7f8cbff

Browse files
committed
chore: update ci workflow
1 parent 6e6505a commit 7f8cbff

File tree

1 file changed

+59
-24
lines changed

1 file changed

+59
-24
lines changed

.github/workflows/ci.yml

Lines changed: 59 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,75 @@
11
name: CI
22

33
on:
4-
pull_request:
5-
branches:
6-
- '**'
74
push:
85
branches:
9-
- 'main'
6+
- main
7+
paths:
8+
- grammar.js
9+
- src/**
10+
- test/**
11+
- bindings/**
12+
- binding.gyp
13+
pull_request:
14+
paths:
15+
- grammar.js
16+
- src/**
17+
- test/**
18+
- bindings/**
19+
- binding.gyp
1020

1121
concurrency:
12-
group: ${{ github.workflow }}-${{ github.ref }}
22+
group: ${{github.workflow}}-${{github.ref}}
1323
cancel-in-progress: true
1424

1525
jobs:
1626
test:
17-
name: Run validation tests
18-
runs-on: ${{ matrix.os }}
27+
name: Test parser
28+
runs-on: ${{matrix.os}}
29+
if: >-
30+
!github.event.repository.is_template &&
31+
github.event.head_commit.message != 'Initial commit'
1932
strategy:
20-
fail-fast: true
33+
fail-fast: false
2134
matrix:
22-
os: [macos-latest, ubuntu-latest, windows-latest]
35+
os: [ubuntu-latest, windows-latest, macos-14]
2336
steps:
2437
- name: Checkout repository
25-
uses: actions/checkout@v3
26-
- name: Install Node.js
27-
uses: actions/setup-node@v3
38+
uses: actions/checkout@v4
39+
- name: Set up tree-sitter
40+
uses: tree-sitter/setup-action/cli@v1
41+
- name: Check for scanner changes
42+
id: scanner-check
43+
shell: sh
44+
run: |-
45+
{
46+
test -f src/scanner.c && ! git diff --quiet HEAD^ -- "$_" &&
47+
printf 'changed=true\n' || printf 'changed=false\n'
48+
} >> "$GITHUB_OUTPUT"
49+
- name: Fuzz scanner
50+
uses: tree-sitter/fuzz-action@v4
51+
if: steps.scanner-check.outputs.changed == 'true'
52+
- name: Run tests
53+
uses: tree-sitter/parser-test-action@v2
2854
with:
29-
node-version: '20.10.x'
30-
registry-url: 'https://registry.npmjs.org'
31-
- name: Install dependencies
32-
run: npm ci
33-
- name: Run tree-sitter tests
34-
run: npm test
35-
- name: Ensure generated parser files are up-to-date
36-
# On Windows and Macos, tree-sitter generate results in a diff, not sure why
37-
if: runner.os != 'Windows' && runner.os != 'macOS'
38-
run: |
39-
git status
40-
test -z "$(git status --porcelain)"
55+
test-rust: ${{runner.os == 'Linux'}}
56+
fuzz:
57+
name: Fuzz scanner
58+
runs-on: ubuntu-latest
59+
if: >-
60+
!github.event.repository.is_template &&
61+
github.event.head_commit.message != 'Initial commit'
62+
steps:
63+
- name: Checkout repository
64+
uses: actions/checkout@v4
65+
- name: Check for scanner changes
66+
id: scanner-check
67+
shell: sh
68+
run: |-
69+
{
70+
test -f src/scanner.c && ! git diff --quiet HEAD^ -- "$_" &&
71+
printf 'changed=true\n' || printf 'changed=false\n'
72+
} >> "$GITHUB_OUTPUT"
73+
- name: Run fuzzer
74+
uses: tree-sitter/fuzz-action@v4
75+
if: steps.scanner-check.outputs.changed == 'true'

0 commit comments

Comments
 (0)