Skip to content

Commit 4ec3786

Browse files
Add lint workflow and block release on failure
1 parent 91c388b commit 4ec3786

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

.github/workflows/lint.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
on: push
2+
name: Lint Rust
3+
4+
jobs:
5+
lint:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- uses: actions-rs/toolchain@v1
10+
with:
11+
toolchain: stable
12+
components: rustfmt, clippy
13+
- uses: Swatinem/rust-cache@v2
14+
- run: cargo --locked fmt --all --check
15+
- run: cargo --locked check
16+
- run: cargo --locked clippy --all-targets --all-features -- -D warnings
17+
- run: cargo --locked test
18+
- run: cargo --locked build --release

.github/workflows/release.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ jobs:
2020
permissions:
2121
contents: write
2222
steps:
23+
- name: Check main branch status
24+
uses: actions/github-script@v7
25+
with:
26+
script: |
27+
const result = await github.rest.repos.getCombinedStatusForRef({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
ref: 'main'
31+
});
32+
if (result.data.state !== 'success') {
33+
core.setFailed('Status checks not green on main');
34+
}
35+
2336
- name: Validate user input
2437
id: release_version
2538
run: |

0 commit comments

Comments
 (0)