name: CI
on:
pull_request:
push:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
checks:
name: checks
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt -- --check
- run: cargo clippy --all-targets -- -D warnings
- run: cargo build --release
vm-tests-matrix:
name: vm-tests (${{ matrix.image }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
image: [trixie, focal]
steps:
- uses: actions/checkout@v4
- name: Enable KVM for the runner user
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Install QEMU and ISO tooling
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq qemu-system-x86 qemu-utils genisoimage
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Cache cloud base image
uses: actions/cache@v4
with:
path: ~/.cache/timberfs-vm-tests
key: vm-base-${{ matrix.image }}
- uses: taiki-e/install-action@v2
with:
tool: cargo-deb,cargo-zigbuild
- name: Install zig (cargo-zigbuild's cross linker)
run: |
curl -fL --retry 3 \
https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz \
| tar -xJ -C "$RUNNER_TEMP"
echo "$RUNNER_TEMP/zig-linux-x86_64-0.13.0" >> "$GITHUB_PATH"
- name: Build the compat .deb
run: |
cargo zigbuild --release --target x86_64-unknown-linux-gnu.2.31
cargo deb --variant compat --no-build --target x86_64-unknown-linux-gnu
- name: Run the VM package test suite
env:
TIMBERFS_VM_IMAGE: ${{ matrix.image }}
run: tests/vm/run-vm-test.sh target/x86_64-unknown-linux-gnu/debian/timberfs_*_amd64.deb
vm-tests:
needs: vm-tests-matrix
if: always()
runs-on: ubuntu-latest
steps:
- name: Gate on the matrix result
run: |
if [ "${{ needs.vm-tests-matrix.result }}" != "success" ]; then
echo "a vm-tests matrix leg did not succeed: ${{ needs.vm-tests-matrix.result }}" >&2
exit 1
fi