-
Notifications
You must be signed in to change notification settings - Fork 48
107 lines (94 loc) · 4.08 KB
/
integration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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", "arm64"]
kernel-version: ["6.8", "6.9", "6.10", "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/amd64/${{ matrix.kernel-version }}/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/arm64/${{ matrix.kernel-version }}/vmlinuz -initrd initramfs.cpio | tee log.txt
grep PASS log.txt