Skip to content

Commit 8e5e576

Browse files
committed
ci: add PR checks and release workflows
Add merge.yml for PR validation (build, clippy, fmt, tests, dry-run publish) and release.yml for publishing to crates.io via release-plz.
1 parent d387bd8 commit 8e5e576

3 files changed

Lines changed: 159 additions & 0 deletions

File tree

.github/workflows/merge.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Merge Requirements
2+
3+
on: [pull_request]
4+
5+
env:
6+
RUST_BACKTRACE: 1
7+
RUSTFLAGS: "-D warnings"
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macOS-latest]
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: dtolnay/rust-toolchain@stable
19+
20+
- uses: actions/cache@v4
21+
with:
22+
path: |
23+
~/.cargo/bin/
24+
~/.cargo/registry/index/
25+
~/.cargo/registry/cache/
26+
~/.cargo/git/db/
27+
target/
28+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
29+
30+
- name: Build
31+
run: cargo build --release
32+
33+
checks:
34+
name: Enforce Clippy constraints
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: dtolnay/rust-toolchain@stable
39+
with:
40+
components: clippy
41+
42+
- uses: actions/cache@v4
43+
with:
44+
path: |
45+
~/.cargo/bin/
46+
~/.cargo/registry/index/
47+
~/.cargo/registry/cache/
48+
~/.cargo/git/db/
49+
target/
50+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
51+
52+
- name: Run Clippy
53+
run: cargo clippy --all-targets --all-features
54+
55+
fmt:
56+
name: Rustfmt
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v4
60+
- uses: dtolnay/rust-toolchain@stable
61+
with:
62+
components: rustfmt
63+
64+
- name: Check formatting
65+
run: cargo fmt --all -- --check
66+
67+
tests:
68+
name: Test
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v4
72+
- uses: dtolnay/rust-toolchain@stable
73+
74+
- uses: actions/cache@v4
75+
with:
76+
path: |
77+
~/.cargo/bin/
78+
~/.cargo/registry/index/
79+
~/.cargo/registry/cache/
80+
~/.cargo/git/db/
81+
target/
82+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
83+
84+
- name: Run tests
85+
run: cargo test --release
86+
87+
test-publish:
88+
name: Dry run publish
89+
runs-on: ubuntu-latest
90+
steps:
91+
- uses: actions/checkout@v4
92+
- uses: dtolnay/rust-toolchain@stable
93+
94+
- name: Dry run publish
95+
run: cargo publish --dry-run

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
RUST_BACKTRACE: 1
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macOS-latest]
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: dtolnay/rust-toolchain@stable
19+
20+
- uses: actions/cache@v4
21+
with:
22+
path: |
23+
~/.cargo/bin/
24+
~/.cargo/registry/index/
25+
~/.cargo/registry/cache/
26+
~/.cargo/git/db/
27+
target/
28+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
29+
30+
- name: Run cargo build
31+
run: cargo build --release
32+
33+
publish:
34+
name: Publish
35+
runs-on: ubuntu-latest
36+
needs: build
37+
steps:
38+
- uses: actions/checkout@v4
39+
with:
40+
fetch-depth: "0"
41+
token: ${{ secrets.EVMLIB_PAT }}
42+
- uses: dtolnay/rust-toolchain@stable
43+
44+
- shell: bash
45+
run: |
46+
git config --local user.email "action@github.com"
47+
git config --local user.name "GitHub Action"
48+
49+
- uses: cargo-bins/cargo-binstall@main
50+
- shell: bash
51+
run: cargo binstall --no-confirm release-plz
52+
53+
- name: Publish crates
54+
shell: bash
55+
run: |
56+
cargo login "${{ secrets.CRATES_IO_TOKEN }}"
57+
release-plz release --git-token ${{ secrets.EVMLIB_PAT }}

release-plz.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[workspace]
2+
changelog_update = false
3+
semver_check = false
4+
5+
[[package]]
6+
name = "evmlib"
7+
git_tag_name = "v{{ version }}"

0 commit comments

Comments
 (0)