ci: Test all architectures

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
pull/310/head
Dave Tucker 2 years ago
parent ef3b029d26
commit 1d06b41e57

@ -15,6 +15,13 @@ env:
jobs:
build:
strategy:
matrix:
arch:
- x86_64
- aarch64
- arm
- riscv64
runs-on: ubuntu-20.04
steps:
@ -28,7 +35,17 @@ jobs:
- uses: Swatinem/rust-cache@v1
- name: Build
run: cargo build --manifest-path bpf/Cargo.toml --verbose
env:
CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.arch }}
run: |
pushd bpf
cargo build --workspace --exclude aya-bpf-macros --verbose
popd
- name: Run tests
run: RUST_BACKTRACE=full cargo test --manifest-path bpf/Cargo.toml --verbose
env:
CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.arch }}
run: |
pushd bpf
cargo test --workspace --exclude aya-bpf-macros --verbose
popd

@ -15,16 +15,31 @@ env:
jobs:
build:
strategy:
matrix:
arch:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabi
- riscv64gc-unknown-none-elf
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1
- name: Prereqs
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build
run: cargo build --verbose
run: cross build --verbose
- name: Run tests
run: RUST_BACKTRACE=full cargo test --verbose
- name: Run test
run: RUST_BACKTRACE=full cross test --verbose
- name: Build bpf macros
run: cross build --manifest-path ./bpf/Cargo.toml -p aya-bpf-macros --verbose
- name: Test bpf macros
run: RUST_BACKTRACE=full cross test --manifest-path ./bpf/Cargo.toml -p aya-bpf-macros --verbose
test:
runs-on: ubuntu-20.04

@ -1,7 +1,9 @@
use std::env;
fn main() {
if env::var("CARGO_CFG_BPF_TARGET_ARCH").is_err() {
if let Ok(arch) = env::var("CARGO_CFG_BPF_TARGET_ARCH") {
println!("cargo:rustc-cfg=bpf_target_arch=\"{}\"", arch);
} else {
let arch = env::var("HOST").unwrap();
let arch = arch.split_once('-').map_or(&*arch, |x| x.0);
println!("cargo:rustc-cfg=bpf_target_arch=\"{}\"", arch);

@ -1,7 +1,9 @@
use std::env;
fn main() {
if env::var("CARGO_CFG_BPF_TARGET_ARCH").is_err() {
if let Ok(arch) = env::var("CARGO_CFG_BPF_TARGET_ARCH") {
println!("cargo:rustc-cfg=bpf_target_arch=\"{}\"", arch);
} else {
let arch = env::var("HOST").unwrap();
let arch = arch.split_once('-').map_or(&*arch, |x| x.0);
println!("cargo:rustc-cfg=bpf_target_arch=\"{}\"", arch);

@ -1,7 +1,9 @@
use std::env;
fn main() {
if env::var("CARGO_CFG_BPF_TARGET_ARCH").is_err() {
if let Ok(arch) = env::var("CARGO_CFG_BPF_TARGET_ARCH") {
println!("cargo:rustc-cfg=bpf_target_arch=\"{}\"", arch);
} else {
let arch = env::var("HOST").unwrap();
let arch = arch.split_once('-').map_or(&*arch, |x| x.0);
println!("cargo:rustc-cfg=bpf_target_arch=\"{}\"", arch);

Loading…
Cancel
Save