build(node): Fix node tests #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
- main | |
paths: | |
- grammar.js | |
- src/** | |
- test/** | |
- bindings/** | |
- binding.gyp | |
- .github/workflows/ci.yml | |
pull_request: | |
paths: | |
- grammar.js | |
- src/** | |
- test/** | |
- bindings/** | |
- binding.gyp | |
- .github/workflows/ci.yml | |
concurrency: | |
group: ${{github.workflow}}-${{github.ref}} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Test parser | |
runs-on: ${{matrix.os}} | |
if: >- | |
!github.event.repository.is_template && | |
github.event.head_commit.message != 'Initial commit' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-14] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up tree-sitter | |
uses: tree-sitter/setup-action/cli@v1 | |
- name: Run tests | |
uses: tree-sitter/parser-test-action@v2 | |
with: | |
test-rust: ${{runner.os == 'Linux'}} | |
- name: Parse examples | |
run: tree-sitter parse --stat examples/.editorconfig examples/*.editorconfig | |
fuzz: | |
name: Fuzz scanner | |
runs-on: ubuntu-latest | |
if: >- | |
!github.event.repository.is_template && | |
github.event.head_commit.message != 'Initial commit' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check for scanner changes | |
id: scanner-check | |
shell: sh | |
run: |- | |
{ | |
test -f src/scanner.c && ! git diff --quiet HEAD^ -- "$_" && | |
printf 'changed=true\n' || printf 'changed=false\n' | |
} >> "$GITHUB_OUTPUT" | |
- name: Run fuzzer | |
uses: tree-sitter/fuzz-action@v4 | |
if: steps.scanner-check.outputs.changed == 'true' | |
format-check-scanner: | |
name: Format check scanner.c | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Run clang-format style check for scanner.c. | |
uses: jidicula/[email protected] | |
with: | |
clang-format-version: '18' | |
check-path: 'src' | |
include-regex: '^src/scanner\.c$' | |
format-check-grammar: | |
name: Format check grammar.js | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install node dependencies | |
run: npm clean-install | |
- name: Check formatting | |
run: npm run check-format |