CI #212
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: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: '0 0 1 * *' | |
jobs: | |
Linux: | |
name: Mlucas Linux | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] | |
cc: [gcc, clang] | |
fail-fast: false | |
env: | |
CC: ${{ matrix.cc }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y libhwloc-dev | |
- name: Before script | |
run: | | |
$CC --version | |
$CC -dM -E -march=native - </dev/null | |
- name: Script | |
run: | | |
set -x | |
set -o pipefail | |
lscpu | |
cat /proc/cpuinfo | |
for mode in '' NOSIMD SSE2 AVX AVX2 AVX512; do | |
echo -e "\n$mode\n" | |
bash -e -o pipefail -- makemake.sh use_hwloc $mode | |
(cd obj${mode:+_$mode}; make clean) | |
for word in '' 1word 2word 3word 4word nword; do | |
echo -e "\nMfactor $word\n" | |
bash -e -o pipefail -- makemake.sh mfac $word $mode || true | |
( | |
cd obj_mfac${mode:+_$mode} | |
make clean | |
mv -v build.log build_${word}.log | |
[[ ! -x Mfactor${word:+_$word} ]] || ./Mfactor${word:+_$word} -h | |
) | |
done | |
done | |
cd obj | |
echo -e '## Warnings\n```' >> $GITHUB_STEP_SUMMARY | |
grep 'warning:' build.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?[mK]//g' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
for s in tt t s m l; do time ./Mlucas -s $s -cpu "0:$(( $(nproc --all) - 1 ))" |& tee -a test.log; done | |
bash -- ../config-fermat.sh -cpu "0:$(( $(nproc --all) - 1 ))" | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: ${{ matrix.os }}_${{ matrix.cc }}_mlucas | |
path: ${{ github.workspace }} | |
Singlethread-Linux: | |
name: Mlucas Singlethreaded Linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
cc: [gcc] | |
fail-fast: false | |
env: | |
CC: ${{ matrix.cc }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Before script | |
run: | | |
sed -i 's/-DUSE_THREADS//' makemake.sh | |
sed -i 's/^MAX=29/MAX=28/' config-fermat.sh | |
$CC --version | |
- name: Script | |
run: | | |
set -x | |
for mode in '' NOSIMD SSE2 AVX AVX2 AVX512; do | |
echo -e "\n$mode\n" | |
bash -e -o pipefail -- makemake.sh $mode | |
(cd obj${mode:+_$mode}; make clean) | |
for word in '' 1word 2word 3word 4word nword; do | |
echo -e "\nMfactor $word\n" | |
bash -e -o pipefail -- makemake.sh mfac $word $mode || true | |
( | |
cd obj_mfac${mode:+_$mode} | |
make clean | |
mv -v build.log build_${word}.log | |
[[ ! -x Mfactor${word:+_$word} ]] || ./Mfactor${word:+_$word} -h | |
) | |
done | |
done | |
cd obj | |
time ./Mlucas -s m | |
bash -- ../config-fermat.sh | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: ubuntu_${{ matrix.cc }}_singlethreaded_mlucas | |
path: ${{ github.workspace }} | |
ASan-Linux: | |
name: AddressSanitizer Linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
cc: [gcc, clang] | |
fail-fast: false | |
env: | |
CC: ${{ matrix.cc }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y libhwloc-dev | |
- name: Before script | |
run: | | |
sed -i 's/-O3/-Og -fsanitize=address,undefined/' makemake.sh | |
$CC --version | |
- name: Script | |
run: | | |
set -x | |
bash -e -o pipefail -- makemake.sh use_hwloc | |
cd obj | |
make clean | |
time ./Mlucas -s m -cpu "0:$(( $(nproc --all) - 1 ))" | |
bash -- ../config-fermat.sh -cpu "0:$(( $(nproc --all) - 1 ))" | |
continue-on-error: true | |
TSan-Linux: | |
name: ThreadSanitizer Linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
cc: [gcc, clang] | |
exclude: | |
- cc: gcc # Too slow | |
fail-fast: false | |
env: | |
CC: ${{ matrix.cc }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y libhwloc-dev | |
- name: Before script | |
run: | | |
sed -i 's/-O3/-Og -fsanitize=thread/' makemake.sh | |
$CC --version | |
- name: Script | |
run: | | |
set -x | |
bash -e -o pipefail -- makemake.sh use_hwloc | |
cd obj | |
make clean | |
time ./Mlucas -s m -cpu "0:$(( $(nproc --all) - 1 ))" | |
continue-on-error: true | |
GCC-analyzer: | |
name: GCC analyzer | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: GCC analyzer | |
run: | | |
set -x | |
set -o pipefail | |
gcc -c -fdiagnostics-color -g -O3 -march=native -DUSE_THREADS -fanalyzer src/*.c |& tee analyzer.log | |
rm -- *.o | |
echo -e '## GCC analyzer\n```' >> $GITHUB_STEP_SUMMARY | |
grep 'warning:' analyzer.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?[mK]//g' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
Clang-Tidy: | |
name: Clang-Tidy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y libhwloc-dev | |
- name: Clang-Tidy | |
run: | | |
set -x | |
set -o pipefail | |
clang-tidy --use-color -checks='bugprone-*,-bugprone-reserved-identifier,cert-*,clang-analyzer-*,concurrency-*,misc-*,-misc-no-recursion,-misc-confusable-identifiers,performance-*,portability-*,readability-const-return-type,readability-container-*,readability-duplicate-include,readability-else-after-return,readability-make-member-function-cons,readability-non-const-parameter,readability-redundant-*,readability-simplify-*,readability-string-compare,readability-use-*' -header-filter='.*' src/*.c -- -Wall -O3 -march=native -DUSE_THREADS -DINCLUDE_HWLOC=1 |& tee clang-tidy.log | |
echo -e '## Clang-Tidy\n```' >> $GITHUB_STEP_SUMMARY | |
grep 'warning:' clang-tidy.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?[mK]//g' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
Cppcheck: | |
name: Cppcheck | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y cppcheck libhwloc-dev | |
- name: Cppcheck | |
run: | | |
mkdir build | |
cppcheck --enable=all -DUSE_THREADS -DINCLUDE_HWLOC=1 --force --cppcheck-build-dir=build -j "$(nproc)" --clang . | |
cppcheck --enable=all -DUSE_THREADS -DINCLUDE_HWLOC=1 --force --cppcheck-build-dir=build --clang . &> cppcheck.log | |
echo -e '## Cppcheck\n```' >> $GITHUB_STEP_SUMMARY | |
grep '\(error\|warning\|style\|performance\|portability\|information\):' cppcheck.log | awk '{ print $2, $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
ShellCheck: | |
name: ShellCheck | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ShellCheck | |
run: shopt -s globstar; shellcheck -o avoid-nullary-conditions,check-extra-masked-returns,check-set-e-suppressed,deprecate-which,quote-safe-variables,require-double-brackets -s bash **/*.sh | |
continue-on-error: true | |
macOS: | |
name: Mlucas macOS | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-12, macos-13, macos-14, macos-15] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
brew install hwloc | |
- name: Before script | |
run: | | |
clang --version | |
clang -dM -E -march=native - </dev/null | |
- name: Script | |
run: | | |
set -x | |
set -o pipefail | |
sysctl -a | |
MODES=( '' NOSIMD ) | |
if (( $(sysctl -n hw.optional.AdvSIMD) )); then | |
MODES+=( ASIMD ) | |
else | |
MODES+=( SSE2 AVX AVX2 AVX512 ) | |
fi | |
for mode in "${MODES[@]}"; do | |
echo -e "\n$mode\n" | |
bash -e -o pipefail -- makemake.sh use_hwloc $mode | |
(cd obj${mode:+_$mode}; make clean) | |
for word in '' 1word 2word 3word 4word nword; do | |
echo -e "\nMfactor $word\n" | |
bash -e -o pipefail -- makemake.sh mfac $word $mode || true | |
( | |
cd obj_mfac${mode:+_$mode} | |
make clean | |
mv -v build.log build_${word}.log | |
[[ ! -x Mfactor${word:+_$word} ]] || ./Mfactor${word:+_$word} -h | |
) | |
done | |
done | |
cd obj | |
echo -e '## Warnings\n```' >> $GITHUB_STEP_SUMMARY | |
grep 'warning:' build.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?[mK]//g' | grep -v '^ld:' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
for s in tt t s m l; do time ./Mlucas -s $s -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))" 2>&1 | tee -a test.log; done | |
if (( $(sysctl -n hw.optional.AdvSIMD) )); then | |
cd ../obj_NOSIMD | |
fi | |
bash -- ../config-fermat.sh -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))" | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: ${{ matrix.os }}_mlucas | |
path: ${{ github.workspace }} | |
Singlethread-macOS: | |
name: Mlucas Singlethreaded macOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Before script | |
run: | | |
sed -i '' 's/-DUSE_THREADS//' makemake.sh | |
sed -i '' 's/^MAX=29/MAX=28/' config-fermat.sh | |
clang --version | |
- name: Script | |
run: | | |
set -x | |
for mode in '' NOSIMD ASIMD; do | |
echo -e "\n$mode\n" | |
bash -e -o pipefail -- makemake.sh $mode | |
(cd obj${mode:+_$mode}; make clean) | |
for word in '' 1word 2word 3word 4word nword; do | |
echo -e "\nMfactor $word\n" | |
bash -e -o pipefail -- makemake.sh mfac $word $mode || true | |
( | |
cd obj_mfac${mode:+_$mode} | |
make clean | |
mv -v build.log build_${word}.log | |
[[ ! -x Mfactor${word:+_$word} ]] || ./Mfactor${word:+_$word} -h | |
) | |
done | |
done | |
cd obj | |
time ./Mlucas -s m | |
if (( $(sysctl -n hw.optional.AdvSIMD) )); then | |
cd ../obj_NOSIMD | |
fi | |
bash -- ../config-fermat.sh | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: macos_singlethreaded_mlucas | |
path: ${{ github.workspace }} | |
ASan-macOS: | |
name: AddressSanitizer macOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
brew install hwloc | |
- name: Before script | |
run: | | |
sed -i '' 's/-O3/-Og -fsanitize=address,undefined/' makemake.sh | |
clang --version | |
- name: Script | |
run: | | |
set -x | |
bash -e -o pipefail -- makemake.sh use_hwloc | |
cd obj | |
make clean | |
time ./Mlucas -s m -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))" | |
if ! (( $(sysctl -n hw.optional.AdvSIMD) )); then | |
bash -- ../config-fermat.sh -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))" | |
fi | |
continue-on-error: true | |
TSan-macOS: | |
name: ThreadSanitizer macOS | |
if: false # Too slow | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
brew install hwloc | |
- name: Before script | |
run: | | |
sed -i '' 's/-O3/-Og -fsanitize=thread/' makemake.sh | |
clang --version | |
- name: Script | |
run: | | |
set -x | |
bash -e -o pipefail -- makemake.sh use_hwloc | |
cd obj | |
make clean | |
time ./Mlucas -s m -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))" | |
continue-on-error: true | |
Windows: | |
name: Windows | |
runs-on: windows-latest | |
continue-on-error: true | |
strategy: | |
matrix: | |
cc: [gcc, clang] | |
fail-fast: false | |
env: | |
CC: ${{ matrix.cc }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Before Install | |
run: | | |
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "CPPFLAGS=-IC:\msys64\mingw64\include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
echo "LDFLAGS=-LC:\msys64\mingw64\lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Install | |
run: | | |
pacman -S --noconfirm mingw-w64-x86_64-gmp mingw-w64-x86_64-hwloc | |
& $env:CC --version | |
- name: Install Clang | |
if: ${{ matrix.cc == 'clang' }} | |
run: | | |
pacman -S --noconfirm mingw-w64-x86_64-clang | |
- name: Before script | |
shell: bash | |
run: | | |
$CC --version | |
$CC -dM -E -march=native - </dev/null | |
- name: Script | |
shell: bash | |
run: | | |
set -x | |
for mode in '' NOSIMD SSE2 AVX AVX2 AVX512; do | |
echo -e "\n$mode\n" | |
bash -e -o pipefail -- makemake.sh use_hwloc $mode | |
(cd obj${mode:+_$mode}; make clean) | |
for word in '' 1word 2word 3word 4word nword; do | |
echo -e "\nMfactor $word\n" | |
bash -e -o pipefail -- makemake.sh mfac $word $mode || true | |
( | |
cd obj_mfac${mode:+_$mode} | |
make clean | |
mv -v build.log build_${word}.log | |
[[ ! -x Mfactor${word:+_$word} ]] || ./Mfactor${word:+_$word} -h | |
) | |
done | |
done | |
cd obj | |
for s in tt t s m l; do time ./Mlucas -s $s -cpu "0:$(( NUMBER_OF_PROCESSORS - 1 ))" |& tee -a test.log; done | |
bash -- ../config-fermat.sh -cpu "0:$(( NUMBER_OF_PROCESSORS - 1 ))" | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: windows_${{ matrix.cc }}_mlucas | |
path: ${{ github.workspace }} | |
ASan-Windows: | |
name: AddressSanitizer Windows | |
runs-on: windows-latest | |
continue-on-error: true | |
env: | |
CC: clang | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Before Install | |
run: | | |
echo "C:\msys64\clang64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "CPPFLAGS=-IC:\msys64\clang64\include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
echo "LDFLAGS=-LC:\msys64\clang64\lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Install | |
run: | | |
pacman -S --noconfirm mingw-w64-clang-x86_64-toolchain | |
pacman -S --noconfirm mingw-w64-clang-x86_64-gmp mingw-w64-clang-x86_64-hwloc | |
- name: Before script | |
shell: bash | |
run: | | |
sed -i 's/-O3/-Og -fsanitize=address,undefined/' makemake.sh | |
$CC --version | |
- name: Script | |
shell: bash | |
run: | | |
set -x | |
bash -e -o pipefail -- makemake.sh use_hwloc | |
cd obj | |
make clean | |
time ./Mlucas -s m -cpu "0:$(( NUMBER_OF_PROCESSORS - 1 ))" |& tee -a test.log | |
bash -- ../config-fermat.sh -cpu "0:$(( NUMBER_OF_PROCESSORS - 1 ))" |