Skip to content

Commit fa8b6b9

Browse files
committed
ci: set up cross comp for Rust builds
Signed-off-by: NotAShelf <[email protected]> Change-Id: I154d2afb05088e22882985bcd4536f026a6a6964
1 parent 16a1d5f commit fa8b6b9

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

.github/workflows/rust.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,45 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
build:
14-
15-
runs-on: ubuntu-latest
13+
test:
14+
name: Test on ${{ matrix.target }}
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- os: ubuntu-latest
21+
target: x86_64-unknown-linux-gnu
22+
- os: ubuntu-latest
23+
target: aarch64-unknown-linux-gnu
1624

1725
steps:
1826
- name: "Checkout"
1927
uses: actions/checkout@v4
20-
- name: "Build with Cargo"
21-
run: cargo build --verbose
28+
29+
- name: "Setup Rust toolchain"
30+
uses: actions-rust-lang/setup-rust-toolchain@v1
31+
with:
32+
target: ${{ matrix.target }}
33+
34+
- name: "Install cross-compilation tools"
35+
if: matrix.target == 'aarch64-unknown-linux-gnu'
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y gcc-aarch64-linux-gnu
39+
40+
- name: "Configure linker for aarch64"
41+
if: matrix.target == 'aarch64-unknown-linux-gnu'
42+
run: |
43+
mkdir -p .cargo
44+
cat >> .cargo/config.toml << EOF
45+
[target.aarch64-unknown-linux-gnu]
46+
linker = "aarch64-linux-gnu-gcc"
47+
EOF
48+
49+
- name: "Build"
50+
run: cargo build --verbose --target ${{ matrix.target }}
51+
52+
- name: "Run tests"
53+
if: matrix.target == 'x86_64-unknown-linux-gnu'
54+
run: cargo test --verbose --target ${{ matrix.target }}

0 commit comments

Comments
 (0)