1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: CI
on:
push:
branches:
pull_request:
branches:
permissions:
contents: read
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
- os: ubuntu-24.04-arm
target: armv7-unknown-linux-gnueabihf
base_image: raspios_lite:latest
- os: ubuntu-24.04-arm
target: thumbv7neon-unknown-linux-gnueabihf
base_image: raspios_lite:latest
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-11-arm
target: aarch64-pc-windows-msvc
- os: macos-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
name: Build & test on ${{ matrix.os }} / ${{ matrix.target }}
steps:
- uses: actions/checkout@v3
- name: Debug PATH
shell: bash
run: echo $PATH
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: clippy, rustfmt
target: aarch64-pc-windows-msvc
- name: Verify Cargo Installation
shell: bash
run: cargo --version
# Install cross-compilation toolchain for ARM targets
- name: Install ARM toolchain
if: matrix.target == 'armv7-unknown-linux-gnueabihf' || matrix.target == 'thumbv7neon-unknown-linux-gnueabihf'
run: |
sudo dpkg --add-architecture armhf
sudo apt-get update
sudo apt-get install -y gcc-arm-linux-gnueabihf libssl-dev:armhf pkg-config
# Add Rust target for all targets
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Build (ARM targets)
if: matrix.target == 'armv7-unknown-linux-gnueabihf' || matrix.target == 'thumbv7neon-unknown-linux-gnueabihf'
shell: bash
env:
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
CARGO_TARGET_THUMBV7NEON_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
OPENSSL_LIB_DIR: /usr/lib/arm-linux-gnueabihf
OPENSSL_INCLUDE_DIR: /usr/include/openssl
PKG_CONFIG_ALLOW_CROSS: 1
PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig
run: |
cargo build --target ${{ matrix.target }} --release
- name: Build (other targets)
if: matrix.target != 'armv7-unknown-linux-gnueabihf' && matrix.target != 'thumbv7neon-unknown-linux-gnueabihf'
shell: bash
run: |
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" && "${{ matrix.os }}" == "ubuntu-latest" ]]; then
echo "skip"
else
cargo build --target ${{ matrix.target }} --release
fi
- name: Test (ARM targets)
if: matrix.target == 'armv7-unknown-linux-gnueabihf' || matrix.target == 'thumbv7neon-unknown-linux-gnueabihf'
shell: bash
env:
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
CARGO_TARGET_THUMBV7NEON_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
OPENSSL_LIB_DIR: /usr/lib/arm-linux-gnueabihf
OPENSSL_INCLUDE_DIR: /usr/include/openssl
PKG_CONFIG_ALLOW_CROSS: 1
PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig
RUST_BACKTRACE: full
run: |
cargo test --target ${{ matrix.target }} --tests -- --nocapture
- name: Test (other targets)
if: matrix.target != 'armv7-unknown-linux-gnueabihf' && matrix.target != 'thumbv7neon-unknown-linux-gnueabihf'
shell: bash
env:
RUST_BACKTRACE: full
run: |
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" && "${{ matrix.os }}" == "ubuntu-latest" ]]; then
echo "skip"
else
cargo test --target ${{ matrix.target }} --tests -- --nocapture
fi