-
Notifications
You must be signed in to change notification settings - Fork 6
443 lines (425 loc) · 15.5 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
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
name: CI
on:
workflow_call:
inputs:
id:
description: 'ID'
required: true
type: string
runner:
description: 'GitHub runner'
required: true
type: string
container:
description: 'Docker container'
required: false
type: string
default: ''
verset:
description: 'Dependency version set'
required: false
type: string
default: 'latest'
defaults:
run:
shell: bash
env:
hipo_fork: c-dilks/hipo
hipo_ref: 4c8325bcf289c5da84f20e6e2b84f9b9ad121447 # for libHipoDataFrame in pkg-config
# test options
num_events: 1000
verbose_test: 'false' # only set this to 'true' if `meson test` fails and you need more output to investigate
jobs:
# download test data
#########################################################
download_test_data:
runs-on: ubuntu-latest
env:
type: physics
steps:
- uses: actions/cache@v4
id: cache
with:
key: test_data
path: test_data.hipo
lookup-only: true
- name: download
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
wget -nv --no-check-certificate http://clasweb.jlab.org/clas12offline/distribution/clas12-timeline/validation_files_${{ env.type }}.tar.zst
tar xvf validation_files_${{ env.type }}.tar.zst
mv -v $(find validation_files -type f -name "*.hipo" | head -n1) test_data.hipo
# dependencies
#########################################################
build_root:
name: Build ROOT
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.container }}
outputs:
key: ${{ steps.key.outputs.key }}
steps:
- name: checkout iguana
uses: actions/checkout@v4
with:
path: iguana_src
- name: key
id: key
run: |
root_version=$(iguana_src/meson/minimum-version.sh root src | sed 's;.*/;;' | sed 's;\.tar\.gz;;')
echo key=root---${{ inputs.id }}---${root_version}---$(date +%Y-week%U) >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v4
id: cache
with:
key: ${{ steps.key.outputs.key }}
path: root.tar.zst
lookup-only: true
- name: install dependencies
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: iguana_src/.github/install-dependency-packages.sh ${{ inputs.runner }} ${{ inputs.verset }}
- name: download ROOT source code
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
srcURL=$(iguana_src/meson/minimum-version.sh root src)
echo "[+] DOWNLOADING ROOT SOURCE CODE FROM: $srcURL"
wget -nv --no-check-certificate $srcURL
tar xf $(ls -t *.gz | head -n1)
ls -t
mv -v $(ls -td root-* | head -n1) root_src
- name: build ROOT
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
cmake -S root_src -B build -G Ninja --install-prefix $(pwd)/root -DCMAKE_CXX_STANDARD=17
cmake --build build
cmake --install build
tar caf root{.tar.zst,}
- uses: actions/cache/save@v4
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
id: cache_save
with:
key: ${{ steps.key.outputs.key }}
path: root.tar.zst
build_hipo:
name: Build HIPO
needs:
- build_root # for dataframe support
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.container }}
strategy:
fail-fast: true
matrix:
root_dep:
- noROOT # exclude dataframe lib, which depends on ROOT
- withROOT
outputs:
key: ${{ steps.key.outputs.key }}
steps:
- name: get ROOT build
if: ${{ matrix.root_dep == 'withROOT' }}
uses: actions/cache/restore@v4
with:
key: ${{ needs.build_root.outputs.key }}
path: root.tar.zst
- name: untar ROOT build
if: ${{ matrix.root_dep == 'withROOT' }}
run: ls *.tar.zst | xargs -I{} tar xvf {}
- name: key
id: key
run: echo key=hipo---${{ inputs.id }}---${{ env.hipo_ref }}---$(date +%Y-week%U) >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v4
id: cache
with:
key: ${{ steps.key.outputs.key }}---${{ matrix.root_dep }}
path: hipo.tar.zst
lookup-only: true
- name: checkout iguana for dependency installation script
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
path: iguana_src
- name: checkout hipo
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
repository: ${{ env.hipo_fork }}
ref: ${{ env.hipo_ref }}
path: hipo_src
- name: build
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
iguana_src/.github/install-dependency-packages.sh ${{ inputs.runner }} ${{ inputs.verset }}
[ "${{ matrix.root_dep }}" = "withROOT" ] && source root/bin/thisroot.sh
cmake -S hipo_src -B build -G Ninja --install-prefix $(pwd)/hipo -DCMAKE_POSITION_INDEPENDENT_CODE=ON # using PIE build, for sanitizer readibility
cmake --build build
cmake --install build
tar cavf hipo{.tar.zst,}
- uses: actions/cache/save@v4
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
id: cache_save
with:
key: ${{ steps.key.outputs.key }}---${{ matrix.root_dep }}
path: hipo.tar.zst
# build and test Iguana
#########################################################
iguana:
name: Iguana
needs:
- build_hipo
- build_root
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.container }}
strategy:
fail-fast: true
matrix:
id:
- cpp
- address-sanitizer
- thread-sanitizer
- undefined-sanitizer
- leak-sanitizer
- noROOT
- python
include:
- { id: cpp, CC: gcc, CXX: g++, opts: '-Dbuildtype=release -Drequire_ROOT=true -Db_coverage=true' }
- { id: address-sanitizer, CC: clang, CXX: clang++, opts: '-Dbuildtype=debug -Drequire_ROOT=true -Db_sanitize=address -Db_lundef=false -Db_pie=true' }
- { id: thread-sanitizer, CC: clang, CXX: clang++, opts: '-Dbuildtype=debug -Drequire_ROOT=true -Db_sanitize=thread -Db_lundef=false -Db_pie=true' }
- { id: undefined-sanitizer, CC: clang, CXX: clang++, opts: '-Dbuildtype=debug -Drequire_ROOT=true -Db_sanitize=undefined -Db_lundef=false -Db_pie=true' }
- { id: leak-sanitizer, CC: clang, CXX: clang++, opts: '-Dbuildtype=debug -Drequire_ROOT=true -Db_sanitize=leak -Db_lundef=false -Db_pie=true' }
- { id: noROOT, CC: gcc, CXX: g++, opts: '-Dbuildtype=release -Drequire_ROOT=false' }
- { id: python, CC: gcc, CXX: g++, opts: '-Dbuildtype=release -Drequire_ROOT=true -Dbind_python=true' }
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
steps:
### setup
- uses: actions/checkout@v4
with: # settings needed for version number detection
clean: false
fetch-tags: true
fetch-depth: 0
path: iguana_src
### get test data
- name: get test data
uses: actions/cache/restore@v4
with:
key: test_data
path: test_data.hipo
### dependencies
- name: install dependency packages
run: iguana_src/.github/install-dependency-packages.sh ${{ inputs.runner }} ${{ inputs.verset }}
- name: get `hipo-withROOT` build
if: ${{ matrix.id != 'noROOT' }}
uses: actions/cache/restore@v4
with:
key: ${{ steps.hipo_key.output.hipo_key }}---withROOT
path: hipo.tar.zst
- name: get `hipo-noROOT` build
if: ${{ matrix.id == 'noROOT' }}
uses: actions/cache/restore@v4
with:
key: ${{ steps.hipo_key.output.hipo_key }}---noROOT
path: hipo.tar.zst
- name: get `ROOT` build
if: ${{ matrix.id != 'noROOT' }}
uses: actions/cache/restore@v4
with:
key: ${{ needs.build_root.outputs.key }}
path: root.tar.zst
- name: untar dependency builds
run: ls *.tar.zst | xargs -I{} tar xvf {}
- name: tree local dependencies
run: tree hipo
- name: summarize dependencies
if: ${{ matrix.id == 'cpp' }}
run: |
echo '### Dependencies' >> $GITHUB_STEP_SUMMARY
echo '| Dependency | Version |' >> $GITHUB_STEP_SUMMARY
echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY
echo "| \`hipo\` | ${{ env.hipo_ref }} |" >> $GITHUB_STEP_SUMMARY
cat pkg_summary.md >> $GITHUB_STEP_SUMMARY
### build
- name: set ROOT environment
if: ${{ matrix.id != 'noROOT' }}
run: iguana_src/.github/source-ROOT.sh root
- name: meson setup
run: |
meson setup iguana_build iguana_src \
--prefix=$(pwd)/iguana \
--cmake-prefix-path=$(pwd)/root \
--pkg-config-path=$(pwd)/hipo/lib/pkgconfig \
-Dtest_data_file=$(pwd)/test_data.hipo \
-Dtest_num_events=${{ env.num_events }} \
-Dtest_output_dir=$(pwd)/validation_results \
${{ matrix.opts }}
- name: dump build options
run: meson configure iguana_build | cat
- run: meson compile
working-directory: iguana_build
- run: meson install
working-directory: iguana_build
### dump info about this build
- name: dump build log
if: always()
run: cat iguana_build/meson-logs/meson-log.txt
- name: dump rpaths
run: iguana_src/.github/rpath-dump.sh iguana ${{ inputs.runner }}
- name: cat pkg-config pc files
run: |
pcfiles=$(find iguana -type f -name "*.pc")
for pcfile in $pcfiles; do
echo "[+++] cat $pcfile"
cat $pcfile
done
- run: tree iguana installation prefix
### run tests
- name: meson test
working-directory: iguana_build
run: |
if [ "${{ env.verbose_test }}" = "true" ]; then
[ ${{ inputs.runner }} = "macos-latest" ] && stdbuf_cmd=gstdbuf || stdbuf_cmd=stdbuf
$stdbuf_cmd -o0 meson test --print-errorlogs --verbose --no-stdsplit
else
meson test --print-errorlogs
fi
### coverage
- name: coverage
if: ${{ matrix.id == 'cpp' }}
run: |
ninja -C iguana_build coverage
mv iguana_build/meson-logs/coveragereport coverage-report
echo '### Coverage Report' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat iguana_build/meson-logs/coverage.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '- for details, see the `coverage-report` artifact' >> $GITHUB_STEP_SUMMARY
echo '- to compare to the report from the `main` branch, see <https://jeffersonlab.github.io/iguana/coverage-report>' >> $GITHUB_STEP_SUMMARY
### set iguana environment, since the next steps will check the iguana installation
- name: set iguana environment
run: source iguana/bin/this_iguana.sh --verbose --githubCI
### test installed examples
###### cpp
- run: iguana-example-00-basic test_data.hipo ${{ env.num_events }}
if: ${{ matrix.id == 'cpp' }}
- run: iguana-example-01-bank-rows test_data.hipo ${{ env.num_events }}
if: ${{ matrix.id == 'cpp' }}
- run: iguana-example-02-dataframes test_data.hipo ${{ env.num_events }}
if: ${{ matrix.id == 'cpp' }}
- run: iguana-example-03-config-files iguana/etc/iguana/examples
if: ${{ matrix.id == 'cpp' }}
###### python
- run: iguana-example-00-basic.py test_data.hipo ${{ env.num_events }}
if: ${{ matrix.id == 'python' }}
- run: iguana-example-01-bank-rows.py test_data.hipo ${{ env.num_events }}
if: ${{ matrix.id == 'python' }}
### test consumers
- name: consumer test: make
run: iguana_src/.github/test-consumer-build.sh make
if: ${{ matrix.id == 'cpp' }}
- name: consumer test: meson
run: iguana_src/.github/test-consumer-build.sh meson
if: ${{ matrix.id == 'cpp' }}
- name: consumer test: cmake
run: CMAKE_PREFIX_PATH=$(pwd)/hipo iguana_src/.github/test-consumer-build.sh cmake
if: ${{ matrix.id == 'cpp' }}
### upload artifacts
- uses: actions/upload-artifact@v4
if: always()
with:
name: logs_iguana_build_${{ matrix.id }}
retention-days: 5
path: iguana_build/meson-logs
- uses: actions/upload-artifact@v4
if: ${{ matrix.id == 'cpp' }}
with:
name: coverage-report
retention-days: 5
path: coverage-report
- uses: actions/upload-artifact@v4
if: ${{ matrix.id == 'cpp' }}
with:
name: _validation_results
retention-days: 5
path: validation_results
# documentation
#########################################################
doc_generate:
if: ${{ inputs.id == 'linux-latest' }}
name: Generate documentation
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.container }}
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm doxygen graphviz
- name: doxygen
run: doxygen doc/Doxyfile
- uses: actions/upload-artifact@v4
with:
name: doxygen
retention-days: 5
path: doc/api/
# deployment
#########################################################
collect_webpages:
if: ${{ (github.head_ref == 'main' || github.ref_name == 'main') && inputs.id == 'linux-latest' }}
name: Collect webpages
needs:
- doc_generate
- iguana
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v4
with:
path: iguana_src
- name: download doxygen documentation
uses: actions/download-artifact@v4
with:
name: doxygen
path: doxygen
- name: download coverage report
uses: actions/download-artifact@v4
with:
name: coverage-report
path: coverage-report
- run: tree
- name: collect
run: |
mkdir pages
cp iguana_src/.github/pages-index.html pages/index.html
mv doxygen pages/
mv coverage-report pages/
- run: tree
- uses: actions/upload-pages-artifact@v3
with:
retention-days: 5
path: pages/
deploy_webpages:
if: ${{ (github.head_ref == 'main' || github.ref_name == 'main') && inputs.id == 'linux-latest' }}
name: Deploy webpages
needs: collect_webpages
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ${{ inputs.runner }}
steps:
- name: deployment
id: deployment
uses: actions/deploy-pages@v4
# finalize
#########################################################
final:
name: Final
needs:
- iguana
runs-on: ${{ inputs.runner }}
steps:
- run: exit 0