Build and test for RISC-V #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build and test on armv7, aarch64, and riscv64 with QEMU | |
on: [push, pull_request] | |
jobs: | |
test-on-ubuntu-latest-with-qemu: | |
strategy: | |
matrix: | |
# only test specific parameter pairs, not the cross product | |
include: | |
- target: "armv7-unknown-linux-gnueabihf" | |
linker: "arm-linux-gnueabihf-gcc" | |
interpreter: "qemu-arm" | |
packages: "g++-arm-linux-gnueabihf libc6-dev-armhf-cross" | |
- target: "aarch64-unknown-linux-gnu" | |
linker: "aarch64-linux-gnu-gcc" | |
interpreter: "qemu-aarch64" | |
packages: "g++-aarch64-linux-gnu libc6-dev-arm64-cross" | |
# NOTE: This appears to work for Ubuntu 22.04 and other systems | |
# with a recent version of GNU ld (e.g. 2.38) whereas Ubuntu 20.04 | |
# fails with the following linker error: unsupported ISA subset `z' | |
- target: "riscv64gc-unknown-linux-gnu" | |
linker: "riscv64-linux-gnu-gcc" | |
interpreter: "qemu-riscv64" | |
packages: "g++-riscv64-linux-gnu libc6-dev-riscv64-cross" | |
runs-on: ubuntu-latest | |
name: test on ${{ matrix.target }} | |
steps: | |
- name: install prerequisites | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: ${{ matrix.packages }} binfmt-support qemu-user-static meson nasm | |
version: 1.0 # version of cache to load | |
# since binfmt-support was likely cached from previous run, we need to | |
# re-run the post installation step from that package to register | |
# qemu-arm, qemu-aarch64, etc. as an interpreter for the cross compiled | |
# binaries. | |
- name: register ${{ matrix.interpreter }} as interpreter | |
run: | | |
sudo update-binfmts --import | |
sudo update-binfmts --enable ${{ matrix.interpreter }} | |
update-binfmts --display | |
- name: git checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: cache rust dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ matrix.target }}-cargo-and-target-${{ hashFiles('**/Cargo.lock') }} | |
- name: cargo build for ${{ matrix.target }} | |
run: | | |
rustup target add ${{ matrix.target }} | |
RUSTFLAGS="-C target-feature=+crt-static -C linker=${{ matrix.linker }}" \ | |
cargo build --release --target ${{ matrix.target }} | |
- name: run tests | |
run: | | |
.github/workflows/test.sh -t 2 \ | |
-r target/${{ matrix.target }}/release/dav1d \ | |
-s target/${{ matrix.target }}/release/seek_stress | |
- name: upload build artifacts | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: meson-test-logs-${{ matrix.target }} | |
path: | | |
${{ github.workspace }}/build/meson-logs/testlog.txt |