-
Notifications
You must be signed in to change notification settings - Fork 263
319 lines (311 loc) · 12.6 KB
/
main.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
name: CI
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
schedule:
- cron: '0 0 * * 0,3'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
options: [none, rtk, torch, optic]
env:
ROOT_VERSION: 'v6-26-08'
GEANT4_VERSION: 'v11.1.1'
ITK_VERSION: 'v5.3.0'
ROOT_DIR: $(HOME)/software/root
GEANT4_DIR: $(HOME)/software/geant4
steps:
- name: Checkout github repo
uses: actions/checkout@v3
with:
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Cache
id: cache_gate_dependencies
uses: actions/cache@v3
with:
path: ~/software
key: ${{ matrix.os }}-geant4-${{ env.GEANT4_VERSION }}-root-${{ env.ROOT_VERSION }}-build4
restore-keys: ${{ matrix.os }}-geant4-${{ env.GEANT4_VERSION }}-root-${{ env.ROOT_VERSION }}-build4
- name: Install dependencies
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
sudo apt-get update -qq
sudo apt-get install -y gcc \
g++ \
make \
binutils \
libx11-dev \
libxpm-dev \
libxft-dev \
libxext-dev \
qtbase5-dev \
qt5-qmake \
git \
cmake \
libssl-dev \
python3.8-dev \
ccache \
fftw3-dev
gcc -v
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
brew update
brew cleanup
brew config
rm -rf /usr/local/bin/python3.11-config /usr/local/bin/2to3-3.11 /usr/local/bin/idle3.11 /usr/local/bin/pydoc3.11 /usr/local/bin/python3.11
rm -rf /usr/local/bin/python3-config /usr/local/bin/2to3 /usr/local/bin/idle3 /usr/local/bin/pydoc3 /usr/local/bin/python3
brew install --force --verbose --overwrite --debug qt5 \
ccache \
tbb \
xrootd \
fftw
brew link qt5 --force && sudo ln -s /usr/local/opt/qt/mkspecs /usr/local/mkspecs && sudo ln -s /usr/local/opt/qt/plugins /usr/local/plugins
export PATH=/usr/local/opt/qt/bin:$PATH
export LDFLAGS="-L/usr/local/opt/qt/lib -L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/qt/include -I/usr/local/opt/llvm/include -fopenmp"
fi
cd $HOME/
mkdir -p software option_dependencies
cmake --version
- name: Install root
run: |
if [ "${{ steps.cache_gate_dependencies.outputs.cache-hit }}" != 'true' ] && [ "${{ matrix.options }}" == 'none' ]; then
cd $HOME/software
mkdir root
cd root
mkdir src bin install
git clone --branch $ROOT_VERSION https://github.com/root-project/root.git --depth 1 src
cd bin
cmake ../src -DCMAKE_CXX_STANDARD=17 \
-Dpython=OFF \
-Dpyroot=OFF \
-Dclad=OFF \
-DCMAKE_INSTALL_PREFIX=$HOME/software/root/install
make -j4 install
cd ..
rm -rf bin src
fi
- name: Install Geant4
run: |
if [ "${{ steps.cache_gate_dependencies.outputs.cache-hit }}" != 'true' ] && [ "${{ matrix.options }}" == 'none' ]; then
cd $HOME/software
mkdir geant4
cd geant4
mkdir src bin install data
git clone --branch $GEANT4_VERSION https://github.com/Geant4/geant4.git --depth 1 src
cd bin
cmake -DGEANT4_INSTALL_DATA=ON \
-DGEANT4_BUILD_MULTITHREADED=OFF \
-DGEANT4_INSTALL_DATADIR=$HOME/software/geant4/data \
-DCMAKE_INSTALL_PREFIX=$HOME/software/geant4/install \
../src
make -j4 install
cd ..
rm -rf src bin
fi
- name: Install option dependencies
run: |
if [ "${{ steps.cache_gate_dependencies.outputs.cache-hit }}" == 'true' ]; then
cd $HOME/option_dependencies
if [ "${{ matrix.options }}" == 'torch' ]; then
if [ "${{ matrix.os }}" == 'ubuntu-latest' ]; then
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.10.1%2Bcpu.zip
unzip libtorch-cxx11-abi-shared-with-deps-1.10.1+cpu.zip
elif [ "${{ matrix.os }}" == 'macos-latest' ]; then
wget https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.10.1.zip
unzip libtorch-macos-1.10.1.zip
fi
fi
if [ "${{ matrix.options }}" == 'rtk' ]; then
mkdir rtk
cd rtk
mkdir src bin
git clone --branch $ITK_VERSION https://github.com/InsightSoftwareConsortium/ITK.git --depth 1 src
cd bin
cmake -DCMAKE_CXX_FLAGS="-std=c++17" -DBUILD_TESTING=OFF -DITK_USE_FFTWD=ON -DITK_USE_FFTWF=ON -DITK_USE_SYSTEM_FFTW:BOOL=ON -DITK_MINIMUM_COMPLIANCE_LEVEL=3 -DModule_RTK=ON -DREMOTE_GIT_TAG_RTK=master ../src
make -j4
fi
cd $HOME/option_dependencies
ls
else
if [ "${{ matrix.options }}" != 'none' ]; then
echo "Create the cache first and run the job again"
exit 1
fi
fi
- name: Configure Gate
run: |
if [ "${{ steps.cache_gate_dependencies.outputs.cache-hit }}" == 'true' ]; then
cd $HOME
export ROOTSYS=$HOME/software/root/install
export PATH=${ROOTSYS}:${PATH}
source $HOME/software/root/install/bin/thisroot.sh
source $HOME/software/geant4/install/bin/geant4.sh
mkdir build
cd build
which cmake
cmake --version
export GATE_USE_TORCH=OFF
export GATE_USE_RTK=OFF
export GATE_USE_OPTICAL=OFF
if [ "${{ matrix.options }}" == 'torch' ]; then
export GATE_USE_TORCH=ON
fi
if [ "${{ matrix.options }}" == 'rtk' ]; then
export GATE_USE_RTK=ON
fi
if [ "${{ matrix.options }}" == 'optic' ]; then
export GATE_USE_OPTIC=ON
fi
cmake -DGATE_USE_TORCH=$GATE_USE_TORCH \
-DTorch_DIR=$HOME/option_dependencies/libtorch/share/cmake/Torch \
-DGATE_COMPILE_GATEDIGIT=ON \
-DGATE_USE_RTK=$GATE_USE_RTK \
-DITK_DIR=$HOME/option_dependencies/rtk/bin/ \
-DGATE_USE_OPTICAL=$GATE_USE_OPTICAL \
-DBUILD_TESTING=ON \
$GITHUB_WORKSPACE
fi
- name: Configure CTest
if: steps.cache_gate_dependencies.outputs.cache-hit == 'true'
run: |
cd $HOME
cat > dashboard.cmake << EOF
set(CTEST_SITE "Github.macos-latest.none")
file(TO_CMAKE_PATH "$HOME" CTEST_DASHBOARD_ROOT)
file(TO_CMAKE_PATH "$GITHUB_WORKSPACE" CTEST_SOURCE_DIRECTORY)
file(TO_CMAKE_PATH "$HOME/build" CTEST_BINARY_DIRECTORY)
set(dashboard_source_name "$GITHUB_REPOSITORY")
if("$GITHUB_REF" MATCHES "^refs/pull/")
set(branch "")
set(pr "-PR$GITHUB_REF")
set(dashboard_model "Experimental")
elseif("$GITHUB_REF" STREQUAL "refs/heads/develop")
set(branch "-develop")
set(pr "")
set(dashboard_model "Continuous")
else()
set(branch "-BRANCH$GITHUB_REF")
set(pr "")
set(dashboard_model "Experimental")
endif()
set(CTEST_BUILD_NAME "github_macos-latest.none-Build$GITHUB_RUN_NUMBER\${pr}\${branch}")
set(CTEST_UPDATE_VERSION_ONLY 1)
set(CTEST_TEST_ARGS \${CTEST_TEST_ARGS} PARALLEL_LEVEL \${PARALLEL_LEVEL})
set(CTEST_CONFIGURATION_TYPE "Release")
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_BUILD_FLAGS "\${CTEST_BUILD_FLAGS} -j4")
set(CTEST_CUSTOM_WARNING_EXCEPTION
\${CTEST_CUSTOM_WARNING_EXCEPTION}
# macOS Azure Pipelines
"ld: warning: text-based stub file"
)
set(dashboard_no_clean 1)
set(ENV{CC} $(cCompiler))
set(ENV{CXX} $(cxxCompiler))
string(TIMESTAMP build_date "%Y-%m-%d")
message("CDash Build Identifier: \${build_date} \${CTEST_BUILD_NAME}")
message("CTEST_SITE = \${CTEST_SITE}")
ctest_start("\${dashboard_model}")
ctest_configure(CAPTURE_CMAKE_ERROR configure_errors RETURN_VALUE configure_Results)
ctest_build(NUMBER_ERRORS build_errors RETURN_VALUE build_Results)
ctest_submit(RETURN_VALUE submit_Results)
if ((NOT \${configure_errors} EQUAL 0) OR (NOT \${configure_Results} EQUAL 0))
message( FATAL_ERROR "Configuration error" )
endif()
if ((NOT \${build_errors} EQUAL 0) OR (NOT \${build_Results} EQUAL 0))
message( FATAL_ERROR "Build error" )
endif()
if (NOT \${submit_Results} EQUAL 0)
message( FATAL_ERROR "Submit error" )
endif()
EOF
cat dashboard.cmake
- name: Build Gate
run: |
if [ "${{ steps.cache_gate_dependencies.outputs.cache-hit }}" == 'true' ]; then
cd $HOME/build
cp ../dashboard.cmake .
export ROOTSYS=$HOME/software/root/install
export PATH=${ROOTSYS}:${PATH}
source $HOME/software/root/install/bin/thisroot.sh
source $HOME/software/geant4/install/bin/geant4.sh
ctest -S dashboard.cmake -VV
if [ ! $? -eq 0 ]; then
exit 1
fi
fi
benchmarks:
runs-on: ubuntu-latest
needs: [build]
strategy:
fail-fast: false
matrix:
strategy_name: [t1_edep_profiles,
t2_edep_vox,
t3_range_e+,
t4_necr,
t6_dpk,
t7_garf,
t8_LETActor,
t10_SpectroGamma,
t11_EMField,
t12_tessellated_volume,
t13_phsp,
t15_optical,
t16_decay,
t17_extended_source,
t18_movement_benchmark,
t19_acollinearity,
t20_digi_adder,
t22_merged_actor,
t23_digi_readout,
t26_CoinSorter,
t27_Hits_2SD,
t28_Singles_2SD,
t29_optical_digi,
t30_dna]
steps:
- name: Checkout github repo
uses: actions/checkout@v3
with:
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y gcc \
g++ \
make \
binutils \
libx11-dev \
libxpm-dev \
libxft-dev \
libxext-dev \
qtbase5-dev \
qt5-qmake \
git \
cmake \
libssl-dev \
python3.8-dev \
ccache \
fftw3-dev
gcc -v
cd
- name: Run the test in docker
run: |
mkdir gate_benchmarks
export GIT_SSL_NO_VERIFY=1
git clone --recursive https://github.com/OpenGATE/GateBenchmarks.git gate_benchmarks
docker run --rm -e "TEST=${{ matrix.strategy_name }}" -v $GITHUB_WORKSPACE:/src -v $GITHUB_WORKSPACE/gate_benchmarks:/home tbaudier/gatebenchmarks:9.3 /home/.github/workflows/runTest.sh