Skip to content

Commit 4816afc

Browse files
committed
ci: Add cross build
1 parent 06f40f2 commit 4816afc

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

.github/workflows/ci.yaml

+40-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ on:
99
- main
1010

1111
jobs:
12-
build-babyrite:
12+
check:
1313
runs-on: ubuntu-latest
14-
name: Build babyrite
1514
steps:
1615
- name: Checkout branch
1716
uses: actions/checkout@v4
@@ -34,6 +33,43 @@ jobs:
3433

3534
- name: Run test
3635
run: cargo test --verbose
36+
build:
37+
runs-on: ${{ matrix.job.os || 'ubuntu-latest' }}c
38+
needs: check
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
job:
43+
- os: ubuntu-latest
44+
target: x86_64-unknown-linux-gnu
45+
use-cross: false
46+
- os: ubuntu-latest
47+
target: x86_64-unknown-linux-musl
48+
use-cross: true
49+
- os: macos-latest
50+
target: x86_64-apple-darwin
51+
use-cross: false
52+
- os: macos-latest
53+
target: aarch64-apple-darwin
54+
use-cross: false
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
59+
- name: Setup toolchain
60+
uses: dtolnay/rust-toolchain@stable
61+
with:
62+
target: ${{ matrix.job.target }}
63+
64+
- name: Setup cache
65+
uses: Swatinem/rust-cache@v2
66+
with:
67+
prefix-key: "babyrite/gh-actions-cache"
68+
69+
- name: Install cross
70+
if: matrix.job.use-cross
71+
run: cargo install cross
3772

38-
- name: Run Build
39-
run: cargo build --verbose
73+
- name: Build
74+
run: |
75+
cargo build --verbose --target ${{ matrix.job.target }}

0 commit comments

Comments
 (0)