forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (162 loc) · 5.82 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
# 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"
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
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
run: |
ninja -v -k0
- name: Run tests
working-directory: build
continue-on-error: ${{matrix.geant != '11.0'}} # TODO: disable or fix failing tests
run: |
if [ "${{matrix.geant}}" == "11.0" ]; then
# TODO: add 11.0.4 and clhep version to tests
#export CELER_TEST_STRICT=1
echo "warning: strict testing is disabled"
fi
ctest --parallel $(nproc) --timeout 15 --output-on-failure \
--test-output-size-passed=32768 --test-output-size-failed=1048576
- 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: