Skip to content

Commit d7a9f45

Browse files
committed
ci: port CentOS Stream test to GitHub Actions using Lima
Move the CentOS Stream 9 based test from Cirrus CI to GitHub Actions using Lima VMs. Expand coverage to a matrix of CentOS Stream 9 and 10 on x86_64. Consolidate lima-fedora-rawhide.sh and the new CentOS Stream logic into a single scripts/ci/lima.sh with distinct function names (fedora-rawhide-setup/test, centos-stream-setup/test). Extract the common Lima VM setup steps (Lima install, image caching, KVM enablement, VM start, source copy) into a reusable composite action at .github/actions/lima-vm-setup. Generated with Claude Code (https://claude.ai/code) Signed-off-by: Adrian Reber <areber@redhat.com>
1 parent 4608bc4 commit d7a9f45

File tree

5 files changed

+114
-88
lines changed

5 files changed

+114
-88
lines changed

.cirrus.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,6 @@ task:
1818
build_script: |
1919
make -C scripts/ci vagrant-fedora-no-vdso
2020
21-
task:
22-
name: CentOS Stream 9 based test
23-
environment:
24-
HOME: "/root"
25-
CIRRUS_WORKING_DIR: "/tmp/criu"
26-
27-
compute_engine_instance:
28-
image_project: centos-cloud
29-
image: family/centos-stream-9
30-
platform: linux
31-
cpu: 4
32-
memory: 8G
33-
34-
setup_script: |
35-
dnf config-manager --set-enabled crb # Same as CentOS 8 powertools
36-
dnf -y install epel-release epel-next-release
37-
contrib/dependencies/dnf-packages.sh
38-
# The image has a too old version of nettle which does not work with gnutls.
39-
# Just upgrade to the latest to make the error go away.
40-
dnf -y upgrade nettle nettle-devel
41-
systemctl stop sssd
42-
# Even with selinux in permissive mode the selinux tests will be executed.
43-
# The Cirrus CI user runs as a service from selinux point of view and is
44-
# much more restricted than a normal shell (system_u:system_r:unconfined_service_t:s0).
45-
# The test case above (vagrant-fedora-no-vdso) should run selinux tests in enforcing mode.
46-
setenforce 0
47-
48-
build_script: |
49-
make -C scripts/ci local SKIP_CI_PREP=1 CC=gcc CD_TO_TOP=1 ZDTM_OPTS="-x zdtm/static/socket-raw"
50-
5121
task:
5222
name: Vagrant Fedora based test (non-root)
5323
environment:
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Lima VM Setup'
2+
description: 'Install Lima, enable KVM, start a VM and copy the CRIU source into it'
3+
4+
inputs:
5+
template:
6+
description: 'Lima VM template name (e.g. fedora, centos-stream-9)'
7+
required: true
8+
cache-key-prefix:
9+
description: 'Prefix for the Lima image cache key'
10+
required: true
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Install Lima
16+
uses: lima-vm/lima-actions/setup@v1
17+
- name: Cache Lima images
18+
uses: actions/cache@v4
19+
with:
20+
path: ~/.cache/lima
21+
key: ${{ inputs.cache-key-prefix }}-${{ github.sha }}
22+
restore-keys: ${{ inputs.cache-key-prefix }}-
23+
- name: Start VM
24+
shell: bash
25+
run: limactl start --plain --name=default --cpus=4 --memory=4 template://${{ inputs.template }}
26+
- name: Copy source into VM
27+
shell: bash
28+
run: |
29+
lima sudo mkdir -p /home/criu
30+
lima sudo chown "$(lima whoami)" /home/criu
31+
limactl copy -r . default:/home/criu

.github/workflows/ci.yml

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,25 @@ jobs:
6262
- name: Run Arch Linux Test
6363
run: sudo -E make -C scripts/ci archlinux
6464

65+
centos-stream-test:
66+
name: CentOS Stream ${{ matrix.version }}
67+
#needs: [alpine-test]
68+
runs-on: ubuntu-24.04
69+
timeout-minutes: 60
70+
strategy:
71+
matrix:
72+
version: [9, 10]
73+
steps:
74+
- uses: actions/checkout@v4
75+
- uses: ./.github/actions/lima-vm-setup
76+
with:
77+
template: centos-stream-${{ matrix.version }}
78+
cache-key-prefix: lima-centos-stream-${{ matrix.version }}
79+
- name: Setup VM
80+
run: lima sudo /home/criu/scripts/ci/lima.sh centos-stream-setup
81+
- name: Run tests
82+
run: ssh -tt lima-default sudo -i /home/criu/scripts/ci/lima.sh centos-stream-test
83+
6584
compat-test:
6685
needs: [alpine-test]
6786
runs-on: ubuntu-22.04
@@ -138,30 +157,12 @@ jobs:
138157
timeout-minutes: 60
139158
steps:
140159
- uses: actions/checkout@v4
141-
- name: Install Lima
142-
uses: lima-vm/lima-actions/setup@v1
143-
- name: Cache Lima images
144-
uses: actions/cache@v4
160+
- uses: ./.github/actions/lima-vm-setup
145161
with:
146-
path: ~/.cache/lima
147-
key: lima-fedora-${{ github.sha }}
148-
restore-keys: lima-fedora-
149-
- name: Enable KVM
150-
run: |
151-
sudo apt-get -y install qemu-system-x86
152-
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
153-
| sudo tee /etc/udev/rules.d/99-kvm.rules
154-
sudo udevadm control --reload-rules
155-
sudo udevadm trigger --name-match=kvm
156-
- name: Start Fedora VM
157-
run: limactl start --plain --name=default --cpus=4 --memory=4 template://fedora
158-
- name: Copy source into VM
159-
run: |
160-
lima sudo mkdir -p /home/criu
161-
lima sudo chown "$(lima whoami)" /home/criu
162-
limactl copy -r . default:/home/criu
162+
template: fedora
163+
cache-key-prefix: lima-fedora
163164
- name: Setup VM
164-
run: lima sudo /home/criu/scripts/ci/lima-fedora-rawhide.sh setup
165+
run: lima sudo /home/criu/scripts/ci/lima.sh fedora-rawhide-setup
165166
- name: Reboot VM to activate new kernel
166167
run: |
167168
limactl stop default
@@ -171,7 +172,7 @@ jobs:
171172
lima uname -a
172173
lima cat /proc/cmdline
173174
- name: Run tests
174-
run: ssh -tt lima-default sudo -i /home/criu/scripts/ci/lima-fedora-rawhide.sh test
175+
run: ssh -tt lima-default sudo -i /home/criu/scripts/ci/lima.sh fedora-rawhide-test
175176

176177
gcov-test:
177178
needs: [alpine-test]

scripts/ci/lima-fedora-rawhide.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

scripts/ci/lima.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
# This script runs inside Lima VMs to set up and run CI tests.
4+
# It is invoked with a command name, e.g.:
5+
# lima.sh centos-stream-setup
6+
# lima.sh centos-stream-test
7+
# lima.sh fedora-rawhide-setup
8+
# lima.sh fedora-rawhide-test
9+
10+
set -e
11+
set -x
12+
13+
CRIU_DIR="${CRIU_DIR:-/home/criu}"
14+
15+
centos-stream-setup() {
16+
# Enable CRB repository
17+
dnf config-manager --set-enabled crb
18+
# Install EPEL
19+
dnf -y install epel-release
20+
# Install build/test dependencies
21+
"${CRIU_DIR}"/contrib/dependencies/dnf-packages.sh
22+
# Disable sssd to avoid zdtm test failures in pty04
23+
systemctl stop sssd || true
24+
# Set SELinux to permissive mode; selinux tests still run but
25+
# are not blocked by the restricted service context of CI.
26+
setenforce 0
27+
}
28+
29+
centos-stream-test() {
30+
cd "${CRIU_DIR}"
31+
make -C scripts/ci local \
32+
SKIP_CI_PREP=1 CC=gcc CD_TO_TOP=1 \
33+
ZDTM_OPTS="-x zdtm/static/socket-raw"
34+
}
35+
36+
fedora-rawhide-setup() {
37+
# Disable sssd to avoid zdtm test failures in pty04 due to sssd socket
38+
systemctl mask sssd
39+
40+
# Upgrade the kernel to the latest vanilla one
41+
dnf -y copr enable @kernel-vanilla/stable
42+
# The shellcheck tool misunderstands the "do" to be from a loop
43+
# shellcheck disable=SC1010
44+
dnf -y do --action=upgrade \* --action=install make podman
45+
}
46+
47+
fedora-rawhide-test() {
48+
# Some tests in the container need selinux to be disabled.
49+
# In the container it is not possible to change the state of selinux.
50+
# Let's just disable it for this test run completely.
51+
setenforce Permissive
52+
53+
cd "${CRIU_DIR}"
54+
make -C scripts/ci fedora-rawhide \
55+
CONTAINER_RUNTIME=podman \
56+
BUILD_OPTIONS="--security-opt seccomp=unconfined"
57+
}
58+
59+
"$@"

0 commit comments

Comments
 (0)