-
Notifications
You must be signed in to change notification settings - Fork 3
223 lines (203 loc) · 7.15 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
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/-j/-O -j/' makemake.sh
$CC --version
- name: Script
run: |
set -x
set -o pipefail
lscpu
cat /proc/cpuinfo
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
cd obj
echo -e '## Warnings\n```' >> $GITHUB_STEP_SUMMARY
grep 'warning:' 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 h; do time ./Mlucas -s $s -cpu "0:$(( $(nproc --all) - 1 ))" |& tee -a test.log; done
- uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.os }}_${{ matrix.cc }}_mlucas
path: ${{ github.workspace }}
ASan-Linux:
name: AddressSanitizer Linux
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.cc == 'clang' }}
strategy:
matrix:
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
sed -i 's/-j/-O -j/' makemake.sh
$CC --version
- name: Script
run: |
set -x
bash -e -o pipefail -- makemake.sh
cd obj
make clean
time ./Mlucas -s m -cpu "0:$(( $(nproc --all) - 1 ))"
continue-on-error: true
TSan-Linux:
name: ThreadSanitizer Linux
runs-on: ubuntu-latest
strategy:
matrix:
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=thread/' makemake.sh
sed -i 's/-j/-O -j/' makemake.sh
$CC --version
- name: Script
run: |
set -x
bash -e -o pipefail -- makemake.sh
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]\+\)*\)\?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
set -o pipefail
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 -j "$(nproc)" --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: 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: Script
run: |
set -x
set -o pipefail
sysctl -a
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
cd obj
echo -e '## Warnings\n```' >> $GITHUB_STEP_SUMMARY
grep 'warning:' 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 h; do time ./Mlucas -s $s -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))" 2>&1 | tee -a test.log; done
- uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.os }}_mlucas
path: ${{ github.workspace }}
ASan-macOS:
name: AddressSanitizer macOS
runs-on: macos-13
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
time ./Mlucas -s m -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))"
continue-on-error: true
TSan-macOS:
name: ThreadSanitizer macOS
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Before script
run: |
sed -i '' 's/-O3/-Og -fsanitize=thread/' makemake.sh
- name: Script
run: |
set -x
bash -e -o pipefail -- makemake.sh
cd obj
make clean
time ./Mlucas -s m -cpu "0:$(( $(sysctl -n hw.ncpu) - 1 ))"
continue-on-error: true