Skip to content

Commit 1a65f1f

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 1a65f1f

File tree

1 file changed

+154
-0
lines changed

1 file changed

+154
-0
lines changed

.github/workflows/main.yml

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

0 commit comments

Comments
 (0)