Skip to content

Commit

Permalink
Added CI and updated makemake.sh script.
Browse files Browse the repository at this point in the history
  • Loading branch information
tdulcet committed Oct 20, 2023
1 parent 039e912 commit 40e3f66
Show file tree
Hide file tree
Showing 2 changed files with 327 additions and 66 deletions.
128 changes: 128 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: CI
on:
push:
pull_request:
schedule:
- cron: '0 0 1 * *'

jobs:
Linux:
name: Mlucas Linux

runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.cc == 'clang' }}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
cc: [gcc, clang]
fail-fast: false
env:
CC: ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
- 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
(cd obj; make clean)
for arg in '' '1word' '2word' '3word' '4word' 'nword'; do echo -e "\nMfactor $arg\n"; bash -e -o pipefail -- makemake.sh mfac $arg; (cd obj_mfac; make clean); done
echo -e '## Warnings\n```' >> $GITHUB_STEP_SUMMARY
grep 'warning:' obj/build.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?m//g' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
for s in t s m l; do time ./Mlucas -s $s -cpu "0:$(nproc --all)" |& tee -a test.log | grep -i 'error\|warn\|info'; done
- uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.os }}_${{ matrix.cc }}_mlucas
path: ${{ github.workspace }}

GCC-analyzer:
name: GCC analyzer

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: GCC analyzer
run: |
set -x
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]\+\)*\)\?m//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: Clang-Tidy
run: |
set -x
clang-tidy --use-color -checks='bugprone-*,cert-*,clang-analyzer-*,concurrency-*,misc-const-correctness,misc-redundant-expression,misc-unused-*,modernize-*,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-anyofallof' -header-filter='.*' src/*.c -- -Wall -O3 -march=native -DUSE_THREADS |& tee clang-tidy.log
echo -e '## Clang-Tidy\n```' >> $GITHUB_STEP_SUMMARY
grep 'warning:' clang-tidy.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?m//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 -yqq update
sudo apt-get -yqq install cppcheck
- name: Cppcheck
run: |
mkdir build
cppcheck --enable=all -DUSE_THREADS --force --cppcheck-build-dir=build --clang .
cppcheck --enable=all -DUSE_THREADS --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: bash -c '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-11, macos-12, macos-13]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Before script
run: |
sed -i '' 's/-O3/-Og -fsanitize=address,undefined/' makemake.sh
- name: Script
run: |
set -x
bash -e -o pipefail -- makemake.sh
(cd obj; make clean)
for arg in '' '1word' '2word' '3word' '4word' 'nword'; do echo -e "\nMfactor $arg\n"; bash -e -o pipefail -- makemake.sh mfac $arg; (cd obj_mfac; make clean); done
echo -e '## Warnings\n```' >> $GITHUB_STEP_SUMMARY
grep 'warning:' obj/build.log | sed 's/\x1B\[\([0-9]\+\(;[0-9]\+\)*\)\?m//g' | awk '{ print $NF }' | sort | uniq -c | sort -nr >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
for s in t s m l; do time ./Mlucas -s $s -cpu "0:$(sysctl -n hw.ncpu)" |& tee -a test.log | grep -i 'error\|warn\|info'; done
- uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.os }}_mlucas
path: ${{ github.workspace }}
Loading

0 comments on commit 40e3f66

Please sign in to comment.