diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 192369e..9fc224b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,29 +27,47 @@ jobs: test: name: Test parser runs-on: ${{matrix.os}} + needs: [fuzz] strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-14] steps: - - name: Set up repository - uses: tree-sitter/parser-setup-action@v1.2 + - 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-node: true + test-rust: ${{runner.os == 'Linux'}} + test-go: ${{runner.os == 'Windows'}} + test-swift: ${{runner.os == 'macOS'}} node-version: ${{vars.NODE_VERSION}} + - name: Parse examples + uses: tree-sitter/parse-action@v4 + with: + files: examples/* + invalid-files: examples/invalid.test + fuzz: + name: Fuzz scanner + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 - name: Check for scanner changes - uses: tj-actions/changed-files@v42 id: scanner-check - if: runner.os == 'Linux' - with: - files: src/scanner.c - - name: Fuzz scanner + run: |- + if git diff --quiet HEAD^ -- src/scanner.c; then + printf 'changed=false\n' >> "$GITHUB_OUTPUT" + else + printf 'changed=true\n' >> "$GITHUB_OUTPUT" + fi + - name: Run the fuzzer uses: tree-sitter/fuzz-action@v4 - if: steps.scanner-check.outputs.any_changed == 'true' + if: steps.scanner-check.outputs.changed == 'true' with: corpus: examples - - name: Run tests - uses: tree-sitter/parser-test-action@v1.2 - with: - test-library: ${{runner.os == 'Linux'}} - corpus-files: examples/* - invalid-files: examples/invalid.test