Merge pull request #2116 from orlitzky/c23 #2879
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
env: | |
GLOBAL_MULTIPLIER: 1 | |
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 main branch we don't | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/main' || 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-24.04 | |
env: | |
CC: "gcc" | |
FLINT_TEST_MULTIPLIER: "10" | |
steps: | |
- name: "Rescale multiplier" | |
run: | | |
FLINT_TEST_MULTIPLIER=$(echo "${FLINT_TEST_MULTIPLIER} * ${GLOBAL_MULTIPLIER}" | bc) | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: "Setup" | |
run: | | |
sudo apt-get install -y \ | |
libgmp-dev \ | |
libmpfr-dev \ | |
autoconf \ | |
libtool-bin \ | |
lcov | |
# Check versions | |
gcc --version | |
make --version | |
autoconf --version | |
libtool --version | |
lcov --version | |
python3 --version | |
echo "MAKE=make -j$(expr $(nproc) + 1) --output-sync=target" >> $GITHUB_ENV | |
- name: "Configure" | |
run: | | |
./bootstrap.sh | |
./configure \ | |
CC=${CC} \ | |
--enable-avx2 \ | |
--enable-coverage | |
- name: "Compile library" | |
run: | | |
$MAKE | |
ldd libflint.so | |
- name: "Compile tests" | |
run: | | |
$MAKE tests | |
- name: "Check" | |
run: | | |
$MAKE check | |
- name: "Check Python" | |
run: | | |
$MAKE check PYTHON=1 | |
- name: "Gather coverage data" | |
run: | | |
$MAKE coverage | |
- name: "Upload coverage data" | |
uses: codecov/codecov-action@v4 | |
if: github.repository == 'flintlib/flint' | |
with: | |
files: build/coverage/coverage.info | |
token: ${{ secrets.CODECOV_TOKEN }} | |
############################################################################## | |
# gcc build check no regressions | |
############################################################################## | |
gcc-build-regression-check: | |
name: GCC build regression check (no tests) | |
runs-on: ubuntu-24.04 | |
env: | |
CC: "gcc" | |
CFLAGS: "-march=native -std=c11 -Wall -Wextra -Werror" | |
MODULES: "build/thread_pool_merged.lo build/thread_support_merged.lo build/ulong_extras_merged.lo build/long_extras_merged.lo build/perm_merged.lo build/double_extras_merged.lo build/d_vec_merged.lo build/d_mat_merged.lo build/mpn_extras_merged.lo build/mpfr_vec_merged.lo build/mpfr_mat_merged.lo build/nmod_merged.lo build/nmod_vec_merged.lo build/nmod_mat_merged.lo build/nmod_poly_merged.lo build/mpn_mod_merged.lo build/fmpz_merged.lo build/fmpz_vec_merged.lo build/fmpz_mat_merged.lo build/fmpz_poly_merged.lo build/fmpz_mod_merged.lo build/fmpz_mod_vec_merged.lo build/fmpz_mod_mat_merged.lo build/fmpz_mod_poly_merged.lo build/fmpq_merged.lo build/fmpq_vec_merged.lo build/fmpq_mat_merged.lo build/fmpq_poly_merged.lo build/fq_merged.lo build/fq_vec_merged.lo build/fq_mat_merged.lo build/fq_poly_merged.lo build/fq_nmod_merged.lo build/fq_nmod_vec_merged.lo build/fq_nmod_mat_merged.lo build/fq_nmod_poly_merged.lo build/fq_zech_merged.lo build/fq_zech_mat_merged.lo build/fq_zech_poly_merged.lo build/fq_default_merged.lo build/fq_default_mat_merged.lo build/fq_default_poly_merged.lo build/fq_embed_merged.lo build/fq_nmod_embed_merged.lo build/fq_zech_embed_merged.lo build/padic_merged.lo build/padic_mat_merged.lo build/padic_poly_merged.lo build/qadic_merged.lo build/nmod_poly_factor_merged.lo build/fmpz_factor_merged.lo build/fmpz_poly_factor_merged.lo build/fmpz_mod_poly_factor_merged.lo build/fq_poly_factor_merged.lo build/fq_nmod_poly_factor_merged.lo build/fq_zech_poly_factor_merged.lo build/fq_default_poly_factor_merged.lo build/nmod_poly_mat_merged.lo build/fmpz_poly_mat_merged.lo build/mpoly_merged.lo build/nmod_mpoly_merged.lo build/fmpz_mpoly_merged.lo build/fmpz_mod_mpoly_merged.lo build/fmpq_mpoly_merged.lo build/fq_nmod_mpoly_merged.lo build/fq_zech_mpoly_merged.lo build/nmod_mpoly_factor_merged.lo build/fmpz_mpoly_factor_merged.lo build/fmpz_mod_mpoly_factor_merged.lo build/fmpq_mpoly_factor_merged.lo build/fq_nmod_mpoly_factor_merged.lo build/fq_zech_mpoly_factor_merged.lo build/fft_merged.lo build/fft_small_merged.lo" | |
# Everything until fmpz_poly_q | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Setup" | |
run: | | |
sudo apt-get install -y libgmp-dev libmpfr-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} \ | |
CFLAGS="${CFLAGS}" \ | |
--disable-debug | |
- name: "Check regression in a subset of modules" | |
run: | | |
$MAKE $MODULES | |
############################################################################## | |
# ubuntu gcc with assert | |
############################################################################## | |
ubuntu-gcc-assert: | |
name: Ubuntu GCC with NTL (assert, x2) | |
runs-on: ubuntu-24.04 | |
env: | |
CC: "gcc" | |
FLINT_TEST_MULTIPLIER: "2" | |
steps: | |
- name: "Rescale multiplier" | |
run: | | |
FLINT_TEST_MULTIPLIER=$(echo "${FLINT_TEST_MULTIPLIER} * ${GLOBAL_MULTIPLIER}" | bc) | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" >> $GITHUB_ENV | |
- 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-ntl \ | |
--enable-assert \ | |
--disable-debug | |
- name: "Compile library" | |
run: | | |
$MAKE | |
ldd libflint.so | |
- name: "Compile tests" | |
run: | | |
$MAKE tests | |
- name: "Check" | |
run: | | |
$MAKE check | |
############################################################################## | |
# macos (M1) with clang | |
############################################################################## | |
macos-m1: | |
name: macOS-M1, Clang (x3) | |
runs-on: macos-14 | |
env: | |
FLINT_TEST_MULTIPLIER: "3" | |
steps: | |
- name: "Rescale multiplier" | |
run: | | |
FLINT_TEST_MULTIPLIER=$(echo "${FLINT_TEST_MULTIPLIER} * ${GLOBAL_MULTIPLIER}" | bc) | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: "Setup" | |
run: | | |
brew install make | |
brew install gmp | |
brew install mpfr | |
brew install autoconf | |
brew install libtool | |
brew install automake | |
$(brew --prefix llvm@15)/bin/clang --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=$(brew --prefix llvm@15)/bin/clang \ | |
--with-gmp=$(brew --prefix) \ | |
--with-mpfr=$(brew --prefix) \ | |
--disable-debug | |
- name: "Compile library" | |
run: | | |
$MAKE | |
- name: "Compile tests" | |
run: | | |
$MAKE tests | |
- name: "Check" | |
run: | | |
$MAKE check | |
############################################################################## | |
# macos (x86) with clang and blas | |
############################################################################## | |
macos-x86: | |
name: macOS-x86 Clang with BLAS (x2) | |
runs-on: macos-12 | |
env: | |
FLINT_TEST_MULTIPLIER: "2" | |
steps: | |
- name: "Rescale multiplier" | |
run: | | |
FLINT_TEST_MULTIPLIER=$(echo "${FLINT_TEST_MULTIPLIER} * ${GLOBAL_MULTIPLIER}" | bc) | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: "Setup" | |
run: | | |
brew install make | |
brew install gmp | |
brew install mpfr | |
brew install autoconf | |
brew install libtool | |
brew install automake | |
brew install openblas | |
$(brew --prefix llvm@15)/bin/clang --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=$(brew --prefix llvm@15)/bin/clang \ | |
--with-gmp=$(brew --prefix) \ | |
--with-mpfr=$(brew --prefix) \ | |
--with-blas=$(brew --prefix)/opt/openblas \ | |
--disable-debug | |
- name: "Compile library" | |
run: | | |
$MAKE | |
- name: "Compile tests" | |
run: | | |
$MAKE tests | |
- name: "Check" | |
run: | | |
$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: | |
- name: "Rescale multiplier" | |
run: | | |
FLINT_TEST_MULTIPLIER=$(echo "${FLINT_TEST_MULTIPLIER} * ${GLOBAL_MULTIPLIER}" | bc) | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" >> $GITHUB_ENV | |
- 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-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 | |
############################################################################# | |
# 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: bc mingw-w64-x86_64-gcc mingw-w64-x86_64-autotools | |
- name: "Rescale multiplier" | |
run: | | |
FLINT_TEST_MULTIPLIER=$(echo "${FLINT_TEST_MULTIPLIER} * ${GLOBAL_MULTIPLIER}" | bc) | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" >> $GITHUB_ENV | |
- 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-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 | |
env: | |
FLINT_TEST_MULTIPLIER: 1 | |
TIMEOUT: 150 | |
steps: | |
- name: "Rescale multiplier (powershell)" | |
run: | | |
$FLINT_TEST_MULTIPLIER = $env:FLINT_TEST_MULTIPLIER * $env:GLOBAL_MULTIPLIER | |
echo "FLINT_TEST_MULTIPLIER=$FLINT_TEST_MULTIPLIER | Out-File -Append -FilePath $env:GITHUB_ENV" | |
$TIMEOUT = $env:TIMEOUT * $env:GLOBAL_MULTIPLIER | |
echo "TIMEOUT=$TIMEOUT | Out-File -Append -FilePath $env:GITHUB_ENV" | |
shell: powershell | |
- uses: actions/checkout@v4 | |
- name: "Setup cache for dependencies" | |
uses: actions/github-script@v7 | |
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 | |
- 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 /experimental:c11atomics" ` | |
-DBUILD_TESTING=ON ` | |
-DCMAKE_BUILD_TYPE=Release ` | |
.. | |
- name: "Build" | |
run: | | |
cd build | |
# NOTE: Number of threads for Github's CI runners are 4. | |
cmake --build . -j5 | |
- name: "Check" | |
run: | | |
cd build | |
set "FLINT_TEST_MULTIPLIER=$env:FLINT_TEST_MULTIPLIER" | |
ctest -j5 --output-on-failure --timeout $env:TIMEOUT | |
shell: powershell | |
############################################################################## | |
# 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: | |
- name: "Rescale multiplier" | |
run: | | |
FLINT_TEST_MULTIPLIER=$(echo "${FLINT_TEST_MULTIPLIER} * ${GLOBAL_MULTIPLIER}" | bc) | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" | |
echo "FLINT_TEST_MULTIPLIER=${FLINT_TEST_MULTIPLIER}" >> $GITHUB_ENV | |
- 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-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-24.04 | |
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-debug | |
- name: "Compile and install" | |
run: | | |
$MAKE | |
$MAKE install | |
- name: "Set up Nemo.jl" | |
run: | | |
# Use Nemo's master branch | |
git clone https://github.com/Nemocas/Nemo.jl.git | |
# Override FLINT_jll's libflint with ours | |
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\")" |