finish #4
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: Test CI | |
on: [push, pull_request] | |
env: | |
qemu_version: 7.0.0 | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
components: rust-src, llvm-tools-preview | |
- name: Run unit tests | |
run: make unittest_no_fail_fast | |
app-test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
arch: [x86_64, riscv64, aarch64] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
components: rust-src, llvm-tools-preview | |
- uses: actions-rs/[email protected] | |
with: | |
crate: cargo-binutils | |
version: latest | |
use-tool-cache: true | |
- name: Download musl toolchain | |
run: | | |
if [ "${{ matrix.arch }}" = "x86_64" ]; then | |
export MUSL_PATH="x86_64-linux-musl-cross" | |
elif [ "${{ matrix.arch }}" = "aarch64" ]; then | |
export MUSL_PATH="aarch64-linux-musl-cross" | |
elif [ "${{ matrix.arch }}" = "riscv64" ]; then | |
export MUSL_PATH="riscv64-linux-musl-cross" | |
fi | |
wget https://musl.cc/$MUSL_PATH.tgz | |
tar -xf $MUSL_PATH.tgz | |
mv $MUSL_PATH musl | |
- name: Cache QEMU | |
id: cache-qemu | |
uses: actions/cache@v3 | |
with: | |
path: qemu-${{ env.qemu_version }} | |
key: qemu-${{ env.qemu_version }} | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y ninja-build | |
- name: Download and compile QEMU | |
if: steps.cache-qemu.outputs.cache-hit != 'true' | |
run: | | |
QEMU=qemu-${{ env.qemu_version }} | |
wget https://download.qemu.org/$QEMU.tar.xz \ | |
&& tar -xJf $QEMU.tar.xz \ | |
&& cd $QEMU \ | |
&& ./configure --target-list=x86_64-softmmu,riscv64-softmmu,aarch64-softmmu \ | |
&& make -j > /dev/null 2>&1 | |
- name: Install QEMU | |
run: | | |
cd qemu-${{ env.qemu_version }} && sudo make install | |
qemu-system-x86_64 --version | |
- name: Run app tests | |
run: | | |
export PATH=$PATH:$PWD/musl/bin | |
make disk_img | |
make test ARCH=${{ matrix.arch }} |