Skip to content

Commit a7fda5c

Browse files
stephenleoclaude
andcommitted
Add CI/CD release pipeline for cross-platform builds
Introduces GitHub Actions workflow triggered on version tags (v*) that runs tests, builds release binaries for 4 targets (aarch64/x86_64 macOS + Linux), and publishes a GitHub Release. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c02c708 commit a7fda5c

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
test:
11+
name: Test (${{ matrix.os }})
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest]
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Install Rust stable
19+
uses: dtolnay/rust-toolchain@stable
20+
with:
21+
components: rustfmt, clippy
22+
- uses: Swatinem/rust-cache@v2
23+
- name: Check formatting
24+
run: cargo fmt --check
25+
- name: Clippy
26+
run: cargo clippy -- -D warnings
27+
- name: Test
28+
run: cargo test
29+
30+
build:
31+
name: Build (${{ matrix.target }})
32+
needs: test
33+
runs-on: ${{ matrix.runner }}
34+
strategy:
35+
matrix:
36+
include:
37+
- target: aarch64-apple-darwin
38+
runner: macos-latest
39+
- target: x86_64-apple-darwin
40+
runner: macos-13
41+
- target: x86_64-unknown-linux-gnu
42+
runner: ubuntu-latest
43+
- target: aarch64-unknown-linux-gnu
44+
runner: ubuntu-24.04-arm
45+
steps:
46+
- uses: actions/checkout@v4
47+
- name: Install Rust stable
48+
uses: dtolnay/rust-toolchain@stable
49+
with:
50+
targets: ${{ matrix.target }}
51+
- uses: Swatinem/rust-cache@v2
52+
- name: Build release binary
53+
run: cargo build --release --target ${{ matrix.target }}
54+
- name: Rename binary
55+
run: cp target/${{ matrix.target }}/release/cship cship-${{ matrix.target }}
56+
- name: Validate binary
57+
run: |
58+
file cship-${{ matrix.target }}
59+
test -s cship-${{ matrix.target }} || { echo "ERROR: binary is empty"; exit 1; }
60+
- uses: actions/upload-artifact@v4
61+
with:
62+
name: cship-${{ matrix.target }}
63+
path: cship-${{ matrix.target }}
64+
65+
release:
66+
name: Publish GitHub Release
67+
needs: build
68+
runs-on: ubuntu-latest
69+
permissions:
70+
contents: write
71+
steps:
72+
- uses: actions/download-artifact@v4
73+
- uses: softprops/action-gh-release@v2
74+
with:
75+
files: cship-*/cship-*

0 commit comments

Comments
 (0)