Skip to content

Commit a16af1d

Browse files
committed
Run Fedora tests with Github container actions
This ends up reducing the CI runtime from over 20 minutes down to just under 10 minutes. Signed-off-by: Stephen Gallagher <[email protected]>
1 parent ce52b53 commit a16af1d

File tree

2 files changed

+200
-28
lines changed

2 files changed

+200
-28
lines changed

.github/workflows/ci.yaml

Lines changed: 200 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,221 @@ name: Continuous Integration
33
on: [push, pull_request]
44

55
jobs:
6-
stable_tests:
7-
name: Operating Systems (Stable)
8-
runs-on: ubuntu-20.04
6+
get_fedora_releases:
7+
name: Get Fedora Releases
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Query Fedora
11+
id: releases
12+
uses: sgallagher/get-fedora-releases-action@v1
13+
outputs:
14+
stable: ${{ steps.releases.outputs.stable }}
15+
development: ${{ steps.releases.outputs.development }}
16+
17+
unit_tests_fedora_stable:
18+
name: Unit Tests (Stable Fedora)
19+
needs: get_fedora_releases
20+
runs-on: ubuntu-latest
21+
continue-on-error: false
22+
strategy:
23+
matrix:
24+
release: ${{ fromJson(needs.get_fedora_releases.outputs.stable) }}
25+
container:
26+
image: quay.io/fedora/fedora:${{ matrix.release }}-x86_64
27+
28+
outputs:
29+
meson_version: ${{ steps.scanbuild.outputs.available }}
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v2
34+
35+
- name: Install dependencies
36+
run: $GITHUB_WORKSPACE/.ci/fedora/get_fedora_deps.sh
37+
38+
- name: Determine if we can run scan-build
39+
id: scanbuild
40+
run: echo "::set-output name=available::echo $(rpmdev-vercmp $(meson --version) 0.49.0 > /dev/null; if [ $? == 12 ];then echo false; else echo true; fi )"
41+
42+
43+
- name: Set up the build directory
44+
run: meson setup --buildtype=debugoptimized ci $GITHUB_WORKSPACE
45+
46+
- name: Compile the code
47+
run: ninja -C ci
48+
49+
- name: Run CI tests
50+
run: meson test -C ci --suite ci --print-errorlogs -t 5
51+
52+
- name: Run valgrind tests
53+
run:
54+
meson test -C ci --suite ci_valgrind --print-errorlogs -t 10
55+
--wrap=$GITHUB_WORKSPACE/contrib/valgrind/valgrind_wrapper.sh
56+
57+
- name: Run clang static analysis tests
58+
if: ${{ steps.scanbuild.outputs.available }}
59+
run: |
60+
meson setup --buildtype=debug -Dskip_introspection=true ci_scanbuild
61+
ninja -C ci_scanbuild scan-build; if [ $? -ne 0 ]; then elinks -dump ci_scanbuild/meson-logs/scanbuild/*/index.html; fi
62+
63+
64+
rpm_tests:
65+
name: Installed RPM Tests (Stable Fedora)
66+
needs: get_fedora_releases
67+
runs-on: ubuntu-latest
968
continue-on-error: false
1069
strategy:
1170
matrix:
12-
distro:
13-
- Fedora 32
14-
- Fedora 33
15-
- CentOS 7
16-
- CentOS 8
71+
arch:
72+
- x86_64
73+
release: ${{ fromJson(needs.get_fedora_releases.outputs.stable) }}
74+
container:
75+
image: quay.io/fedora/fedora:${{ matrix.release }}-x86_64
1776

1877
steps:
78+
- name: Install git
79+
run: dnf -y install git-core
80+
1981
- name: Checkout code
2082
uses: actions/checkout@v2
2183

22-
- name: Run tests
23-
env:
24-
DISTRO: ${{ matrix.distro }}
84+
- name: Install dependencies
85+
run: $GITHUB_WORKSPACE/.ci/fedora/get_fedora_deps.sh
86+
87+
- name: Set up the RPM output directory
88+
run: mkdir -p $GITHUB_WORKSPACE/rpmbuild/RPMS
89+
90+
- name: Build the RPM repository
91+
working-directory: ${{github.workspace}}/rpmbuild/RPMS
2592
run: |
26-
./.ci/ci-launcher.sh
27-
experimental_tests:
28-
name: Operating Systems (Experimental)
29-
runs-on: ubuntu-20.04
93+
packit --debug local-build ../..
94+
createrepo_c x86_64
95+
96+
- name: Install the packages
97+
working-directory: ${{github.workspace}}/rpmbuild/RPMS
98+
run:
99+
$GITHUB_WORKSPACE/.ci/retry-command.sh
100+
dnf -y install --nogpgcheck
101+
--allowerasing
102+
--repofrompath libmodulemd-ci,x86_64
103+
x86_64/python3-libmodulemd*.rpm
104+
x86_64/libmodulemd-devel*.rpm
105+
106+
- name: Set up the build directory
107+
run:
108+
meson --buildtype=release -Dtest_installed_lib=true
109+
installed_lib_tests $GITHUB_WORKSPACE
110+
111+
- name: Compile the code
112+
run: ninja -C installed_lib_tests
113+
114+
- name: Run tests on the installed RPMs
115+
run:
116+
meson test --suite ci
117+
-C installed_lib_tests
118+
--print-errorlogs
119+
-t 5
120+
121+
unit_tests_fedora_devel:
122+
name: Unit Tests (Devel Fedora)
123+
needs: get_fedora_releases
124+
runs-on: ubuntu-latest
30125
continue-on-error: true
31126
strategy:
32127
matrix:
33-
distro:
34-
- Fedora rawhide
35-
- Archlinux
36-
- Mageia 7
37-
# Disabled for now, since it's broken
38-
#- OpenMandriva cooker
39-
- openSUSE tumbleweed
128+
release: ${{ fromJson(needs.get_fedora_releases.outputs.development) }}
129+
container:
130+
image: quay.io/fedora/fedora:${{ matrix.release }}-x86_64
131+
132+
outputs:
133+
meson_version: ${{ steps.scanbuild.outputs.available }}
40134

41135
steps:
42136
- name: Checkout code
43137
uses: actions/checkout@v2
44138

45-
- name: Run tests
46-
env:
47-
DISTRO: ${{ matrix.distro }}
139+
- name: Install dependencies
140+
run: $GITHUB_WORKSPACE/.ci/fedora/get_fedora_deps.sh
141+
142+
- name: Determine if we can run scan-build
143+
id: scanbuild
144+
run: echo "::set-output name=available::echo $(rpmdev-vercmp $(meson --version) 0.49.0 > /dev/null; if [ $? == 12 ];then echo false; else echo true; fi )"
145+
146+
147+
- name: Set up the build directory
148+
run: meson setup --buildtype=debugoptimized ci $GITHUB_WORKSPACE
149+
150+
- name: Compile the code
151+
run: ninja -C ci
152+
153+
- name: Run CI tests
154+
run: meson test -C ci --suite ci --print-errorlogs -t 5
155+
156+
- name: Run valgrind tests
157+
run:
158+
meson test -C ci --suite ci_valgrind --print-errorlogs -t 10
159+
--wrap=$GITHUB_WORKSPACE/contrib/valgrind/valgrind_wrapper.sh
160+
161+
- name: Run clang static analysis tests
162+
if: ${{ steps.scanbuild.outputs.available }}
48163
run: |
49-
./.ci/ci-launcher.sh
164+
meson setup --buildtype=debug -Dskip_introspection=true ci_scanbuild
165+
ninja -C ci_scanbuild scan-build; if [ $? -ne 0 ]; then elinks -dump ci_scanbuild/meson-logs/scanbuild/*/index.html; fi
166+
167+
168+
rpm_tests_devel:
169+
name: Installed RPM Tests (Devel Fedora)
170+
needs: get_fedora_releases
171+
runs-on: ubuntu-latest
172+
continue-on-error: true
173+
strategy:
174+
matrix:
175+
arch:
176+
- x86_64
177+
release: ${{ fromJson(needs.get_fedora_releases.outputs.development) }}
178+
container:
179+
image: quay.io/fedora/fedora:${{ matrix.release }}-x86_64
180+
181+
steps:
182+
- name: Install git
183+
run: dnf -y install git-core
184+
185+
- name: Checkout code
186+
uses: actions/checkout@v2
187+
188+
- name: Install dependencies
189+
run: $GITHUB_WORKSPACE/.ci/fedora/get_fedora_deps.sh
190+
191+
- name: Set up the RPM output directory
192+
run: mkdir -p $GITHUB_WORKSPACE/rpmbuild/RPMS
193+
194+
- name: Build the RPM repository
195+
working-directory: ${{github.workspace}}/rpmbuild/RPMS
196+
run: |
197+
packit --debug local-build ../..
198+
createrepo_c x86_64
199+
200+
- name: Install the packages
201+
working-directory: ${{github.workspace}}/rpmbuild/RPMS
202+
run:
203+
$GITHUB_WORKSPACE/.ci/retry-command.sh
204+
dnf -y install --nogpgcheck
205+
--allowerasing
206+
--repofrompath libmodulemd-ci,x86_64
207+
x86_64/python3-libmodulemd*.rpm
208+
x86_64/libmodulemd-devel*.rpm
209+
210+
- name: Set up the build directory
211+
run:
212+
meson --buildtype=release -Dtest_installed_lib=true
213+
installed_lib_tests $GITHUB_WORKSPACE
214+
215+
- name: Compile the code
216+
run: ninja -C installed_lib_tests
217+
218+
- name: Run tests on the installed RPMs
219+
run:
220+
meson test --suite ci
221+
-C installed_lib_tests
222+
--print-errorlogs
223+
-t 5

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,4 @@ __pycache__/
8282
/fedora/libmodulemd-*
8383
*.rpm
8484
.travis/.home*
85-
.travis/*/Dockerfile.deps.*
8685
.ci/.home*
87-
.ci/*/Dockerfile.deps.*

0 commit comments

Comments
 (0)