CI: update per kernel tests #254
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: 'per x86_64 kernel integration test' | ||
on: | ||
schedule: | ||
# Run job once a week on saturday at 8:15 AM. | ||
- cron: '15 8 * * 6' | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ '**' ] | ||
jobs: | ||
build-initramfs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21 | ||
id: go | ||
- name: compile tests | ||
# bluebox works best with statically linked binaries. So we compile all the tests in this | ||
# code base into a statically linked executable. | ||
run: | | ||
go test -ldflags='-extldflags=-static' -trimpath -tags 'osusergo netgo static_build linux integration' -c | ||
- name: build initramfs | ||
# Install bluebox and generate a initramfs.cpio with the previously created statically linked | ||
# tests embedded. | ||
run: | | ||
go install github.com/florianl/bluebox@latest | ||
bluebox -e go-tc.test | ||
- name: upload initramfs for tests | ||
# Upload the generated initramfs.cpio and make it available for the parallel per-kernel tests. | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: initramfs | ||
path: | | ||
initramfs.cpio | ||
per-kernel-tests: | ||
needs: build-initramfs | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
kernel-version: ["4.9", "4.14", "4.19", "5.4", "5.10", "5.15", "6.1", "6.6"] | ||
steps: | ||
- name: install dependencies | ||
# Make sure required software packages are available. | ||
run: | | ||
sudo apt --yes update | ||
sudo apt --yes install --no-install-recommends qemu-system-x86 docker-buildx-plugin | ||
- name: get initramfs | ||
# Fetch the initramfs.cpio that was created in the previous step. | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: initramfs | ||
- name: fetch and unpack Linux kernel | ||
# Fetch the public kernel image that will be used in this test run. | ||
# Inspired by extract_oci_image from cilium/ebpf. | ||
run: | | ||
mkdir /tmp/ci-kernel | ||
echo "FROM ghcr.io/cilium/ci-kernels:${{ matrix.kernel-version }}" | docker buildx build --quiet --pull --output="/tmp/ci-kernel" - | ||
- name: run tests on kernel | ||
# Run the tests. | ||
run: | | ||
qemu-system-x86_64 -nographic -append "console=ttyS0" -m 2G -kernel /tmp/ci-kernel/boot/vmlinuz -initrd initramfs.cpio | tee log.txt | ||
grep PASS log.txt |