diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a763337d35..8ee1c4d184 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,40 +106,41 @@ jobs: working-directory: kernel strategy: matrix: - arch: ["x86_64", "aarch64"] - release-profile: ["--dev", "--release"] - demo: ["rusty_demo", "httpd", "httpd-rtl8139", "testudp", "microvm"] + arch: [x86_64, aarch64] + profile: [dev, release] + package: [rusty_demo, httpd, testudp, hello_world] + netdev: [virtio-net-pci, rtl8139] include: - - arch: "x86_64" - packages: "qemu-system-x86 libcap-ng-dev libseccomp-dev socat" - - arch: "aarch64" - packages: "qemu-system-aarch64" + - arch: x86_64 + packages: qemu-system-x86 libcap-ng-dev libseccomp-dev socat + - arch: aarch64 + packages: qemu-system-aarch64 - # Demos that do not share a name with the corresponding package - - demo: "httpd-rtl8139" - package: "httpd" - - demo: "microvm" - package: "hello_world" - - - arch: "x86_64" - demo: "rusty_demo" - flags: "--features pci-ids --virtiofsd" - - arch: "aarch64" - demo: "rusty_demo" - flags: "--features pci-ids" - - demo: "httpd" - flags: "--features ci,dhcpv4 --netdev virtio-net-pci" - - demo: "httpd-rtl8139" - flags: "--features ci,dhcpv4,rtl8139 --netdev rtl8139" - - demo: "microvm" - flags: "--no-default-features --microvm" - - demo: "testudp" - flags: "--features udp,dhcpv4 --netdev virtio-net-pci" + - arch: x86_64 + package: rusty_demo + flags: --features pci-ids --virtiofsd + - arch: aarch64 + package: rusty_demo + flags: --features pci-ids + - package: httpd + flags: --features ci,dhcpv4 + - package: testudp + flags: --features udp,dhcpv4 + - package: hello_world + flags: --no-default-features --microvm exclude: - - arch: "aarch64" - demo: "httpd-rtl8139" - - arch: "aarch64" - demo: "microvm" + # rtl8139 does not build on aarch64 + - arch: aarch64 + netdev: rtl8139 + # microvm (Firecracker) test does not run on aarch64 + - package: hello_world + arch: aarch64 + # The rusty_demo and microvm tests ignore the netdev, so we exclude all but one netdev to prevent redundant jobs. + # We choose rtl8139 to not build an unnecessary feature into the build + - package: hello_world + netdev: rtl8139 + - package: rusty_demo + netdev: rtl8139 steps: - name: Checkout hermit-rs @@ -176,8 +177,17 @@ jobs: if: ${{ matrix.arch == 'x86_64' && matrix.demo == 'rusty_demo' }} run: cargo install virtiofsd - name: Run VM - # The package name is the same as the demo name if not explicitly specified - run: cargo xtask ci qemu --arch ${{ matrix.arch }} --package ${{ matrix.package || matrix.demo }} ${{ matrix.flags }} + # cargo accepts multiple 'features' flags + # The '… && … || …' expression is like a ternary operator + # netdev is only relevant for tests that use network functionality (and are thus built with dhcpv4) + run: > + cargo xtask ci qemu + --arch ${{ matrix.arch }} + --package ${{ matrix.package }} + ${{ matrix.flags }} + ${{ matrix.netdev == 'rtl8139' && '--features rtl8139' || '' }} + ${{ contains(matrix.flags, 'dhcpv4') && format('--netdev {0}', matrix.netdev) || '' }} + --${{ matrix.profile }} run-x86_64-kvm: name: Run Hermit for Rust (x86_64 + kvm)