Skip to content

Commit 57ab6a1

Browse files
sionsmithclaude
andcommitted
ci: add CI and release workflows
- CI: check, test, clippy, format on push/PR to main - Release: cross-compile for linux x86_64/aarch64 + macOS x86_64/aarch64, generate man pages, create GitHub release with binaries on tag push Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 38ef5f7 commit 57ab6a1

2 files changed

Lines changed: 144 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
jobs:
13+
check:
14+
name: Check
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: dtolnay/rust-toolchain@stable
19+
- uses: Swatinem/rust-cache@v2
20+
- run: cargo check --workspace
21+
22+
test:
23+
name: Test
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: dtolnay/rust-toolchain@stable
28+
- uses: Swatinem/rust-cache@v2
29+
- run: cargo test --workspace
30+
31+
clippy:
32+
name: Clippy
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: dtolnay/rust-toolchain@stable
37+
with:
38+
components: clippy
39+
- uses: Swatinem/rust-cache@v2
40+
- run: cargo clippy --workspace -- -D warnings
41+
42+
fmt:
43+
name: Format
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: dtolnay/rust-toolchain@stable
48+
with:
49+
components: rustfmt
50+
- run: cargo fmt --all -- --check

.github/workflows/release.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
build:
16+
name: Build ${{ matrix.target }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
include:
21+
- target: x86_64-unknown-linux-gnu
22+
os: ubuntu-latest
23+
artifact: wpx-linux-x86_64
24+
- target: aarch64-unknown-linux-gnu
25+
os: ubuntu-latest
26+
artifact: wpx-linux-aarch64
27+
- target: x86_64-apple-darwin
28+
os: macos-latest
29+
artifact: wpx-darwin-x86_64
30+
- target: aarch64-apple-darwin
31+
os: macos-latest
32+
artifact: wpx-darwin-aarch64
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- uses: dtolnay/rust-toolchain@stable
38+
with:
39+
targets: ${{ matrix.target }}
40+
41+
- uses: Swatinem/rust-cache@v2
42+
with:
43+
key: ${{ matrix.target }}
44+
45+
- name: Install cross-compilation tools
46+
if: matrix.target == 'aarch64-unknown-linux-gnu'
47+
run: |
48+
sudo apt-get update
49+
sudo apt-get install -y gcc-aarch64-linux-gnu
50+
51+
- name: Build
52+
run: cargo build --release --target ${{ matrix.target }}
53+
env:
54+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
55+
56+
- name: Package
57+
run: |
58+
mkdir -p dist
59+
cp target/${{ matrix.target }}/release/wpx dist/${{ matrix.artifact }}
60+
chmod +x dist/${{ matrix.artifact }}
61+
tar czf dist/${{ matrix.artifact }}.tar.gz -C dist ${{ matrix.artifact }}
62+
63+
- name: Generate man pages
64+
if: matrix.target == 'x86_64-unknown-linux-gnu'
65+
run: |
66+
mkdir -p dist/man
67+
cargo run --release --target ${{ matrix.target }} -- man --dir dist/man
68+
tar czf dist/wpx-man-pages.tar.gz -C dist/man .
69+
70+
- uses: actions/upload-artifact@v4
71+
with:
72+
name: ${{ matrix.artifact }}
73+
path: dist/*.tar.gz
74+
75+
release:
76+
name: Release
77+
needs: build
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v4
81+
82+
- uses: actions/download-artifact@v4
83+
with:
84+
path: artifacts
85+
merge-multiple: true
86+
87+
- name: Create release
88+
env:
89+
GH_TOKEN: ${{ github.token }}
90+
run: |
91+
gh release create ${{ github.ref_name }} \
92+
--title "wpx ${{ github.ref_name }}" \
93+
--generate-notes \
94+
artifacts/*.tar.gz

0 commit comments

Comments
 (0)