Debian Codegraph @

.github/workflows/run_test_suite.yml

raw
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 (GCC ${{ matrix.gcc }}, ${{ matrix.runs-on }})"
34 runs-on: ${{ matrix.runs-on }}
35 strategy:
36 fail-fast: false
37 matrix:
38 include:
39 - runs-on: ubuntu-24.04
40 gcc: 9
41 install: g++-9 gcc-9 cpp-9
42 - runs-on: ubuntu-24.04
43 gcc: 10
44 install: g++-10 gcc-10 cpp-10
45 # GCC 10 to 14 are assumed to behave "the same",
46 # so we are skipping GCC 11, 12, 13 here to save CI resources
47 - runs-on: ubuntu-24.04
48 gcc: 14
49 install:
50 - runs-on: ubuntu-24.04
51 gcc: 15
52 install: binutils g++-15 gcc-15 cpp-15
53 steps:
54 - uses: actions/checkout@v5
55
56 - name: Add repository "ubuntu-toolchain-r" for GCC 15
57 if: "${{ matrix.gcc == '15' }}"
58 run: |
59 set -x
60 # The repository is at home at https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test .
61 # NOTE: plucky is 25.04 (not 24.04 LTS)
62 wget -O - 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xc8ec952e2a0e1fbdc5090f6a2c277a0a352154e5' | sudo apt-key add -
63 sudo add-apt-repository 'deb https://ppa.launchpadcontent.net/ubuntu-toolchain-r/test/ubuntu plucky main'
64
65 - name: Install dependencies
66 run: |-
67 ubuntu_packages=(
68 # Perl runtime dependencies as documented in README
69 libcapture-tiny-perl # CPAN Capture::Tiny
70 libdatetime-perl # CPAN DateTime
71 libdevel-cover-perl # CPAN Devel::Cover
72 libdigest-md5-file-perl # CPAN Digest::MD5
73 libfile-spec-native-perl # CPAN File::Spec
74 libjson-xs-perl # CPAN JSON::XS
75 # CPAN Memory::Process, see below
76 # CPAN Module::Load::Conditional
77 libscalar-list-utils-perl # CPAN Scalar::Util
78 # CPAN Time::HiRes
79 libtimedate-perl # CPAN TimeDate
80
81 # Non-Perl runtime dependencies as documented in README
82 llvm # for command "llvm-profdata"
83 python3-coverage # PyPI coverage
84 python3-xlsxwriter # PyPI xlsxwriter
85
86 # Additional dependencies for "make check"
87 libgd-perl # CPAN GD
88 )
89 set -x
90
91 sudo apt-get update
92 sudo apt-get install --no-install-recommends --yes -V "${ubuntu_packages[@]}"
93
94 sudo perl -MCPAN -e 'install(Memory::Process)' # no package in Ubuntu
95
96 - name: "Make GCC ${{ matrix.gcc }} systemwide default"
97 run: |-
98 set -x -o pipefail
99 if [[ "${{ matrix.install }}" != "" ]]; then
100 sudo apt-get update
101 sudo apt-get install --no-install-recommends --yes -V ${{ matrix.install }}
102 fi
103
104 # Make requested version GCC and GCOV the system default
105 # before we have an easy way to fully divert "make check"
106 # off of the default commands
107 for i in cpp {,x86_64-linux-gnu-}{g++,gcc{,-{ar,nm,ranlib}},gcov{,-{dump,tool}},gfortran} lto-dump ; do
108 [[ -e /usr/bin/"${i}" ]] || continue
109 [[ -e /usr/bin/"${i}-${{ matrix.gcc }}" ]] || continue
110 sudo rm /usr/bin/"${i}"
111 sudo ln -s "${i}-${{ matrix.gcc }}" /usr/bin/"${i}"
112 "${i}" --version | head -n1
113 done
114
115 - name: make install
116 run: |-
117 set -x -o pipefail
118 make install PREFIX=/usr CFG_DIR=/etc DESTDIR="${PWD}/ROOT"
119 find ROOT/ | sort | xargs -r ls -ld
120
121 - name: make uninstall
122 run: |-
123 set -x -o pipefail
124 make uninstall PREFIX=/usr CFG_DIR=/etc DESTDIR="${PWD}/ROOT"
125 find ROOT/ | sort | xargs -r ls -ld
126 diff -u0 <(echo 'total 0') <(ls -l ROOT/) # i.e. fail CI if leftovers
127
128 - name: make check
129 run: |-
130 set -x -o pipefail
131 make check
132
133 - name: Upload test log as an artifact
134 uses: actions/upload-artifact@v4
135 with:
136 name: "lcov-${{ github.sha }}-${{ runner.os }}-GCC-${{ matrix.gcc }}-test-log" # .zip
137 path: tests/test.log
138 if-no-files-found: error
139
140 - name: Upload test directory shrapnel as an artifact
141 uses: actions/upload-artifact@v4
142 with:
143 name: "lcov-${{ github.sha }}-${{ runner.os }}-GCC-${{ matrix.gcc }}-shrapnel" # .zip
144 path: tests
145 #if-no-files-found: error