Skip to content

Commit ace71ff

Browse files
committed
Make GitHub Actions cover "make check" and "make uninstall"
Signed-off-by: Sebastian Pipping <[email protected]>
1 parent c7dcae0 commit ace71ff

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#
2+
# Copyright (c) 2024 Sebastian Pipping <[email protected]>
3+
#
4+
# This program is free software; you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation; either version 2 of the License, or (at
7+
# your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful, but
10+
# WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program; if not, see
16+
# <http://www.gnu.org/licenses/>.
17+
#
18+
name: Run the test suite
19+
20+
on:
21+
pull_request:
22+
push:
23+
schedule:
24+
- cron: '0 14 * * 5' # Every Friday 2pm
25+
workflow_dispatch:
26+
27+
# Drop permissions to minimum for security
28+
permissions:
29+
contents: read
30+
31+
jobs:
32+
test_suite:
33+
name: Run the test suite
34+
runs-on: ubuntu-24.04
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Install dependencies
39+
run: |-
40+
ubuntu_packages=(
41+
# Perl runtime dependencies as documented in README
42+
libcapture-tiny-perl # CPAN Capture::Tiny
43+
libdatetime-perl # CPAN DateTime
44+
libdevel-cover-perl # CPAN Devel::Cover
45+
libdigest-md5-file-perl # CPAN Digest::MD5
46+
libfile-spec-native-perl # CPAN File::Spec
47+
libjson-xs-perl # CPAN JSON::XS
48+
# CPAN Memory::Process, see below
49+
# CPAN Module::Load::Conditional
50+
libscalar-list-utils-perl # CPAN Scalar::Util
51+
# CPAN Time::HiRes
52+
53+
# Non-Perl runtime dependencies as documented in README
54+
llvm # for command "llvm-profdata"
55+
python3-coverage # PyPI coverage
56+
python3-xlsxwriter # PyPI xlsxwriter
57+
58+
# Additional dependencies for "make check"
59+
libgd-perl # CPAN GD
60+
)
61+
set -x
62+
63+
sudo apt-get update
64+
sudo apt-get install --no-install-recommends --yes -V "${ubuntu_packages[@]}"
65+
66+
sudo perl -MCPAN -e 'install(Memory::Process)' # no package in Ubuntu
67+
68+
sudo ln -s python3-coverage /usr/bin/coverage # until issue #347 is fixed
69+
70+
- name: make install
71+
run: |-
72+
set -x -o pipefail
73+
make install PREFIX=/usr CFG_DIR=/etc DESTDIR="${PWD}/ROOT"
74+
find ROOT/ | sort | xargs -r ls -ld
75+
76+
- name: make uninstall
77+
run: |-
78+
set -x -o pipefail
79+
make uninstall PREFIX=/usr CFG_DIR=/etc DESTDIR="${PWD}/ROOT"
80+
find ROOT/ | sort | xargs -r ls -ld
81+
diff -u0 <(echo 'total 0') <(ls -l ROOT/) # i.e. fail CI if leftovers
82+
83+
- name: make check
84+
run: |-
85+
set -x -o pipefail
86+
# NOTE: There are two things going on in this hackery:
87+
# - So far "make check" exits with code 0 despite failures —
88+
# see issue #348 — so we need a more manual approach to detect
89+
# failing tests
90+
# - We compare the number of failing tests to the known status
91+
# quo — see issue #343 — so that
92+
# - we have a chance for a green CI while also
93+
# - we will notice when more of the existing tests start
94+
# to fail.
95+
make check |& tee /dev/stderr \
96+
| grep -F ' failed, ' | tee /dev/stderr \
97+
| grep -F -q ', 3 failed, ' \
98+
|| { echo 'Number of tests expected to fail^^ does not match -- did you break an existing test?' >&2 ; false ; }

0 commit comments

Comments
 (0)