Skip to content

Commit 90647ba

Browse files
committed
Add CI and release automation
- GitHub Actions CI workflow with test matrix (stable/beta/nightly on Linux, stable on macOS), rustfmt check, semver-checks, and a required-checks sentinel job - Tests run with and without the serde feature - Trusted publishing workflow for crates.io releases triggered by version tags (v*) Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: John Eckersberg <jeckersb@redhat.com>
1 parent 38a0a79 commit 90647ba

2 files changed

Lines changed: 97 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
test:
21+
name: Test (${{ matrix.build }})
22+
runs-on: ${{ matrix.os }}
23+
timeout-minutes: 20
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
build: [stable, beta, nightly, macos]
28+
include:
29+
- build: stable
30+
os: ubuntu-latest
31+
rust: stable
32+
- build: beta
33+
os: ubuntu-latest
34+
rust: beta
35+
- build: nightly
36+
os: ubuntu-latest
37+
rust: nightly
38+
- build: macos
39+
os: macos-latest
40+
rust: stable
41+
steps:
42+
- uses: actions/checkout@v6
43+
- name: Install Rust
44+
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
45+
shell: bash
46+
- run: cargo test
47+
- run: cargo test --features serde
48+
49+
rustfmt:
50+
name: Rustfmt
51+
runs-on: ubuntu-latest
52+
timeout-minutes: 5
53+
steps:
54+
- uses: actions/checkout@v6
55+
- uses: dtolnay/rust-toolchain@stable
56+
with:
57+
components: rustfmt
58+
- run: cargo fmt -- --check
59+
60+
semver-checks:
61+
name: Semver Checks
62+
runs-on: ubuntu-24.04
63+
timeout-minutes: 10
64+
steps:
65+
- uses: actions/checkout@v6
66+
- uses: obi1kenobi/cargo-semver-checks-action@v2
67+
68+
# Sentinel job for required checks - configure this job name in
69+
# repository settings as the single required status check.
70+
required-checks:
71+
if: always()
72+
needs: [test, rustfmt, semver-checks]
73+
runs-on: ubuntu-latest
74+
timeout-minutes: 5
75+
steps:
76+
- run: exit 1
77+
if: >-
78+
needs.test.result != 'success' ||
79+
needs.rustfmt.result != 'success' ||
80+
needs.semver-checks.result != 'success'
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# See https://crates.io/docs/trusted-publishing
2+
name: Publish to crates.io
3+
on:
4+
push:
5+
tags: ['v*']
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-24.04
9+
permissions:
10+
id-token: write
11+
steps:
12+
- uses: actions/checkout@v6
13+
- uses: rust-lang/crates-io-auth-action@v1
14+
id: auth
15+
- run: cargo publish
16+
env:
17+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

0 commit comments

Comments
 (0)