per x86_64 kernel integration test #385
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: [ '**' ] | |
# Set default permissions as read only. | |
permissions: read-all | |
jobs: | |
build-initramfs: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target_arch: ["amd64", "arm64"] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23 | |
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: | | |
GOARCH=${{ matrix.target_arch }} 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 -a=${{ matrix.target_arch }} -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-${{ matrix.target_arch }} | |
path: | | |
initramfs.cpio | |
per-kernel-tests: | |
needs: build-initramfs | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target_arch: ["amd64"] | |
kernel-version: ["4.9", "4.14", "4.19", "5.4", "5.10", "5.15", "6.1", "6.6", "6.7", "6.8", "6.9", "6.10", "6.11"] | |
include: | |
- target_arch: "arm64" | |
kernel-version: "6.6" | |
- target_arch: "arm64" | |
kernel-version: "6.7" | |
- target_arch: "arm64" | |
kernel-version: "6.9" | |
- target_arch: "arm64" | |
kernel-version: "6.11" | |
steps: | |
- name: add Docker repo | |
run: | | |
# From https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository | |
# Add Docker's official GPG key: | |
sudo apt-get update | |
sudo apt-get install ca-certificates curl | |
sudo install -m 0755 -d /etc/apt/keyrings | |
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | |
sudo chmod a+r /etc/apt/keyrings/docker.asc | |
# Add the repository to Apt sources: | |
echo \ | |
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | |
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ | |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update | |
- name: install dependencies | |
# Make sure required software packages are available. | |
run: | | |
sudo apt --yes update | |
sudo apt --yes install --no-install-recommends qemu-system-aarch64 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-${{ matrix.target_arch }} | |
- 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 --platform linux/${{ matrix.target_arch }} --quiet --pull --output="/tmp/ci-kernel/${{ matrix.target_arch }}/${{ matrix.kernel-version }}/" - | |
- name: run tests on kernel x86 | |
if: matrix.target_arch == 'amd64' | |
# Run the tests. | |
run: | | |
qemu-system-x86_64 -nographic -append "console=ttyS0" -m 2G -kernel /tmp/ci-kernel/${{ matrix.target_arch }}/${{ matrix.kernel-version }}/boot/vmlinuz -initrd initramfs.cpio | tee log.txt | |
grep PASS log.txt | |
- name: run tests on kernel arm64 | |
if: matrix.target_arch == 'arm64' | |
# Run the tests. | |
run: | | |
qemu-system-aarch64 -nographic -append "console=ttyAMA0" -M virt -cpu cortex-a57 -m 4G -kernel /tmp/ci-kernel/${{ matrix.target_arch }}/${{ matrix.kernel-version }}/boot/vmlinuz -initrd initramfs.cpio | tee log.txt | |
grep PASS log.txt |