Skip to content

Commit 009def4

Browse files
ObserverOfTimeMichaHoffmann
authored andcommitted
ci: update workflows
- Replace build workflow with CI & fuzz - Add GitHub & NPM release workflow
1 parent c3172d7 commit 009def4

File tree

4 files changed

+121
-33
lines changed

4 files changed

+121
-33
lines changed

.github/workflows/build.yaml

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

.github/workflows/ci.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- grammar.js
8+
- make_grammar.js
9+
- src/**
10+
- test/**
11+
- example/**
12+
- bindings/**
13+
- binding.gyp
14+
pull_request:
15+
paths:
16+
- grammar.js
17+
- make_grammar.js
18+
- src/**
19+
- test/**
20+
- example/**
21+
- bindings/**
22+
- binding.gyp
23+
24+
concurrency:
25+
group: ${{github.workflow}}-${{github.ref}}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
test:
30+
name: Test parser
31+
runs-on: ${{matrix.os}}
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
os: [ubuntu-latest, windows-latest, macos-latest]
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v4
39+
- name: Set up tree-sitter
40+
uses: tree-sitter/setup-action/cli@v1
41+
- name: Regenerate with ABI 14
42+
# TODO: remove when node & swift support ABI 15
43+
run: |-
44+
tree-sitter generate --abi=14
45+
cd dialects/terraform
46+
tree-sitter generate --abi=14
47+
- name: Run parser and binding tests
48+
uses: tree-sitter/parser-test-action@v2
49+
with:
50+
test-node: true
51+
test-rust: ${{runner.os == 'Linux'}}
52+
test-swift: ${{runner.os == 'macOS'}}
53+
- name: Parse sample files
54+
uses: tree-sitter/parse-action@v4
55+
id: parse-files
56+
with:
57+
files: |-
58+
example/**/*.hcl
59+
example/**/*.tf
60+
- name: Upload failures artifact
61+
uses: actions/upload-artifact@v4
62+
if: "!cancelled() && steps.parse-files.outcome == 'failure'"
63+
with:
64+
name: failures-${{runner.os}}
65+
path: ${{steps.parse-files.outputs.failures}}

.github/workflows/fuzz.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: fuzz
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- src/scanner.c
8+
- dialects/*/src/scanner.c
9+
pull_request:
10+
paths:
11+
- src/scanner.c
12+
- dialects/*/src/scanner.c
13+
14+
jobs:
15+
fuzz:
16+
name: Parser fuzzing
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
directory: [".", "dialects/terraform"]
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
- name: Run fuzzer
26+
uses: tree-sitter/fuzz-action@v4
27+
with:
28+
directory: ${{matrix.directory}}

.github/workflows/release.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags: ["*"]
6+
7+
concurrency:
8+
group: ${{github.workflow}}-${{github.ref}}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: write
13+
id-token: write
14+
attestations: write
15+
16+
jobs:
17+
release:
18+
uses: tree-sitter/workflows/.github/workflows/release.yml@main
19+
with:
20+
attestations: true
21+
npm:
22+
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main
23+
secrets:
24+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
25+
crates:
26+
uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main
27+
secrets:
28+
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_TOKEN}}

0 commit comments

Comments
 (0)