-
Notifications
You must be signed in to change notification settings - Fork 161
428 lines (377 loc) · 16.6 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
name: CI
# Trigger the workflow on push or pull request
on:
workflow_dispatch:
inputs:
# see https://github.com/marketplace/actions/debugging-with-tmate
debug_enabled:
description: 'Run the build with tmate debugging enabled'
type: boolean
pull_request:
push:
schedule:
# Every day at 2:30 AM UTC
- cron: '30 2 * * *'
concurrency:
# group by workflow and ref; the last slightly strange component ensures that for pull
# requests, we limit to 1 concurrent job, but for the master branch we don't
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }}
# Cancel intermediate builds, but only if it is a pull request build.
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
env:
# default config flags: enable debug asserts
CONFIGFLAGS: "--enable-debug"
# CHERE_INVOKING=1 lets us start a 'login shell' (to set paths) in Windows without changing directory
CHERE_INVOKING: 1
jobs:
test:
name: ${{ matrix.test-suites }} - ${{ matrix.extra }} - ${{ matrix.os }}
# Don't run this twice on PRs for branches pushed to the same repository
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
defaults:
run:
shell: ${{ matrix.shell }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
shell: [bash]
test-suites:
[
# base test: fast first test
"testinstall",
"teststandard",
# run tests contained in the manual
"testmanuals",
# test error reporting and compiling as well as libgap
"testexpect testmockpkg testspecial test-compile testlibgap testkernel testworkspace",
# compile packages and run GAP tests
# don't use --enable-debug to prevent the tests from taking too long
"testpackages testinstall-loadall",
]
extra: [""]
# add a few extra tests
include:
# test creating the manual
# also test `make install` here, as that wants the manual, too;
# and set NO_COVERAGE=1 to ensure the installed GAP binaries don't
# contain references to the build directory
- os: ubuntu-latest
shell: bash
test-suites: "makemanuals testmakeinstall"
extra: "CONFIGFLAGS=\"--prefix=/tmp/gapprefix\" NO_COVERAGE=1"
- os: ubuntu-20.04
shell: bash
test-suites: "teststandard"
extra: "ABI=32 CONFIGFLAGS=\"\""
# FIXME: we used to run `teststandard` for HPC-GAP under Travis CI,
# but somehow when running on GitHub Actions, it takes almost 4
# hours (!) to complete instead of 25 minutes. So for now we just
# run testinstall.
- os: ubuntu-latest
shell: bash
test-suites: "testinstall"
extra: "HPCGAP=yes ABI=64"
# this job also tests GAP without readline and gmp
- os: macos-latest
shell: bash
test-suites: "testmockpkg testinstall"
extra: "BOOTSTRAP_MINIMAL=yes"
# run bugfix regression tests
# Also turn on '--enable-memory-checking' to make sure GAP compiles
# with the flag enabled. We do not actually test the memory
# checking, as this slows down GAP too much.
# Also check ubuntu-latest works.
- os: ubuntu-latest
shell: bash
test-suites: "testbugfix"
extra: "CONFIGFLAGS=\"--enable-memory-checking\""
# out of tree builds -- these are mainly done to verify that the
# build system work in this scenario. Since we don't expect the test
# results to vary compared to the in-tree builds, we turn off
# coverage reporting by setting NO_COVERAGE=1; this has the extra
# benefit of also running the tests at least once with the
# ReproducibleBehaviour option turned off.
# The '--enable-valgrind' checks that GAP builds and runs correctly
# when compiled with valgrind support. We do not actually run any
# tests using valgrind, as it is too slow.
- os: ubuntu-latest
shell: bash
test-suites: "testbuildsys testmockpkg testinstall"
extra: "NO_COVERAGE=1 ABI=64 BUILDDIR=out-of-tree
CONFIGFLAGS=\"--enable-valgrind\""
packages: "valgrind"
# same as above, but in 32 bit mode, also turn off debugging (see
# elsewhere in this file for an explanation).
- os: ubuntu-20.04
shell: bash
test-suites: "testbuildsys testmockpkg testinstall"
extra: "NO_COVERAGE=1 ABI=32 BUILDDIR=out-of-tree CONFIGFLAGS=\"\""
# test Julia integration
- os: ubuntu-20.04
shell: bash
test-suites: "testinstall"
extra: "JULIA=yes CONFIGFLAGS=\"--enable-debug\""
- os: windows-2019
# The 'run' steps in this job use Cygwin's bash, once it is set up.
# --login: make a login shell (so PATH is set up)
# -o igncr: Accept windows line endings
# {0} : Pass any extra arguments from CI
shell: C:\cygwin64\bin\bash.exe --login -o igncr '{0}'
test-suites: "testmockpkg testinstall"
env:
TEST_SUITES: ${{ matrix.test-suites }}
steps:
- uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: 3.9
- uses: gap-actions/setup-cygwin@v1
if: ${{ runner.os == 'Windows' }}
with:
PKGS_TO_INSTALL: 'wget,git,gcc-g++,gcc-core,m4,libgmp-devel,make,automake,libtool,autoconf,autoconf2.5,zlib-devel,libreadline-devel,libmpc-devel,libmpfr-devel,xdg-utils,pkg-config'
# There are two cygwin installs on github actions (ours,
# and a preinstalled one which we can't use as not enough packages are installed.
# Due to conflicts between these two, we cannot spawn new Cygwin processes and
# then use IO between processes
- if: ${{ runner.os == 'Windows' }}
name: "Remove tests which do not work on github actions in Windows"
run: |
rm tst/testinstall/testunix/streamio.tst tst/testinstall/testunix/streams.tst
- name: "Set up compiler and linker flags"
run: |
${{ matrix.extra }}
if [[ -n ${NO_COVERAGE} ]] ; then
echo "No coverage reporting"
elif [ "$RUNNER_OS" == "Linux" ] ; then
# Passing -pthread makes linux gcc generate profiles in a thread-safe way,
# but that is very slow, so we force non-threadsafe generation.
echo "Use non-threadsafe coverage options, updating compiler and linker flags"
echo "CFLAGS=--coverage -O2 -g -fprofile-update=single" >> $GITHUB_ENV
echo "CXXFLAGS=--coverage -O2 -g -fprofile-update=single" >> $GITHUB_ENV
echo "LDFLAGS=--coverage -fprofile-update=single" >> $GITHUB_ENV
else
echo "Using standard coverage options, updating compiler and linker flags"
echo "CFLAGS=--coverage -O2 -g" >> $GITHUB_ENV
echo "CXXFLAGS=--coverage -O2 -g" >> $GITHUB_ENV
echo "LDFLAGS=--coverage" >> $GITHUB_ENV
fi
- name: "Install dependencies"
run: |
${{ matrix.extra }}
echo "${{ matrix.extra }}" > extra.flags
if [ "$RUNNER_OS" == "Linux" ]; then
packages=(${{ matrix.packages }})
if [[ $TEST_SUITES == *testbuildsys* ]] ; then
sudo apt-get remove libgmp-dev libreadline-dev zlib1g-dev
else
packages+=(libgmp-dev libreadline-dev zlib1g-dev expect)
fi
if [[ $TEST_SUITES == *testpackages* ]] ; then
packages+=( # For:
4ti2 # 4ti2Interface
libcdd-dev # CddInterface
libcurl4-openssl-dev # curlInterface
libfplll-dev # float
libmpc-dev # float
libmpfi-dev # float
libmpfr-dev # float
libncurses-dev # browse
libzmq3-dev # ZeroMQInterface
pari-gp # alnuth
singular # singular
)
fi
if [[ $TEST_SUITES == *makemanuals* ]] ; then
packages+=(
texlive-latex-base
texlive-latex-recommended
texlive-latex-extra
texlive-fonts-recommended
)
fi
if [[ $ABI == 32 ]] ; then
sudo dpkg --add-architecture i386
for i in "${!packages[@]}"; do
packages[$i]="${packages[$i]}:i386"
done
packages+=(gcc-multilib g++-multilib)
fi
sudo apt-get update
sudo apt-get install --no-install-recommends "${packages[@]}"
sudo apt-get install pkg-config
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install autoconf zlib pkg-config
fi
python -m pip install gcovr
# Setup ccache, to speed up repeated compilation of the same binaries
# (i.e., GAP and the packages)
- name: "Setup ccache"
if: ${{ runner.os != 'Windows' }}
uses: Chocobo1/setup-ccache-action@v1
with:
update_packager_index: false
override_cache_key: ${{ runner.os }}-${{ hashFiles('extra.flags') }}-${{ github.ref }}
override_cache_key_fallback: ${{ runner.os }}-${{ hashFiles('extra.flags') }}
- name: "Workaround GitHub security concerns" # see https://github.com/gap-system/gap/issues/4861
run: git config --global --add safe.directory $PWD
- name: "Configure GAP"
run: ${{ matrix.extra }} dev/ci-configure-gap.sh
- name: "Build GAP"
run: ${{ matrix.extra }} dev/ci-build-gap.sh
- name: "Download packages"
run: ${{ matrix.extra }} dev/ci-download-pkgs.sh
- name: "Setup tmate session"
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
- name: "Run tests"
run: ${{ matrix.extra }} dev/ci.sh ${{ matrix.test-suites }}
- name: "Upload pdf manuals"
if: ${{ contains(matrix.test-suites, 'makemanuals') }}
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: manuals-pdf
path: |
doc/dev/manual.pdf
doc/hpc/manual.pdf
doc/ref/manual.pdf
doc/tut/manual.pdf
- name: "Upload html manuals"
if: ${{ contains(matrix.test-suites, 'makemanuals') }}
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: manuals-html
path: |
doc/*/*.html
doc/*/*.css
doc/*/*.js
- name: "Gather coverage data"
run: ${{ matrix.extra }} dev/ci-gather-coverage.sh
- name: "Upload coverage data to Codecov"
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
cross_compile:
# The host should always be linux
runs-on: ubuntu-22.04
name: Cross compiler for s390x
steps:
- name: Install Cross-Compile Support
uses: cyberjunk/gha-ubuntu-cross@167f2e5e6bc0e78d9420ed64aa66b38bda701088
with:
arch: s390x
- name: Install general build dependencies
run: sudo apt-get install -q -y git autoconf
- name: Install cross compile dependencies
run: sudo apt-get install -q -y git libgmp-dev:s390x libreadline-dev:s390x zlib1g-dev:s390x
- uses: actions/checkout@v4
- run: ./autogen.sh
- name: Native compile
run: |
# When building a git snapshot, configure & compile a native version of GAP to
# generate ffdata.{c,h}, c_oper1.c and c_type1.c -- in a GAP release tarball
# this is not necessary.
mkdir native-build
cd native-build
../configure --without-readline
make -j2
cp build/c_*.c build/ffdata.* ../src/
cd ..
- name: Configure
run: ./configure --host="s390x-linux-gnu"
- name: Cross compile
run: make -j2 V=1 all build-testlibgap build-testkernel
- name: Fixup sysinfo.gap
run: rm sysinfo.gap && make SYSINFO_CC=gcc SYSINFO_CXX=g++ sysinfo.gap
- name: Download required GAP packages
run: make bootstrap-pkg-minimal
- name: Run tests in VM
uses: uraimo/run-on-arch-action@v2
with:
arch: s390x
distro: ubuntu22.04
# Not required, but speeds up builds
githubToken: ${{ github.token }}
# The shell to run commands with in the container
shell: /bin/sh
# Install some dependencies in the container. This speeds up builds if
# you are also using githubToken. Any dependencies installed here will
# be part of the container image that gets cached, so subsequent
# builds don't have to re-install them. The image layer is cached
# publicly in your project's package repository, so it is vital that
# no secrets are present in the container state or logs.
install: |
apt-get update -q -y
# we need build-essential for make and gcc (the latter is used by gac and
# hence by the tests involving mockpkg)
apt-get install -q -y build-essential git libgmp10 libreadline8 zlib1g
# Do the thing
run: |
set -x
git config --global --add safe.directory $PWD # see https://github.com/gap-system/gap/issues/4861
make citests
openbsd:
runs-on: ubuntu-latest
name: Test in OpenBSD
env:
AUTOCONF_VERSION: 2.71
steps:
- uses: actions/checkout@v4
- name: Download required GAP packages
run: |
wget https://github.com/gap-system/PackageDistro/releases/download/latest/packages-required.tar.gz
mkdir pkg
cd pkg
tar xvf ../packages-required.tar.gz
- name: Test in OpenBSD
id: test
uses: vmactions/openbsd-vm@v1
with:
envs: 'AUTOCONF_VERSION'
usesh: true
prepare: |
pkg_add bash git gmake autoconf-2.71p0 gmp
# Do the thing
run: |
set -x
git config --global --add safe.directory $PWD # see https://github.com/gap-system/gap/issues/4861
rm -rf extern # ensure we don't build and link against bundled libraries
./autogen.sh
./configure --with-gmp=/usr/local --without-readline
export MAKE=gmake
gmake -j2 V=1
gmake citests
# The following job is duplicated in release.yml - keep the two in sync.
# (except for their different 'needs' components).
slack-notification:
name: Send Slack notification on status change
needs:
- test
- cross_compile
- openbsd
if: ${{ always() && github.event_name != 'pull_request' && github.repository == 'gap-system/gap' }}
runs-on: ubuntu-latest
steps:
- name: Get branch name
id: get-branch
run: echo "branch=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Determine whether CI status changed
uses: gap-actions/should-i-notify-action@v1
id: should_notify
with:
branch: ${{ steps.get-branch.outputs.branch }}
needs_context: ${{ toJson(needs) }}
github_token: ${{ secrets.GITHUB_TOKEN }}
notify_on_changed_status: true
- name: Send slack notification
uses: act10ns/slack@v2
if: ${{ steps.should_notify.outputs.should_send_message == 'yes' }}
with:
status: ${{ steps.should_notify.outputs.current_status }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}