forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (184 loc) · 6.57 KB
/
build-spack.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
# Build directly on the GitHub runner with caching
name: build-spack
on:
workflow_dispatch:
workflow_call:
concurrency:
group: build-spack-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}-${{github.workflow}}
env:
SPACK_REF: 5fe93fee1eec46a0750bd340198bffcb92ff9eec # v0.22.0
jobs:
spack:
name: >-
${{format('{0}{1}{2}{3}{4}',
matrix.geometry,
matrix.special && '-' || '',
matrix.special,
matrix.geant && '-g4@' || '',
matrix.geant)}}
strategy:
fail-fast: false
matrix:
geometry: ["vecgeom"]
special: [null]
geant: ["10.5", "10.6", "10.7", "11.0", "11.1", "11.2"]
include:
- geometry: "orange"
special: "minimal"
geant: null
- geometry: "orange"
special: "float"
geant: "11.0"
- geometry: "vecgeom"
special: "clhep"
geant: "11.0"
- geometry: "geant4"
special: null
geant: "11.0"
- geometry: "orange"
special: "clang-tidy"
geant: "11.2"
env:
CCACHE_DIR: "${{github.workspace}}/.ccache"
CCACHE_MAXSIZE: "100Mi"
CMAKE_PRESET: >-
${{format('reldeb-{0}{1}{2}',
matrix.geometry,
matrix.special && '-' || '',
matrix.special)}}
SPACK_VIEW: "/opt/spack-view"
SPACK_BUILDCACHE: "celer-buildcache" # see spack.yaml
CC: "clang-15"
CXX: "clang++-15"
runs-on: ubuntu-22.04
continue-on-error: false
steps:
- name: Check out Celeritas
uses: actions/checkout@v4
with:
fetch-depth: 255
fetch-tags: true # to get version information
- name: Setup Spack
uses: spack/setup-spack@0ce61628ed8a32a5664cf01a0e0b5a4834a3b413 # 2024/03
with:
ref: ${{env.SPACK_REF}}
buildcache: true
color: true
path: spack-src
- name: Initialize spack environment
run: |
# TODO: https://github.com/spack/spack/pull/43136
curl -LfsS https://github.com/spack/spack/pull/43136.patch | git -C spack-src apply -
cp scripts/ci/spack.yaml .
if [ "${{matrix.geometry}}" == "vecgeom" ]; then
spack -e . add vecgeom
fi
if [ "${{matrix.special}}" != "minimal" ]; then
spack -e . add root
fi
if [ "${{matrix.geant}}" != "" ]; then
spack -e . add geant4@${{matrix.geant}}
fi
spack -e . config add packages:all:require:"'%clang@15 target=x86_64_v3'"
spack -e . compiler find
# Add the spack ref so that updating spack will reconcretize
echo "# Concretized with ${{env.SPACK_REF}}" >> spack.yaml
- name: Cache concretization
uses: actions/cache@v4
with:
path: spack.lock
key: lock-${{hashFiles('spack.yaml')}}-${{github.run_id}}
restore-keys: |
lock-${{hashFiles('spack.yaml')}}
- name: Concretize
run: |
spack -e . -v concretize
- name: Install dependencies with Spack
run: |
spack -e . env depfile -o Makefile
make -Orecurse -j $(($(nproc) + 1)) SPACK_INSTALL_FLAGS=--no-check-signature
- name: Save Spack installation to build cache
run: |
spack -e . mirror set --push --oci-username ${{github.actor}} --oci-password "${{secrets.GITHUB_TOKEN}}" ${SPACK_BUILDCACHE}
spack -e . buildcache push -j $(($(nproc) + 1)) --base-image ubuntu:22.04 --unsigned --update-index ${SPACK_BUILDCACHE}
if: ${{github.event_name == 'push' && !cancelled()}}
- name: Activate environment
run: |
test -d "${SPACK_VIEW}"
echo "${SPACK_VIEW}/bin" >> $GITHUB_PATH
echo "CMAKE_PREFIX_PATH=${SPACK_VIEW}:${CMAKE_PREFIX_PATH}" >> $GITHUB_ENV
spack env activate . --sh > "${SPACK_VIEW}/rc"
- name: Cache ccache
uses: actions/cache@v4
with:
path: ${{env.CCACHE_DIR}}
key: ccache-${{env.CMAKE_PRESET}}-${{matrix.geant}}-${{github.run_id}}
restore-keys: |
ccache-${{env.CMAKE_PRESET}}-${{matrix.geant}}
ccache-${{env.CMAKE_PRESET}}
- name: Zero ccache stats
run: |
ccache -z
- name: Configure Celeritas
env:
CLANG_TIDY: "clang-tidy-15"
run: |
ln -fs scripts/cmake-presets/ci-ubuntu-github.json CMakeUserPresets.json
cmake --preset=${CMAKE_PRESET} --log-level=VERBOSE
- name: Build all
working-directory: build
continue-on-error: ${{matrix.special == 'clang-tidy'}}
run: |
ninja -v -k0
- name: Regenerate ROOT test data
if: ${{matrix.geant == '11.0'}}
working-directory: build
run: |
ninja -v -k0 update-root-test-data
- name: Run tests
id: test
working-directory: build
continue-on-error: ${{fromJSON(matrix.geant) < 11}} # TODO: fix failing tests
run: |
if [ "${{matrix.geant}}" == "11.0" ]; then
# Note this is ignored for geant4, float, clhep
export CELER_TEST_STRICT=1
fi
ctest --parallel $(nproc) --timeout 15 --output-on-failure \
--test-output-size-passed=32768 --test-output-size-failed=1048576
- name: Upload failed tests
if: ${{steps.test.outcome == 'failure'}}
uses: actions/upload-artifact@v4
with:
name: failed-${{github.job}}-${{env.CMAKE_PRESET}}-${{matrix.geant}}
if-no-files-found: warn
retention-days: 3
path: |
build/**/*.out.json
build/Testing/Temporary/LastTest.log
build/Testing/Temporary/LastTestsFailed.log
- name: Check using build directory as install
run: |
. ${SPACK_VIEW}/rc
CELER_INSTALL_DIR=${PWD}/build ./scripts/ci/test-examples.sh
- name: Install
working-directory: build
run: |
ninja install
- name: Check installation
working-directory: install
run: |
for exe in orange-update celer-export-geant celer-dump-data \
celer-sim celer-g4; do
test -x "bin/${exe}"
done
./bin/celer-sim --version
- name: Build examples
run: |
. ${SPACK_VIEW}/rc
./scripts/ci/test-examples.sh
- name: Show ccache stats
if: ${{!cancelled()}}
run: |
ccache -s
# vim: set nowrap tw=100: