Skip to content

Commit 96c5957

Browse files
d-e-s-odanielocfb
authored andcommitted
Add aarch32 cross-compilation workflow
We don't really test on 32 bit systems. As a result we could experience unintentional breakages on certain targets. Add a CI workflow that build everything on aarch32. Ideally we'd do the same for x86 (i386/i686/whatever), but I haven't been able to set that up in reasonable effort. aarch32 actually seems to expose more mismatches than x86 and is a true superset [0] [1] [0]: https://github.com/danielocfb/libbpf-rs/actions/runs/5469860425/jobs/9959276295 [1]: #500 Signed-off-by: Daniel Müller <[email protected]>
1 parent 90a7000 commit 96c5957

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,36 @@ jobs:
134134
CARGO_BUILD_TARGET: aarch64-unknown-linux-gnu
135135
RUSTFLAGS: -C linker=/usr/bin/aarch64-linux-gnu-gcc
136136
run: cargo build --lib
137+
build-armhf:
138+
name: Build for aarch32
139+
runs-on: ubuntu-latest
140+
steps:
141+
- uses: actions/checkout@v3
142+
- name: Add apt sources for armhf
143+
run: |
144+
dpkg --add-architecture armhf
145+
release=$(. /etc/os-release && echo "$UBUNTU_CODENAME")
146+
sed -i 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list
147+
printf 'deb [arch=armhf] http://ports.ubuntu.com/ %s main restricted\n' \
148+
$release $release-updates $release-security \
149+
>> /etc/apt/sources.list
150+
shell: sudo sh -e {0}
151+
- uses: actions-rs/toolchain@v1
152+
with:
153+
profile: minimal
154+
toolchain: stable
155+
target: armv7-unknown-linux-gnueabihf
156+
override: true
157+
- name: Install deps
158+
run: |
159+
sudo apt-get update
160+
sudo apt-get install -y libelf-dev:armhf zlib1g-dev:armhf gcc-arm-linux-gnueabihf
161+
- uses: Swatinem/[email protected]
162+
- name: Build
163+
env:
164+
CARGO_BUILD_TARGET: armv7-unknown-linux-gnueabihf
165+
RUSTFLAGS: -C linker=/usr/bin/armhf-linux-gnu-gcc
166+
run: cargo build --lib
137167
clippy:
138168
name: Lint with clippy
139169
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)