Skip to content

Commit 0078fcd

Browse files
committed
github: Add basic github CI tests
This builds libguestfs and runs the in-tree tests, ie. the basic './configure && make && make check'. We're using the "free for public repositories" plan. We run the tests on Ubuntu 22.04, 24.04, latest. Also on Fedora 42, 43 in a container (on the Ubuntu VM). The tests are run on pushes to the master branch, and on pull requests to the master branch. GObject is not built, since the tests fail and anyway there are some deep problems with the GObject bindings and they probably will be removed. Thanks: Stephen Gallagher, Cole Robinson
1 parent e7b36e0 commit 0078fcd

File tree

1 file changed

+162
-0
lines changed

1 file changed

+162
-0
lines changed

.github/workflows/main.yml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Run the jobs below on every push to master branch and pull request.
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
10+
# Runs basic configure, make and make check.
11+
jobs:
12+
ubuntu:
13+
name: Ubuntu
14+
runs-on: ubuntu-${{ matrix.release }}
15+
continue-on-error: true
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
release:
20+
- 24.04
21+
- latest
22+
23+
steps:
24+
- name: Identify the system
25+
run: |
26+
cat /etc/os-release
27+
28+
- name: Enable source repositories
29+
run: |
30+
sudo sed -i 's/Types: deb$/Types: deb deb-src/g' \
31+
/etc/apt/sources.list.d/ubuntu.sources
32+
33+
- name: Install build dependencies
34+
run: |
35+
sudo apt-get update
36+
sudo apt-get -y build-dep libguestfs
37+
38+
- name: Install extra dependencies
39+
run: |
40+
# Git is needed to run git submodule command.
41+
# json-c is missing from the Ubuntu package deps.
42+
sudo apt-get -y install git libjson-c-dev
43+
44+
- name: Fix broken Ubuntu kernel permissions
45+
run: |
46+
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725
47+
sudo chmod 0644 /boot/vmlinuz*
48+
49+
- name: Enable KVM
50+
run: |
51+
sudo chmod 0666 /dev/kvm
52+
53+
- name: Checkout sources
54+
uses: actions/checkout@v5
55+
56+
- name: Checkout submodule
57+
run: |
58+
git submodule update --init
59+
60+
- name: Compile the code
61+
run: |
62+
autoreconf -fiv
63+
./configure --disable-gobject
64+
make -j
65+
66+
- name: Run the quick test
67+
run: |
68+
make quickcheck
69+
70+
- name: Run the full tests
71+
run: |
72+
# grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh
73+
# doesn't exist. Please specify --target or --directory
74+
export SKIP_TEST_GRUB_INSTALL_0=1
75+
# Errors from hexdump, maybe not installed?
76+
export SKIP_TEST_HEXDUMP_0=1
77+
export SKIP_TEST_HEXDUMP_1=1
78+
export SKIP_TEST_HEXDUMP_2=1
79+
# error: luks_close: cryptsetup exited with status 5:
80+
# Device lukstest is still in use
81+
export SKIP_TEST_LUKS_SH=1
82+
# error: passt exited with status 1
83+
export SKIP_TEST_NETWORK_SH=1
84+
# error: passt exited with status 1
85+
export SKIP_TEST_RSYNC_SH=1
86+
if ! make check; then
87+
find -name test-suite.log -exec cat {} \;
88+
exit 1
89+
fi
90+
91+
fedora:
92+
name: Fedora
93+
runs-on: ubuntu-latest # VM where the container runs
94+
strategy:
95+
fail-fast: false
96+
matrix:
97+
release:
98+
- 42
99+
- 43
100+
101+
container:
102+
image: quay.io/fedora/fedora:${{ matrix.release }}
103+
options: --security-opt seccomp=unconfined
104+
105+
steps:
106+
- name: Identify the system
107+
run: |
108+
cat /etc/os-release
109+
110+
- name: Install build dependencies
111+
run: |
112+
dnf builddep -y libguestfs
113+
114+
- name: Install extra dependencies
115+
run: |
116+
# Git is needed to run git submodule command.
117+
# The others are needed to run the tests.
118+
dnf install -y git kernel sqlite perl-hivex rubygem-minitest
119+
120+
- name: Checkout sources
121+
uses: actions/checkout@v5
122+
123+
- name: Create user
124+
run: |
125+
useradd -m -s /bin/bash -G wheel guestfs
126+
tail /etc/passwd
127+
128+
- name: Make checkout directory editable by the sscg user
129+
run: |
130+
chown -R guestfs:wheel ${GITHUB_WORKSPACE}
131+
132+
- name: Checkout submodule
133+
run: |
134+
su -c 'git submodule update --init' guestfs
135+
136+
- name: Compile the code
137+
run: |
138+
su -c '
139+
autoreconf -fiv &&
140+
./configure CFLAGS="-fPIC -g -O2" --disable-gobject &&
141+
make -j
142+
' guestfs
143+
144+
- name: Run the quick test
145+
run: |
146+
su -c 'make quickcheck' guestfs
147+
148+
- name: Run the full tests
149+
run: |
150+
# error: passt exited with status 1
151+
export SKIP_TEST_NETWORK_SH=1
152+
# error: passt exited with status 1
153+
export SKIP_TEST_RSYNC_SH=1
154+
# error: internal_autosync: umount: /sysroot: umount: /sysroot:
155+
# target is busy
156+
export SKIP_RHBZ1011907_1165785_SH=1
157+
# We have to set $HOME since su -p won't set it below.
158+
export HOME=/home/guestfs
159+
if ! su -p -c 'make check' guestfs; then
160+
find -name test-suite.log -exec cat {} \;
161+
exit 1
162+
fi

0 commit comments

Comments
 (0)