Prep for DriverKit #361
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 | |
on: | |
push: | |
branches: [ main, next, staging ] | |
pull_request: | |
branches: [ main, next ] | |
jobs: | |
sanity: | |
name: "basic sanity build" | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: checkout libnvme | |
uses: actions/checkout@v4 | |
with: | |
repository: linux-nvme/libnvme | |
path: libnvme | |
ref: v1.4 | |
- name: install build dependencies | |
run: sudo pip install meson ninja sphinx sphinx-rtd-theme | |
- name: compile and install libnvme | |
run: | | |
cd libnvme | |
make | |
sudo make install | |
- name: configure build | |
run: meson setup build | |
- name: compile | |
run: meson compile -C build | |
- name: unit tests | |
run: | | |
meson test -C build libvfn: | |
- name: configure release build | |
run: meson setup --reconfigure build --buildtype=release | |
- name: compile | |
run: meson compile -C build | |
- name: unit tests | |
run: | | |
meson test -C build libvfn: | |
sparse: | |
name: "run sparse" | |
needs: [sanity] | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: install build dependencies | |
run: sudo pip install meson ninja | |
- name: install sparse | |
run: sudo apt-get -y install sparse | |
- name: configure build | |
run: meson setup build | |
- name: run sparse | |
run: meson compile -C build sparse | |
scan-build: | |
name: "run scan-build" | |
needs: [sanity] | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: install build dependencies | |
run: sudo pip install meson ninja | |
- name: install scan-build | |
run: sudo apt-get -y install clang-tools | |
- name: configure build | |
run: meson setup build | |
- name: run scan-build | |
run: scan-build -o /tmp/scan-build-report --status-bugs ninja -C build | |
- name: grab bug report | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: scan-build-report | |
path: /tmp/scan-build-report/* | |
cc-builds: | |
name: "compiler builds" | |
needs: [sanity] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [gcc, clang] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: install build dependencies | |
run: sudo pip install meson ninja | |
- name: configure build | |
run: CC=${{ matrix.compiler }} meson setup build -Dlibnvme=disabled | |
- name: compile | |
run: meson compile -C build | |
dist-builds: | |
name: "distribution builds" | |
needs: [sanity] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
container: | |
- {os: 'almalinux', ver: '8'} | |
- {os: 'almalinux', ver: '9'} | |
- {os: 'alpine', ver: 'latest'} | |
- {os: 'archlinux', ver: 'latest'} | |
- {os: 'debian', ver: 'trixie'} | |
- {os: 'debian', ver: 'bookworm'} | |
- {os: 'debian', ver: 'bullseye'} | |
- {os: 'debian', ver: 'buster'} | |
- {os: 'fedora', ver: 'rawhide'} | |
- {os: 'fedora', ver: '38'} | |
- {os: 'fedora', ver: '37'} | |
- {os: 'rockylinux', ver: '8'} | |
- {os: 'rockylinux', ver: '9'} | |
- {os: 'ubuntu', ver: 'mantic'} | |
- {os: 'ubuntu', ver: 'lunar'} | |
- {os: 'ubuntu', ver: 'jammy'} | |
- {os: 'ubuntu', ver: 'focal'} | |
container: | |
image: ${{ matrix.container.os }}:${{ matrix.container.ver }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: install dependencies | |
env: | |
SETUP_SCRIPT: .github/scripts/build/${{ matrix.container.os}}-setup-${{ matrix.container.ver }}.sh | |
run: ${SETUP_SCRIPT} | |
- name: configure build | |
run: meson setup build -Dlibnvme=disabled | |
- name: compile | |
run: ninja -C build | |
- name: upload log | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: meson log | |
path: build/meson-logs/meson-log.txt | |
- name: unit tests | |
run: meson test -C build "libvfn:" | |
- name: upload log | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: meson test log | |
path: build/meson-logs/testlog.txt | |
nix-tests: | |
name: "nix build" | |
needs: [sanity] | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: install nix | |
uses: DeterminateSystems/nix-installer-action@main | |
- name: init cache | |
uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: build package | |
run: nix build . | |
device-test: | |
name: "run emulated nvme device tests" | |
needs: [sanity] | |
strategy: | |
max-parallel: 1 | |
fail-fast: false | |
matrix: | |
machine: | |
- {os: "fedora", image: "38", kernel: "default"} | |
- {os: "fedora", image: "rawhide", kernel: "iommufd"} | |
runs-on: [self-hosted, kvm] | |
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || ((github.event_name == 'pull_request') && contains(github.event.pull_request.labels.*.name, 'approved')) | |
env: | |
VMCTL_VMROOT: "/scratch/ghr/guests" | |
KERNEL_DIR: "/scratch/ghr/src/linux" | |
GUEST_BOOT: "img/fedora-${{ matrix.machine.image }}.qcow2" | |
VMCONFIG: ".github/vmconfig/nvme.conf" | |
QEMU_SYSTEM_BINARY: "/usr/bin/qemu-system-x86_64" | |
NVME_PCI_DEV: "0000:00:03.0" | |
steps: | |
- name: checkout libvfn | |
uses: actions/checkout@v4 | |
- name: create dist package | |
run: | | |
meson setup build | |
meson dist -C build --no-tests | |
- name: reset vm | |
run: | | |
vmctl -c "$VMCONFIG" kill || true | |
- name: launch vm | |
if: matrix.machine.kernel == 'default' | |
run: | | |
vmctl -c "$VMCONFIG" run --background | |
vmctl -c "$VMCONFIG" ssh -w -- echo vm is up | |
- name: launch vm (custom kernel) | |
if: matrix.machine.kernel == 'iommufd' | |
run: | | |
vmctl -c "$VMCONFIG" run -k "$KERNEL_DIR" --background | |
vmctl -c "$VMCONFIG" ssh -w -- echo vm is up | |
- name: copy source | |
run: | | |
eval $(vmctl -c "$VMCONFIG" vars | grep -E '^GUEST_SSH_PORT=') | |
scp -P "$GUEST_SSH_PORT" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null build/meson-dist/libvfn-*.tar.xz root@localhost: | |
- name: build | |
run: | | |
vmctl -c "$VMCONFIG" ssh -- -T <<EOF | |
mkdir libvfn | |
tar -Jxf libvfn-*.tar.xz -C libvfn --strip 1 | |
cd libvfn | |
meson setup build | |
ninja -C build | |
EOF | |
- name: setup device | |
run: | | |
vmctl -c "$VMCONFIG" ssh -- -T <<EOF | |
modprobe vfio-pci | |
cd libvfn | |
./build/tools/vfntool/vfntool -v -d "$NVME_PCI_DEV" | |
EOF | |
- name: run tests | |
run: | | |
vmctl -c "$VMCONFIG" ssh -- -T <<EOF | |
cd libvfn | |
meson test -C build libvfn: --suite device --test-args "-d \"${NVME_PCI_DEV}\" -N 1" | |
EOF | |
- name: shutdown vm | |
if: always() | |
run: vmctl -c "$VMCONFIG" kill |