Skip to content

Commit 380c4c5

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. 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. Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Adrian Reber <areber@redhat.com>
1 parent 0e403ad commit 380c4c5

File tree

4 files changed

+93
-49
lines changed

4 files changed

+93
-49
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=12 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: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,31 @@ 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+
# aarch64 is not supported by lima-vm/lima-actions
68+
# https://github.com/lima-vm/lima-actions/pull/1
69+
#needs: [alpine-test]
70+
runs-on: ubuntu-24.04
71+
timeout-minutes: 60
72+
strategy:
73+
matrix:
74+
version: [9, 10]
75+
steps:
76+
- uses: actions/checkout@v4
77+
- uses: ./.github/actions/lima-vm-setup
78+
with:
79+
template: centos-stream-${{ matrix.version }}
80+
cache-key-prefix: lima-centos-stream-${{ matrix.version }}
81+
- name: Setup VM
82+
run: lima sudo /home/criu/scripts/ci/lima.sh centos-stream-setup
83+
- name: Show VM info
84+
run: |
85+
lima uname -a
86+
lima cat /proc/cmdline
87+
- name: Run tests
88+
run: ssh -tt lima-default sudo -i /home/criu/scripts/ci/lima.sh centos-stream-test
89+
6590
compat-test:
6691
needs: [alpine-test]
6792
runs-on: ubuntu-22.04
@@ -138,21 +163,10 @@ jobs:
138163
timeout-minutes: 60
139164
steps:
140165
- 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
166+
- uses: ./.github/actions/lima-vm-setup
145167
with:
146-
path: ~/.cache/lima
147-
key: lima-fedora-${{ github.sha }}
148-
restore-keys: lima-fedora-
149-
- name: Start Fedora VM
150-
run: limactl start --plain --name=default --cpus=4 --memory=12 template://fedora
151-
- name: Copy source into VM
152-
run: |
153-
lima sudo mkdir -p /home/criu
154-
lima sudo chown "$(lima whoami)" /home/criu
155-
limactl copy -r . default:/home/criu
168+
template: fedora
169+
cache-key-prefix: lima-fedora
156170
- name: Setup VM
157171
run: lima sudo /home/criu/scripts/ci/lima.sh fedora-rawhide-setup
158172
- name: Reboot VM to activate new kernel

scripts/ci/lima.sh

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,47 @@
11
#!/bin/bash
22

3-
# This script runs inside a Lima Fedora VM to set up and run
4-
# the Fedora Rawhide based CI tests with a vanilla kernel.
5-
# It mirrors the logic from vagrant.sh's setup() and fedora-rawhide().
6-
#
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
77
# lima.sh fedora-rawhide-setup
88
# lima.sh fedora-rawhide-test
99

10-
1110
set -e
1211
set -x
1312

1413
CRIU_DIR="${CRIU_DIR:-/home/criu}"
1514

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+
# The rpc test cases are running as user #1000
28+
adduser -u 1000 test
29+
}
30+
31+
centos-stream-test() {
32+
# Increase the max thread limit for the thread-bomb test
33+
sysctl -w kernel.threads-max=100000
34+
35+
# Newer systemd versions limit the number of tasks per user via
36+
# cgroup pids controller. Remove the limit for the root user.
37+
systemctl set-property user-0.slice TasksMax=infinity
38+
39+
cd "${CRIU_DIR}"
40+
make -C scripts/ci local \
41+
SKIP_CI_PREP=1 CC=gcc CD_TO_TOP=1 \
42+
ZDTM_OPTS="-x zdtm/static/socket-raw"
43+
}
44+
1645
fedora-rawhide-setup() {
1746
# Disable sssd to avoid zdtm test failures in pty04 due to sssd socket
1847
systemctl mask sssd

0 commit comments

Comments
 (0)