Skip to content

Commit 72e334b

Browse files
committed
chore: add fuzzer and release-please actions
1 parent 9bf8aa6 commit 72e334b

File tree

3 files changed

+107
-20
lines changed

3 files changed

+107
-20
lines changed

.github/workflows/fuzz.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Fuzz Parser
2+
3+
on:
4+
push:
5+
paths:
6+
- src/scanner.c
7+
pull_request:
8+
paths:
9+
- src/scanner.c
10+
workflow_dispatch:
11+
12+
jobs:
13+
test:
14+
name: Parser fuzzing
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: vigoux/tree-sitter-fuzz-action@v1
19+
with:
20+
language: smali
21+
external-scanner: src/scanner.c
22+
time: 60

.github/workflows/publish.yml

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
name: Publish
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
tags:
8-
- "v*"
9-
workflow_dispatch:
4+
pull_request:
5+
types: [closed]
6+
7+
permissions:
8+
contents: write
109

1110
jobs:
1211
build:
@@ -19,33 +18,64 @@ jobs:
1918
- run: npm install
2019
- run: npm test
2120

22-
publish-npm:
23-
if: startsWith(github.ref, 'refs/tags/v')
21+
publish:
22+
if: github.event.pull_request.merged && startsWith(github.event.pull_request.title, 'chore(master):')
2423
needs: build
2524
runs-on: ubuntu-latest
26-
2725
steps:
2826
- uses: actions/checkout@v3
29-
- uses: actions/setup-node@v3
27+
with:
28+
ref: ${{ github.event.pull_request.merge_commit_sha }}
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
- name: Extract version
31+
id: extract_version
32+
run: |
33+
PR_TITLE="${{ github.event.pull_request.title }}"
34+
VERSION=$(echo "$PR_TITLE" | grep -oP '(?<=release ).*$')
35+
echo "::set-output name=version::$VERSION"
36+
- name: Update versions
37+
run: |
38+
version="${{ steps.extract_version.outputs.version }}"
39+
repo_name="${{ github.repository }}"
40+
repo_name="${repo_name##*/}"
41+
42+
git config user.name github-actions[bot]
43+
git config user.email github-actions[bot]@users.noreply.github.com
44+
git fetch origin master
45+
git checkout master
46+
47+
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$version\"/g" package.json
48+
sed -i "s/version = \"[^\"]*\"/version = \"$version\"/g" Cargo.toml
49+
sed -i "s/$repo_name = \"[^\"]*\"/$repo_name = \"$version\"/g" bindings/rust/README.md
50+
51+
git add package.json Cargo.toml bindings/rust/README.md
52+
git commit -m "chore(manifests): bump version to $version"
53+
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:master
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v3
3056
with:
3157
node-version: 16
3258
registry-url: https://registry.npmjs.org/
33-
- run: npm install
3459
- run: npm publish
3560
env:
3661
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
37-
38-
publish-crates:
39-
if: startsWith(github.ref, 'refs/tags/v')
40-
needs: build
41-
runs-on: ubuntu-latest
42-
steps:
43-
- uses: actions/checkout@v3
44-
- uses: actions-rs/toolchain@v1
62+
- name: Setup Rust
63+
uses: actions-rs/toolchain@v1
4564
with:
4665
profile: minimal
4766
toolchain: stable
4867
override: true
49-
- uses: katyo/publish-crates@v2
68+
- name: Publish to Crates.io
69+
uses: katyo/publish-crates@v2
5070
with:
5171
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
72+
- uses: actions/checkout@v3
73+
- name: Tag stable versions
74+
run: |
75+
git config user.name github-actions[bot]
76+
git config user.email github-actions[bot]@users.noreply.github.com
77+
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
78+
git tag -d stable || true
79+
git push origin :stable || true
80+
git tag -a stable -m "Last Stable Release"
81+
git push origin stable

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 16
21+
- run: npm install
22+
- run: npm test
23+
24+
release:
25+
name: release
26+
if: ${{ github.ref == 'refs/heads/master' }}
27+
needs:
28+
- build
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: google-github-actions/release-please-action@v3
32+
id: release
33+
with:
34+
release-type: simple
35+
package-name: tree-sitter-smali

0 commit comments

Comments
 (0)