-
Notifications
You must be signed in to change notification settings - Fork 245
684 lines (550 loc) · 18.3 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
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
name: CI
on:
pull_request:
push:
branches:
- trunk
- flint-*
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 trunk branch we don't
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/trunk' || github.run_number }}
# Cancel intermediate builds, but only if it is a pull request build.
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
##############################################################################
# ubuntu, gcc, code coverage
##############################################################################
ubuntu-codecoverage:
name: Ubuntu GCC, Code Coverage (x10)
runs-on: ubuntu-latest
env:
CC: "gcc"
FLINT_TEST_MULTIPLIER: "10"
steps:
- uses: actions/checkout@v4
- name: "Setup"
run: |
sudo apt-get install -y libgmp-dev
sudo apt-get install -y libmpfr-dev
sudo apt-get install -y autoconf
sudo apt-get install -y libtool-bin
gcc --version
gcov --version
make --version
autoconf --version
libtool --version
echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV
- name: "Configure"
run: |
./bootstrap.sh
./configure \
CC=${CC} \
--enable-avx2 \
--disable-static \
--enable-coverage
- name: "Compile library"
run: |
$MAKE
ldd libflint.so
- name: "Compile tests"
run: |
$MAKE tests
- name: "Check"
run: |
$MAKE check
- name: "Gather coverage data"
run: dev/gather_coverage.sh
- name: "Upload coverage data"
uses: codecov/[email protected]
##############################################################################
# ubuntu, gcc, assert
##############################################################################
ubuntu-gcc-assert:
name: Ubuntu GCC with NTL (assert, x2)
runs-on: ubuntu-latest
env:
CC: "gcc"
FLINT_TEST_MULTIPLIER: "2"
steps:
- uses: actions/checkout@v4
- name: "Setup"
run: |
sudo apt-get install -y libgmp-dev libmpfr-dev libntl-dev autoconf libtool-bin
gcc --version
make --version
autoconf --version
libtool --version
echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV
- name: "Configure"
run: |
./bootstrap.sh
./configure \
CC=${CC} \
--with-gmp=/usr \
--with-mpfr=/usr \
--with-ntl=/usr \
--enable-assert \
--disable-static \
--disable-debug
- name: "Compile library"
run: |
$MAKE
ldd libflint.so
- name: "Compile tests"
run: |
$MAKE tests
- name: "Check"
run: |
$MAKE check
##############################################################################
# macos with gcc and blas
##############################################################################
macos-gcc:
name: macOS GCC with BLAS (x3)
runs-on: macos-latest
env:
CC: "gcc"
FLINT_TEST_MULTIPLIER: "3"
steps:
- uses: actions/checkout@v4
- name: "Setup"
run: |
brew install gcc
brew install make
brew install gmp
brew install mpfr
brew install autoconf
brew install libtool
brew install automake
brew install openblas
gcc --version
gmake --version
autoconf --version
echo "MAKE=gmake -j$(expr $(nproc) + 1) -l 10 --output-sync=target" >> $GITHUB_ENV
- name: "Configure"
run: |
./bootstrap.sh
./configure \
CC=${CC} \
--with-gmp=$(brew --prefix) \
--with-mpfr=$(brew --prefix) \
--with-blas=$(brew --prefix)/opt/openblas \
--disable-static \
--disable-debug
- name: "Compile library"
run: |
$MAKE
- name: "Compile tests"
run: |
$MAKE tests
- name: "Check"
run: |
$MAKE check
##############################################################################
# freebsd with clang
##############################################################################
freebsd-gcc:
name: FreeBSD Clang (x0.5)
runs-on: macos-latest
env:
FLINT_TEST_MULTIPLIER: "0.5"
steps:
- uses: actions/checkout@v4
- name: "Run tests on FreeBSD"
uses: cross-platform-actions/[email protected]
timeout-minutes: 30
continue-on-error: true
with:
operating_system: freebsd
version: '13.2'
shell: bash
run: |
sudo pkg install -y pkgconf gmake gmp mpfr autoconf libtool automake
gmake --version
clang --version
autoconf --version
libtool --version
touch _is_setup
./bootstrap.sh
touch _is_bootstrapped
./configure \
CC=clang \
--with-gmp-include=$(pkgconf --variable=includedir gmp) \
--with-gmp-lib=$(pkgconf --variable=libdir gmp) \
--with-mpfr-include=$(pkgconf --variable=includedir mpfr) \
--with-mpfr-lib=$(pkgconf --variable=libdir mpfr) \
--disable-static \
--disable-debug
touch _is_configured
gmake -j$(expr $(sysctl -n hw.ncpu) + 1)
touch _is_library_built
gmake -j$(expr $(sysctl -n hw.ncpu) + 1) tests
touch _is_tests_built
gmake -j$(expr $(sysctl -n hw.ncpu) + 1) check
touch _is_checked
# Sometimes the FreeBSD runner cannot exit properly. We created files
# for each step to show that it was able to run the tests.
- if: always()
name: "Check that everything was okay"
run: |
if test ! -f _is_setup;
then
echo "Setup failed!"
exit 1
elif test ! -f _is_bootstrapped;
then
echo "Bootstrap failed!"
exit 2
elif test ! -f _is_configured;
then
echo "Configuration failed!"
exit 3
elif test ! -f _is_library_built;
then
echo "Building library failed!"
exit 4
elif test ! -f _is_tests_built;
then
echo "Building tests failed!"
exit 5
elif test ! -f _is_checked;
then
echo "Check failed!"
exit 6
fi
echo "All good!"
##############################################################################
# cygwin with gcc
##############################################################################
cygwin-gcc:
name: Cygwin GCC (x0.5)
runs-on: windows-latest
defaults:
run:
shell: C:\cygwin64\bin\bash.exe --login -o igncr '{0}'
env:
REPO: /cygdrive/d/a/flint/flint # FIXME: De-hardcode this
CC: "gcc"
FLINT_TEST_MULTIPLIER: "0.5"
steps:
- uses: actions/checkout@v4
- name: "Set up Cygwin"
uses: gap-actions/setup-cygwin@v1
with:
PKGS_TO_INSTALL: "dos2unix,gcc-core,make,libgmp-devel,libmpfr-devel,libtool,autoconf,automake"
- name: "Setup"
run: |
gcc --version
make --version
autoconf --version
libtool --version
echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV
- name: "Configure"
run: |
cd ${REPO}
dos2unix configure
dos2unix bootstrap.sh
./bootstrap.sh
./configure \
CC=${CC} \
--disable-static \
--disable-debug
- name: "Compile library"
run: |
cd ${REPO}
${MAKE}
- name: "Compile tests"
run: |
cd ${REPO}
$MAKE tests
- name: "Check"
run: |
cd ${REPO}
$MAKE check
#############################################################################
# ubuntu with clang
#############################################################################
ubuntu-clang:
name: Ubuntu Clang with examples (x5)
runs-on: ubuntu-latest
env:
LOCAL: ${{ github.workspace }}/local
LDFLAGS: "-Wl,-rpath,$LOCAL/lib"
CC: "clang"
FLINT_TEST_MULTIPLIER: "5"
steps:
- uses: actions/checkout@v4
- name: "Setup"
run: |
sudo apt-get install -y libgmp-dev libmpfr-dev autoconf libtool-bin perl
clang --version
make --version
autoconf --version
libtool --version
perl --version
echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV
- name: "Configure"
run: |
./bootstrap.sh
./configure \
CC=${CC} \
--disable-static \
--disable-debug
- name: "Compile library"
run: |
$MAKE
ldd libflint.so
- name: "Compile tests"
run: |
$MAKE tests
- name: "Check"
run: |
$MAKE check
- name: "Compile examples"
run: |
$MAKE examples
- name: "Check examples"
run: |
$MAKE checkexamples
#############################################################################
# ubuntu with gcc and cmake (no checks)
#############################################################################
ubuntu-cmake-gcc:
name: Ubuntu GCC, CMake (1x)
runs-on: ubuntu-latest
env:
LOCAL: ${{ github.workspace }}/local
LDFLAGS: "-Wl,-rpath,$LOCAL/lib"
steps:
- uses: actions/checkout@v4
- name: "Setup"
run: |
sudo apt-get install -y cmake
sudo apt-get install -y libgmp-dev
sudo apt-get install -y libmpfr-dev
gcc --version
make --version
cmake --version
echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV
- name: "Configure"
run: |
mkdir build
cd build
cmake -G"Unix Makefiles" -DWITH_NTL=no -DBUILD_TESTING=yes \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${LOCAL} ..
- name: "Compile library and tests"
run: |
cd build
$MAKE
ldd lib/libflint.so
- name: "Run tests"
run: |
cd build
ctest -j$(expr $(nproc) + 1) --output-on-failure --timeout 450
#############################################################################
# mingw with gcc
#############################################################################
mingw64-gcc:
name: MinGW GCC (x0.5)
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
env:
CC: "gcc"
FLINT_TEST_MULTIPLIER: "0.5"
steps:
- uses: actions/checkout@v4
- name: "Setup MinGW"
uses: msys2/setup-msys2@v2
with:
msystem: mingw64
update: true
install: mingw-w64-x86_64-gcc mingw-w64-x86_64-autotools
- name: "Setup"
run: |
gcc --version
make --version
autoconf --version
libtool --version
echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV
- name: "Configure"
run: |
./bootstrap.sh
./configure \
CC=${CC} \
--disable-static \
--disable-debug
- name: "Compile library"
run: |
${MAKE}
- name: "Compile tests"
run: |
${MAKE} tests
- name: "Check"
run: |
${MAKE} check
##############################################################################
# msvc
##############################################################################
msvc:
name: MSVC (x1)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: "Setup cache for dependencies"
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: "Install dependencies"
run: |
vcpkg install gmp mpfr pthreads --binarysource="clear;x-gha,readwrite"
- name: "Setup MSVC"
uses: ilammy/[email protected]
with:
arch: x86_64
toolset: 14.37.32822
vsversion: 17.6.0
- name: "Configure"
run: |
mkdir build
cd build
# For single build, we need atomics
cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_C_FLAGS="/wd4018 /wd4146 /wd4244 /wd4267 /wd4305 /wd4996 /std:c11 /experimental:c11atomics" -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release ..
- name: "Build"
run: |
cd build
cmake --build . -- -j3
- name: "Check"
run: |
cd build
set "FLINT_TEST_MULTIPLIER=1"
ctest -j3 --output-on-failure --timeout 450
##############################################################################
# alpine linux, musl, 32-bit (assert)
##############################################################################
alpine-32bit:
name: Alpine Linux, musl, 32-bit (assert, x1.5)
runs-on: ubuntu-latest
env:
CC: "gcc"
FLINT_TEST_MULTIPLIER: "1.5"
steps:
- uses: actions/checkout@v4
- name: "Setup latest Alpine Linux"
uses: jirutka/setup-alpine@v1
with:
arch: x86
branch: edge
packages: >
gmp-dev
mpfr-dev
gcc
musl-dev
make
autoconf
automake
libtool
- name: "Setup"
run: |
gcc --version
make --version
autoconf --version
libtool --version
echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV
shell: alpine.sh {0}
- name: "Configure"
run: |
./bootstrap.sh
./configure \
CC=${CC} \
--enable-assert \
--disable-static \
--disable-debug
shell: alpine.sh {0}
- name: "Compile library"
run: |
$MAKE
shell: alpine.sh {0}
- name: "Compile tests"
run: |
$MAKE tests
shell: alpine.sh {0}
- name: "Check"
run: |
$MAKE check
shell: alpine.sh {0}
##############################################################################
# nemo
##############################################################################
nemo:
name: Nemo.jl (temporary branch)
runs-on: ubuntu-latest
env:
LOCAL: ${{ github.workspace }}/local
CC: "gcc"
steps:
- uses: actions/checkout@v4
- name: "Setup"
run: |
sudo apt-get install -y sed
sudo apt-get install -y autoconf
sudo apt-get install -y libtool-bin
gcc --version
make --version
autoconf --version
libtool --version
julia --version
julia -e 'println(Base.BinaryPlatforms.HostPlatform())'
echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV
- name: "Configure"
run: |
# Find path to GMP and MPFR
gmp_path=$(julia -e 'include("dev/find_gmp_mpfr.jl"); print(gmp_artifact_dir())')
echo "Path to GMP: ${gmp_path}"
mpfr_path=$(julia -e 'include("dev/find_gmp_mpfr.jl"); print(mpfr_artifact_dir())')
echo "Path to MPFR: ${mpfr_path}"
# Make sure that we output an soname which corresponds to FLINT_JLL's
# soname
wget https://raw.githubusercontent.com/JuliaPackaging/Yggdrasil/master/F/FLINT/build_tarballs.jl
FLINT_JLL_VERSION=$(grep "upstream_version =" build_tarballs.jl | sed "s/upstream_version = v\"\([0-9\.]*\)\"/\1/")
FLINT_JLL_SONAME=$(grep "$FLINT_JLL_VERSION => " configure.ac | sed "s/# $FLINT_JLL_VERSION => \([0-9\.]\+\)/\1/")
FLINT_JLL_MAJOR=$(echo $FLINT_JLL_SONAME | sed "s/\([0-9]\+\)\.[0-9]\+\.[0-9]\+/\1/")
FLINT_JLL_MINOR=$(echo $FLINT_JLL_SONAME | sed "s/[0-9]\+\.\([0-9]\+\)\.[0-9]\+/\1/")
FLINT_JLL_PATCH=$(echo $FLINT_JLL_SONAME | sed "s/[0-9]\+\.[0-9]\+\.\([0-9]\+\)/\1/")
sed -i "s/^\(FLINT_MAJOR_SO=\)[0-9]\+/\1$FLINT_JLL_MAJOR/" configure.ac
sed -i "s/^\(FLINT_MINOR_SO=\)[0-9]\+/\1$FLINT_JLL_MINOR/" configure.ac
sed -i "s/^\(FLINT_PATCH_SO=\)[0-9]\+/\1$FLINT_JLL_PATCH/" configure.ac
# Now we can configure FLINT. However, recent versions of MPFR_jll has
# memory sanitation which messes with finding mpfr_init in the
# configure-script. Hence, we also omit the check for finding MPFR.
# FIXME: Probably want to fix this.
./bootstrap.sh
./configure \
CC=${CC} \
--prefix=${LOCAL} \
--with-gmp=${gmp_path} \
--with-mpfr=${mpfr_path} \
--disable-mpfr-check \
--disable-static \
--disable-debug
- name: "Compile and install"
run: |
$MAKE
$MAKE install
- name: "Set up Nemo.jl"
run: |
# Override FLINT_jll's libflint with ours
# NOTE: Reverse me when Nemo uses FLINT v3.
# git clone https://github.com/Nemocas/Nemo.jl.git
git clone https://github.com/albinahlback/Nemo.jl.git && cd Nemo.jl && git checkout flint3 && cd ..
julia -e "import Pkg; Pkg.develop(path=\"./Nemo.jl\");"
echo -e "[e134572f-a0d5-539d-bddf-3cad8db41a82]\nFLINT = \"${LOCAL}\"" > ~/.julia/artifacts/Overrides.toml
touch Nemo.jl/src/Nemo.jl
julia -e "using Nemo; println(\"Path to Nemo's libflint:\", Nemo.libflint)"
- name: "Check Nemo.jl"
run: |
julia -e "import Pkg; Pkg.test(\"Nemo\")"