-
-
Notifications
You must be signed in to change notification settings - Fork 123
308 lines (300 loc) Β· 15.6 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
name: ci
on:
push:
branches-ignore:
- gh-pages
pull_request:
branches-ignore:
- gh-pages
jobs:
linux_gcc:
strategy:
matrix:
platform: ['ubuntu-latest']
config: ['Debug', 'Release']
runs-on: ${{ matrix.platform }}
env:
CC: gcc
CXX: g++
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update
sudo apt install asciidoc libxml2-utils xmlto
- name: Build primesieve
run: |
cmake . -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON -DBUILD_MANPAGE=ON -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCMAKE_C_FLAGS="-Wall -Wextra -pedantic -Werror" -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror"
cmake --build . --parallel --verbose
- name: CTest (unit tests)
run: ctest -j2
- name: primesieve --test
run: ./primesieve --test
# Run primesieve binary
- name: primesieve --cpu-info
run: ./primesieve --cpu-info
- name: primesieve 1e10
run: ./primesieve 1e10
- name: primesieve 1e9 --nth-prime
run: ./primesieve 1e9 --nth-prime
- name: primesieve --dist=1e9 --size=32 --print=6
run: ./primesieve 1e13 --dist=1e9 --size=32 --print=6
# Test printing primes and prime k-tuplets
- name: primesieve 1e8 -p | md5sum
run: if [ "$(./primesieve 1e8 -p | md5sum | cut -f1 -d' ')" != "4e2b0027288a27e9c99699364877c9db" ]; then exit 1; fi
- name: primesieve 1e8 -p2 | md5sum
run: if [ "$(./primesieve 1e8 -p2 | md5sum | cut -f1 -d' ')" != "5076d235d5b03389034ec107227eab98" ]; then exit 1; fi
- name: primesieve 1e8 -p3 | md5sum
run: if [ "$(./primesieve 1e8 -p3 | md5sum | cut -f1 -d' ')" != "1b40d7e67868ccc857df11c3e0f7e0f5" ]; then exit 1; fi
- name: primesieve 1e8 -p4 | md5sum
run: if [ "$(./primesieve 1e8 -p4 | md5sum | cut -f1 -d' ')" != "b998d7cdbeae6623cdecba1b921cb2e1" ]; then exit 1; fi
- name: primesieve 1e8 -p5 | md5sum
run: if [ "$(./primesieve 1e8 -p5 | md5sum | cut -f1 -d' ')" != "1ec7d5704d7399caf43667090b5bf836" ]; then exit 1; fi
- name: primesieve 1e8 -p6 | md5sum
run: if [ "$(./primesieve 1e8 -p6 | md5sum | cut -f1 -d' ')" != "0fb813d345c94cf2012588d1f71328b5" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p | md5sum | cut -f1 -d' ')" != "5fbe254a97ad3bbc07c224908c9d59b2" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p2 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p2 | md5sum | cut -f1 -d' ')" != "7a7a770c1841a17a9a63b92b7b6532b9" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p3 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p3 | md5sum | cut -f1 -d' ')" != "72323b08c62ad8342f7331e3d6d45a64" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p4 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p4 | md5sum | cut -f1 -d' ')" != "c2b0818499f77aa35681db3826caf3f6" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p5 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p5 | md5sum | cut -f1 -d' ')" != "11b50e4f75899891a62465f6d68fb76e" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p6 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p6 | md5sum | cut -f1 -d' ')" != "5a0bc83fdef0bb116d60f356adfde52f" ]; then exit 1; fi
linux_clang:
strategy:
matrix:
platform: ['ubuntu-latest']
config: ['Debug', 'Release']
runs-on: ${{ matrix.platform }}
env:
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update
sudo apt install libomp-dev
- name: Build primesieve
run: |
cmake . -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCMAKE_C_FLAGS="-Wall -Wextra -pedantic -Werror" -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror"
cmake --build . --parallel --verbose
- name: CTest (unit tests)
run: ctest -j2
- name: primesieve --test
run: ./primesieve --test
# Run primesieve binary
- name: primesieve --cpu-info
run: ./primesieve --cpu-info
- name: primesieve 1e10
run: ./primesieve 1e10
- name: primesieve 1e9 --nth-prime
run: ./primesieve 1e9 --nth-prime
- name: primesieve --dist=1e9 --size=32 --print=6
run: ./primesieve 1e13 --dist=1e9 --size=32 --print=6
# Test printing primes and prime k-tuplets
- name: primesieve 1e8 -p | md5sum
run: if [ "$(./primesieve 1e8 -p | md5sum | cut -f1 -d' ')" != "4e2b0027288a27e9c99699364877c9db" ]; then exit 1; fi
- name: primesieve 1e8 -p2 | md5sum
run: if [ "$(./primesieve 1e8 -p2 | md5sum | cut -f1 -d' ')" != "5076d235d5b03389034ec107227eab98" ]; then exit 1; fi
- name: primesieve 1e8 -p3 | md5sum
run: if [ "$(./primesieve 1e8 -p3 | md5sum | cut -f1 -d' ')" != "1b40d7e67868ccc857df11c3e0f7e0f5" ]; then exit 1; fi
- name: primesieve 1e8 -p4 | md5sum
run: if [ "$(./primesieve 1e8 -p4 | md5sum | cut -f1 -d' ')" != "b998d7cdbeae6623cdecba1b921cb2e1" ]; then exit 1; fi
- name: primesieve 1e8 -p5 | md5sum
run: if [ "$(./primesieve 1e8 -p5 | md5sum | cut -f1 -d' ')" != "1ec7d5704d7399caf43667090b5bf836" ]; then exit 1; fi
- name: primesieve 1e8 -p6 | md5sum
run: if [ "$(./primesieve 1e8 -p6 | md5sum | cut -f1 -d' ')" != "0fb813d345c94cf2012588d1f71328b5" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p | md5sum | cut -f1 -d' ')" != "5fbe254a97ad3bbc07c224908c9d59b2" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p2 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p2 | md5sum | cut -f1 -d' ')" != "7a7a770c1841a17a9a63b92b7b6532b9" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p3 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p3 | md5sum | cut -f1 -d' ')" != "72323b08c62ad8342f7331e3d6d45a64" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p4 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p4 | md5sum | cut -f1 -d' ')" != "c2b0818499f77aa35681db3826caf3f6" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p5 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p5 | md5sum | cut -f1 -d' ')" != "11b50e4f75899891a62465f6d68fb76e" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p6 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p6 | md5sum | cut -f1 -d' ')" != "5a0bc83fdef0bb116d60f356adfde52f" ]; then exit 1; fi
macos_clang:
strategy:
matrix:
platform: ['macos-latest']
config: ['Debug', 'Release']
runs-on: ${{ matrix.platform }}
env:
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v4
- name: Build primesieve
run: |
cmake . -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCMAKE_INSTALL_PREFIX=$(pwd) -DCMAKE_C_FLAGS="-Wall -Wextra -pedantic -Werror" -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror"
cmake --build . --parallel --verbose
cmake --install .
- name: CTest (unit tests)
run: ctest -j2
- name: primesieve --test
run: ./primesieve --test
# Run primesieve binary
- name: primesieve --cpu-info
run: ./primesieve --cpu-info
- name: primesieve 1e10
run: ./primesieve 1e10
- name: primesieve 1e9 --nth-prime
run: ./primesieve 1e9 --nth-prime
- name: primesieve --dist=1e9 --size=32 --print=6
run: ./primesieve 1e13 --dist=1e9 --size=32 --print=6
# Test printing primes and prime k-tuplets
- name: primesieve 1e8 -p | md5
run: if [ "$(./primesieve 1e8 -p | md5 | cut -f1 -d' ')" != "4e2b0027288a27e9c99699364877c9db" ]; then exit 1; fi
- name: primesieve 1e8 -p2 | md5
run: if [ "$(./primesieve 1e8 -p2 | md5 | cut -f1 -d' ')" != "5076d235d5b03389034ec107227eab98" ]; then exit 1; fi
- name: primesieve 1e8 -p3 | md5
run: if [ "$(./primesieve 1e8 -p3 | md5 | cut -f1 -d' ')" != "1b40d7e67868ccc857df11c3e0f7e0f5" ]; then exit 1; fi
- name: primesieve 1e8 -p4 | md5
run: if [ "$(./primesieve 1e8 -p4 | md5 | cut -f1 -d' ')" != "b998d7cdbeae6623cdecba1b921cb2e1" ]; then exit 1; fi
- name: primesieve 1e8 -p5 | md5
run: if [ "$(./primesieve 1e8 -p5 | md5 | cut -f1 -d' ')" != "1ec7d5704d7399caf43667090b5bf836" ]; then exit 1; fi
- name: primesieve 1e8 -p6 | md5
run: if [ "$(./primesieve 1e8 -p6 | md5 | cut -f1 -d' ')" != "0fb813d345c94cf2012588d1f71328b5" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p | md5
run: if [ "$(./primesieve 1e10 -d1e8 -p | md5 | cut -f1 -d' ')" != "5fbe254a97ad3bbc07c224908c9d59b2" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p2 | md5
run: if [ "$(./primesieve 1e10 -d1e8 -p2 | md5 | cut -f1 -d' ')" != "7a7a770c1841a17a9a63b92b7b6532b9" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p3 | md5
run: if [ "$(./primesieve 1e10 -d1e8 -p3 | md5 | cut -f1 -d' ')" != "72323b08c62ad8342f7331e3d6d45a64" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p4 | md5
run: if [ "$(./primesieve 1e10 -d1e8 -p4 | md5 | cut -f1 -d' ')" != "c2b0818499f77aa35681db3826caf3f6" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p5 | md5
run: if [ "$(./primesieve 1e10 -d1e8 -p5 | md5 | cut -f1 -d' ')" != "11b50e4f75899891a62465f6d68fb76e" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p6 | md5
run: if [ "$(./primesieve 1e10 -d1e8 -p6 | md5 | cut -f1 -d' ')" != "5a0bc83fdef0bb116d60f356adfde52f" ]; then exit 1; fi
# See documentation: https://www.msys2.org/docs/ci/
windows_mingw64:
strategy:
matrix:
platform: ['windows-latest']
config: ['Debug', 'Release']
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
update: true
install: base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
- name: Build primesieve
run: |
cmake . -G "Unix Makefiles" -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{matrix.config}} -DCMAKE_C_FLAGS="-Wall -Wextra -pedantic -Werror" -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror"
cmake --build . --parallel --verbose
- name: CTest (unit tests)
run: ctest -j2
- name: primesieve --test
run: ./primesieve --test
# Run primesieve binary
- name: primesieve --cpu-info
run: ./primesieve --cpu-info
- name: primesieve 1e10
run: ./primesieve 1e10
- name: primesieve 1e9 --nth-prime
run: ./primesieve 1e9 --nth-prime
- name: primesieve --dist=1e9 --size=32 --print=6
run: ./primesieve 1e13 --dist=1e9 --size=32 --print=6
windows_msvc2022:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Build primesieve
run: |
cmake . -G "Visual Studio 17 2022" -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS="/W3 /WX /MP /EHsc"
cmake --build . --config Release --target install
- name: CTest (unit tests)
run: ctest -j2 -C Release --output-on-failure
- name: primesieve --test
run: Release\primesieve.exe --test
- name: primesieve --cpu-info
run: Release\primesieve.exe --cpu-info
- name: primesieve --print
run: Release\primesieve.exe 1000 --print
linux_gcc_sanitizers:
runs-on: ubuntu-latest
env:
CC: gcc
CXX: g++
steps:
- uses: actions/checkout@v4
- name: Build primesieve
run: |
cmake . -DBUILD_TESTS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Wall -Wextra -pedantic -Werror -O1 -g -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror -O1 -g -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer"
cmake --build . --parallel --verbose
- name: CTest (unit tests)
run: ctest -j2
- name: primesieve --test
run: ./primesieve --test
# Run primesieve binary
- name: primesieve --cpu-info
run: ./primesieve --cpu-info
- name: primesieve 1e10
run: ./primesieve 1e10
- name: primesieve 1e9 --nth-prime
run: ./primesieve 1e9 --nth-prime
- name: primesieve --dist=1e9 --size=32 --print=6
run: ./primesieve 1e13 --dist=1e9 --size=32 --print=6
# Test printing primes and prime k-tuplets
- name: primesieve 1e8 -p | md5sum
run: if [ "$(./primesieve 1e8 -p | md5sum | cut -f1 -d' ')" != "4e2b0027288a27e9c99699364877c9db" ]; then exit 1; fi
- name: primesieve 1e8 -p2 | md5sum
run: if [ "$(./primesieve 1e8 -p2 | md5sum | cut -f1 -d' ')" != "5076d235d5b03389034ec107227eab98" ]; then exit 1; fi
- name: primesieve 1e8 -p3 | md5sum
run: if [ "$(./primesieve 1e8 -p3 | md5sum | cut -f1 -d' ')" != "1b40d7e67868ccc857df11c3e0f7e0f5" ]; then exit 1; fi
- name: primesieve 1e8 -p4 | md5sum
run: if [ "$(./primesieve 1e8 -p4 | md5sum | cut -f1 -d' ')" != "b998d7cdbeae6623cdecba1b921cb2e1" ]; then exit 1; fi
- name: primesieve 1e8 -p5 | md5sum
run: if [ "$(./primesieve 1e8 -p5 | md5sum | cut -f1 -d' ')" != "1ec7d5704d7399caf43667090b5bf836" ]; then exit 1; fi
- name: primesieve 1e8 -p6 | md5sum
run: if [ "$(./primesieve 1e8 -p6 | md5sum | cut -f1 -d' ')" != "0fb813d345c94cf2012588d1f71328b5" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p | md5sum | cut -f1 -d' ')" != "5fbe254a97ad3bbc07c224908c9d59b2" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p2 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p2 | md5sum | cut -f1 -d' ')" != "7a7a770c1841a17a9a63b92b7b6532b9" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p3 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p3 | md5sum | cut -f1 -d' ')" != "72323b08c62ad8342f7331e3d6d45a64" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p4 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p4 | md5sum | cut -f1 -d' ')" != "c2b0818499f77aa35681db3826caf3f6" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p5 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p5 | md5sum | cut -f1 -d' ')" != "11b50e4f75899891a62465f6d68fb76e" ]; then exit 1; fi
- name: primesieve 1e10 -d1e8 -p6 | md5sum
run: if [ "$(./primesieve 1e10 -d1e8 -p6 | md5sum | cut -f1 -d' ')" != "5a0bc83fdef0bb116d60f356adfde52f" ]; then exit 1; fi
linux_gcc_valgrind:
runs-on: ubuntu-latest
env:
CC: gcc
CXX: g++
steps:
- uses: actions/checkout@v4
- name: Install valgrind
run: |
sudo apt update
sudo apt install valgrind
- name: Build primesieve
run: |
cmake . -DBUILD_TESTS=ON -DCMAKE_C_FLAGS="-Wall -Wextra -pedantic -Werror -g" -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror -g"
cmake --build . --parallel --verbose
- name: CTest (unit tests)
run: ctest -j2
- name: primesieve --test
run: ./primesieve --test
- name: Valgrind primesieve --count
run: valgrind --error-exitcode=1 ./primesieve 1e9
- name: Valgrind primesieve --nth-prime
run: valgrind --error-exitcode=1 ./primesieve 1e7 --nth-prime
- name: Valgrind primesieve --print
run: valgrind --error-exitcode=1 ./primesieve 10000 --print