Skip to content

Commit 953abfc

Browse files
committed
ci: update workflows
1 parent 60d0376 commit 953abfc

File tree

5 files changed

+97
-97
lines changed

5 files changed

+97
-97
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
commit-message:
8+
prefix: "ci"

.github/pull_request_template.md

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

.github/workflows/ci.yml

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,58 @@ name: CI
22

33
on:
44
push:
5-
branches:
6-
- master
5+
branches: [master]
6+
paths:
7+
- grammar.js
8+
- src/**
9+
- test/**
10+
- bindings/**
11+
- binding.gyp
712
pull_request:
8-
branches:
9-
- "**"
13+
paths:
14+
- grammar.js
15+
- src/**
16+
- test/**
17+
- bindings/**
18+
- binding.gyp
19+
20+
concurrency:
21+
group: ${{github.workflow}}-${{github.ref}}
22+
cancel-in-progress: true
1023

1124
jobs:
1225
test:
13-
runs-on: ${{ matrix.os }}
26+
name: Test parser
27+
runs-on: ${{matrix.os}}
1428
strategy:
15-
fail-fast: true
29+
fail-fast: false
1630
matrix:
17-
os: [macos-latest, ubuntu-latest]
31+
os: [ubuntu-latest, windows-latest, macos-14]
1832
steps:
19-
- uses: actions/checkout@v3
20-
- uses: actions/setup-node@v3
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
- name: Set up tree-sitter
36+
uses: tree-sitter/setup-action/cli@v1
37+
- name: Set up examples
38+
run: |-
39+
git clone https://github.com/elastic/elasticsearch examples/elasticsearch --single-branch --depth=1 --filter=blob:none
40+
git clone https://github.com/google/guava examples/guava --single-branch --depth=1 --filter=blob:none
41+
git clone https://github.com/ReactiveX/RxJava examples/RxJava --single-branch --depth=1 --filter=blob:none
42+
git clone https://github.com/apache/flink examples/flink --single-branch --depth=1 --filter=blob:none
43+
git clone https://github.com/apache/logging-log4j2 examples/log4j2 --single-branch --depth=1 --filter=blob:none
44+
git clone https://github.com/apache/cassandra examples/cassandra --single-branch --depth=1 --filter=blob:none
45+
- name: Run tests
46+
uses: tree-sitter/parser-test-action@v2
2147
with:
22-
node-version: 18
23-
- run: npm install
24-
- run: npm test
25-
test_windows:
26-
runs-on: windows-latest
27-
steps:
28-
- uses: actions/checkout@v3
29-
- uses: actions/setup-node@v3
48+
test-rust: ${{runner.os == 'Linux'}}
49+
- name: Parse examples
50+
id: examples
51+
continue-on-error: true
52+
uses: tree-sitter/parse-action@v4
53+
with:
54+
files: examples/**/*.java
55+
- uses: actions/upload-artifact@v4
56+
if: steps.examples.outputs.failures != ''
3057
with:
31-
node-version: 18
32-
- run: npm install
33-
- run: npm run-script test-windows
58+
name: failures-${{matrix.os}}
59+
path: ${{steps.examples.outputs.failures}}

.github/workflows/lint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- grammar.js
8+
pull_request:
9+
paths:
10+
- grammar.js
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
cache: npm
22+
node-version: ${{vars.NODE_VERSION}}
23+
- name: Install modules
24+
run: npm ci --legacy-peer-deps
25+
- name: Run ESLint
26+
run: npm run lint

.github/workflows/publish.yml

Lines changed: 17 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,23 @@
1-
name: Publish
1+
name: Publish packages
22

33
on:
44
push:
5-
tags:
6-
- v*
5+
tags: ["*"]
76

8-
env:
9-
CARGO_TERM_COLOR: always
10-
CARGO_INCREMENTAL: 0
7+
concurrency:
8+
group: ${{github.workflow}}-${{github.ref}}
9+
cancel-in-progress: true
1110

1211
jobs:
13-
publish-crate:
14-
15-
runs-on: ubuntu-latest
16-
17-
steps:
18-
- name: Checkout repository
19-
uses: actions/checkout@v3
20-
21-
- name: Install Rust
22-
uses: actions-rs/toolchain@v1
23-
with:
24-
toolchain: stable
25-
profile: minimal
26-
override: true
27-
28-
- name: Verify crate
29-
run: cargo publish --dry-run
30-
31-
- name: Publish crate
32-
run: cargo publish
33-
env:
34-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
35-
36-
publish-npm:
37-
38-
runs-on: ubuntu-latest
39-
40-
steps:
41-
- name: Checkout repository
42-
uses: actions/checkout@v3
43-
44-
- name: Install Node
45-
uses: actions/setup-node@v3
46-
with:
47-
node-version: 18
48-
registry-url: "https://registry.npmjs.org"
49-
50-
- name: Verify package
51-
run: npm publish --dry-run
52-
53-
- name: Publish package
54-
env:
55-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
56-
run: npm publish
57-
58-
create-release:
59-
60-
runs-on: ubuntu-latest
61-
62-
permissions:
63-
contents: write
64-
65-
steps:
66-
- name: Checkout repository
67-
uses: actions/checkout@v3
68-
69-
- name: Create GitHub release
70-
uses: ncipollo/release-action@v1
71-
with:
72-
body: |
73-
Find tree-sitter-java ${{ github.ref_name }} on [crates.io](https://crates.io/crates/tree-sitter-java) or [NPM](https://www.npmjs.com/package/tree-sitter-java).
74-
token: ${{ secrets.GITHUB_TOKEN }}
12+
npm:
13+
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main
14+
secrets:
15+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
16+
crates:
17+
uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main
18+
secrets:
19+
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}}
20+
pypi:
21+
uses: tree-sitter/workflows/.github/workflows/package-pypi.yml@main
22+
secrets:
23+
PYPI_API_TOKEN: ${{secrets.PYPI_API_TOKEN}}

0 commit comments

Comments
 (0)