-
Notifications
You must be signed in to change notification settings - Fork 57
542 lines (450 loc) · 16.7 KB
/
test-library.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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
name: "Library"
on:
push:
jobs:
basicchecks:
name: Basic checks
runs-on: ubuntu-latest
outputs:
hassecrets: ${{ steps.checksecrets.outputs.hassecrets }}
env:
CCACHE: ccache
CCACHE_DIR: ${{ github.workspace }}/ccache
steps:
- name: Checkout Colvars
uses: actions/checkout@v4
- name: Load compiler cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-build-basic-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-basic-
- name: Get small downloadable packages
uses: actions/checkout@v4
with:
repository: 'Colvars/build-tools-packages'
ref: 'master'
path: 'devel-tools/packages'
- name: Install build dependencies for library
run: |
sudo apt -y install ccache tcl8.6-dev clang
- name: Test build recipes
run: bash devel-tools/check_build_recipes
- name: Convert BibTeX references to code
shell: bash
working-directory: doc
run: |
make update-code-refs
if [ -n "$(git status --porcelain ../src/colvarmodule_refs.h)" ] ; then
echo "Code citations out of date; please run make update-code-refs in the doc folder" >& 2
exit 1
fi
- name: Build and test library (GCC)
run: cmake -P devel-tools/build_test_library.cmake
- name: Check documentation of command-line scripting interface
shell: bash
working-directory: doc
run: |
make update-cvscript-cmdline-doc
if [ -n "$(git status --porcelain cvscript-tcl.tex)" ] ; then
echo "Command-line scripting doc out of date; please run make update-cvscript-cmdline-doc and commit changes" >& 2
exit 1
fi
- name: Build and test library (Clang)
env:
CMAKE_BUILD_DIR: build-clang
CXX: clang++
CC: clang
run: cmake -P devel-tools/build_test_library.cmake
- name: Build library with debug code enabled (GCC)
run: cmake -D COLVARS_DEBUG=ON -P devel-tools/build_test_library.cmake
- name: Check whether secrets are available
id: checksecrets
env:
PULL_ORACLE_DEVELOPER_STUDIO: ${{ secrets.PULL_ORACLE_DEVELOPER_STUDIO }}
run: |
echo "hassecrets=${{ env.PULL_ORACLE_DEVELOPER_STUDIO != '' }}" >> $GITHUB_OUTPUT
- name: Print ccache stats
run: ccache -s -v
- name: Keep only one cache besides the one from this job
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
bash ${{ github.workspace }}/devel-tools/cleanup-gh-cache.sh ${{ runner.os }}-build-basic-
build-doc:
name: Build documentation
runs-on: ubuntu-latest
needs: basicchecks
steps:
- uses: actions/checkout@v4
- name: Install Apptainer
shell: bash
run: |
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer-suid
- name: Get container image
shell: bash
working-directory: devel-tools
run: |
apptainer pull texlive.sif oras://ghcr.io/colvars/devel-containers:texlive
- name: Checkout website repository
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.PULL_PUSH_COLVARS_GITHUB_IO }}
repository: 'Colvars/colvars.github.io'
path: 'website'
- name: Build doc for current branch
working-directory: doc
run: |
make clean-all
apptainer exec ${{ github.workspace }}/devel-tools/texlive.sif make
- name: Install SSH key for access to website repository
if: contains(github.event.head_commit.message, '[update-doc]')
env:
WEBSITE_SSH_KEY: ${{ secrets.PULL_PUSH_COLVARS_GITHUB_IO }}
run: |
mkdir -p -m 700 ~/.ssh
echo "${WEBSITE_SSH_KEY}" > ~/.ssh/website
chmod 600 ~/.ssh/website
- name: Push updated doc to website repository
working-directory: doc
if: contains(github.event.head_commit.message, '[update-doc]')
env:
COLVARS_WEBSITE_TREE: ${{ github.workspace }}/website
run: |
apptainer exec ${{ github.workspace }}/devel-tools/texlive.sif make install
export GIT_SSH="ssh -i ~/.ssh/website"
git config --global user.email "[email protected]"
git config --global user.name "CI runner"
bash update_website.sh ${{ github.workspace }}/website
codeql:
name: CodeQL analysis
runs-on: ubuntu-latest
needs: basicchecks
if: ${{ ! github.event.repository.private }}
steps:
- uses: actions/checkout@v4
- name: Install build dependencies for library
run: |
sudo apt-get -y install tcl8.6-dev
- name: Checkout OpenMM (for Lepton library)
uses: actions/checkout@v4
with:
repository: 'openmm/openmm'
ref: 'master'
path: 'openmm-source'
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: cpp
- name: Build Colvars library with CMake
run: cmake -P devel-tools/build_test_library.cmake
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
static-analyser:
name: Clang 14 Static Analyser
runs-on: ubuntu-latest
needs: basicchecks
steps:
- uses: actions/checkout@v4
- name: Install build dependencies for library
run: |
sudo apt -y install tcl8.6-dev clang-14 clang-tools-14
- name: Checkout OpenMM (for Lepton library)
uses: actions/checkout@v4
with:
repository: 'openmm/openmm'
ref: 'master'
path: 'openmm-source'
- name: Perform Clang Static Analyser
env:
CXX: clang++-14
CC: clang-14
run: |
scan-build-14 --use-cc=clang-14 --use-c++=clang++-14 cmake -P devel-tools/build_test_library.cmake 2>&1 | tee build_analyser.log
grep "CMake Error" build_analyser.log > build_errors.log || true
if [ -s build_errors.log ] ; then
echo "Found compiler errors during build"
cat build_analyser.log
exit 1
fi
- name: Analyze logs
run: | # Retrieve warnings generated but not the ones of OpenMM
awk '/colvars\/colvars\/[^openmm].*warning:/,/warning.*generated|^$/' build_analyser.log | tee warnings_analyser.log || true
if [ -s warnings_analyser.log ] ; then
echo "Found compiler warning during build"
exit 1
fi
- name: Archive warnings artifacts
uses: actions/upload-artifact@v3
if: failure()
with:
name: warnings_clang_static_analyser
path: warnings_analyser.log
address-sanitizer:
name: Clang 16 address sanitizer
runs-on: ubuntu-latest
needs: basicchecks
env:
CCACHE: ccache
CCACHE_DIR: ${{ github.workspace }}/ccache
steps:
- uses: actions/checkout@v4
- name: Load compiler ccache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-build-asan-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-asan-
- name: Checkout OpenMM (for Lepton library)
uses: actions/checkout@v4
with:
repository: 'openmm/openmm'
ref: 'master'
path: 'openmm-source'
- name: Install Apptainer
shell: bash
run: |
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer-suid
- name: Get container images for build dependencies
shell: bash
working-directory: devel-tools
run: |
apptainer pull CentOS9-devel.sif oras://ghcr.io/colvars/devel-containers:CentOS9-devel
- name: Build with Clang 16 and address sanitizer
env:
CXX: clang++
CC: clang
CMAKE_ADDRESS_SANITIZER: ON
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \
cmake -P devel-tools/build_test_library.cmake
- name: Archive warnings artifacts
uses: actions/upload-artifact@v3
if: failure()
with:
name: Clang_address_sanitizer_output
path: ${{github.workspace}}/build/Testing/Temporary/LastTest.log
- name: Keep only one cache besides the one from this job
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
bash ${{ github.workspace }}/devel-tools/cleanup-gh-cache.sh ${{ runner.os }}-build-asan-
build-linux-x86_64-many:
name: Linux x86_64 (GCC, Clang)
runs-on: ubuntu-latest
needs: basicchecks
env:
CCACHE: ccache
CMAKE_GENERATOR: Ninja
CCACHE_DIR: ${{ github.workspace }}/ccache
steps:
- uses: actions/checkout@v4
- name: Load compiler ccache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/ccache
key: ${{ runner.os }}-build-multiple-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-multiple-
- name: Get small downloadable packages
uses: actions/checkout@v4
with:
repository: 'Colvars/build-tools-packages'
ref: 'master'
path: 'devel-tools/packages'
- name: Install Apptainer
shell: bash
run: |
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer-suid
- name: Get container images for build dependencies
shell: bash
working-directory: devel-tools
run: |
apptainer pull CentOS7-devel.sif oras://ghcr.io/colvars/devel-containers:CentOS7-devel
apptainer pull CentOS9-devel.sif oras://ghcr.io/colvars/devel-containers:CentOS9-devel
- name: GCC 4.8, C++11 (CentOS 7)
env:
CXX_STANDARD: 11
CXX: g++
CXX_VERSION: 4.8
CC: gcc
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake
- name: Clang 3.4, C++11 (CentOS 7)
env:
CXX_STANDARD: 11
CXX: clang++
CXX_VERSION: 11
CC: clang
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake
- name: Clang 7, C++17 (CentOS 7)
env:
CXX_STANDARD: 17
CXX: clang++
CXX_VERSION: 7
CC: clang
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \
scl enable llvm-toolset-${CXX_VERSION} -- \
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake
- name: GCC 8, C++17 (CentOS 7)
env:
CXX_STANDARD: 17
CXX: g++
CXX_VERSION: 8
CC: gcc
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \
scl enable devtoolset-${CXX_VERSION} -- \
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake
- name: GCC 9, C++14 (CentOS 7)
env:
CXX_STANDARD: 14
CXX: g++
CXX_VERSION: 9
CC: gcc
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \
scl enable devtoolset-${CXX_VERSION} -- \
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake
- name: GCC 10, C++17 (CentOS 7)
env:
CXX_STANDARD: 17
CXX: g++
CXX_VERSION: 10
CC: gcc
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \
scl enable devtoolset-${CXX_VERSION} -- \
cmake3 -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake
- name: GCC 11, C++11 (CentOS 9)
env:
CXX_STANDARD: 11
CXX: g++
CXX_VERSION: 11
CC: gcc
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \
cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake
- name: GCC 11, C++20 (CentOS 9)
env:
CXX_STANDARD: 20
CXX: g++
CXX_VERSION: 11
CC: gcc
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \
cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake
- name: GCC 12, C++20 (CentOS 9)
env:
CXX_STANDARD: 20
CXX: g++
CXX_VERSION: 12
CC: gcc
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \
scl enable gcc-toolset-12 -- \
cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake
- name: Clang 16, C++11 (CentOS 9)
env:
CXX_STANDARD: 11
CXX: clang++
CXX_VERSION: 16
CC: clang
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \
cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake
- name: Clang 16, C++20 (CentOS 9)
env:
CXX_STANDARD: 20
CXX: clang++
CXX_VERSION: 16
CC: clang
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS9-devel.sif \
cmake -D CMAKE_CXX_STANDARD=${CXX_STANDARD} -P devel-tools/build_test_library.cmake
- name: Keep only one cache besides the one from this job
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
bash ${{ github.workspace }}/devel-tools/cleanup-gh-cache.sh Linux-build-multiple-
build-linux-x86_64-sun:
name: Linux x86_64 (Sun compiler)
runs-on: ubuntu-latest
needs: basicchecks
if: needs.basicchecks.outputs.hassecrets == 'true'
steps:
- uses: actions/checkout@v4
- name: Checkout Sun compiler (Oracle Developer Studio)
uses: actions/checkout@v4
with:
repository: 'Colvars/oracle'
ssh-key: ${{ secrets.PULL_ORACLE_DEVELOPER_STUDIO }}
ref: 'master'
path: ${{github.workspace}}/oracle
- name: Get small downloadable packages
uses: actions/checkout@v4
with:
repository: 'Colvars/build-tools-packages'
ref: 'master'
path: 'devel-tools/packages'
- name: Install Apptainer
shell: bash
run: |
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer-suid
- name: Get container images for build dependencies
shell: bash
working-directory: devel-tools
run: |
apptainer pull CentOS7-devel.sif oras://ghcr.io/colvars/devel-containers:CentOS7-devel
- name: Build library with Sun compiler (Oracle Developer Studio)
shell: bash
env:
CC: ${{github.workspace}}/oracle/developerstudio12.6/bin/cc
CXX: ${{github.workspace}}/oracle/developerstudio12.6/bin/CC
run: |
apptainer exec ${{github.workspace}}/devel-tools/CentOS7-devel.sif \
cmake3 -D CMAKE_CXX_STANDARD=11 -P devel-tools/build_test_library.cmake
build-windows-x86_64-msvc:
name: Windows x86_64 (MSVC)
runs-on: windows-latest
needs: basicchecks
steps:
- uses: actions/checkout@v4
- name: Get small downloadable packages
uses: actions/checkout@v4
with:
repository: 'Colvars/build-tools-packages'
ref: 'master'
path: 'devel-tools/packages'
- name: Build and test library with CMake
# We need to set CMAKE_SYSTEM_NAME manually in script mode
run: cmake -D CMAKE_SYSTEM_NAME=Windows -P devel-tools/build_test_library.cmake
build-macos-ARM64-clang:
name: macOS ARM64 (AppleClang)
runs-on: macos-latest
needs: basicchecks
steps:
- uses: actions/checkout@v4
- name: Get small downloadable packages
uses: actions/checkout@v4
with:
repository: 'Colvars/build-tools-packages'
ref: 'master'
path: 'devel-tools/packages'
- name: Build and test library with CMake
# We need to set CMAKE_SYSTEM_NAME manually in script mode
run: cmake -D CMAKE_SYSTEM_NAME=Darwin -P devel-tools/build_test_library.cmake