forked from OpenGATE/Gate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
299 lines (283 loc) · 10.7 KB
/
azure-pipelines.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
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- develop
jobs:
- job: Build
timeoutInMinutes: 360 # how long to run the job before automatically cancelling
strategy:
matrix:
Linux:
STRATEGY_NAME: 'Linux'
imageName: 'ubuntu-latest'
GATE_USE_TORCH: 'OFF'
GATE_USE_RTK: 'OFF'
GATE_USE_OPTICAL: 'OFF'
Linux_Torch:
STRATEGY_NAME: 'Linux_Torch'
imageName: 'ubuntu-latest'
GATE_USE_TORCH: 'ON'
GATE_USE_RTK: 'OFF'
GATE_USE_OPTICAL: 'OFF'
Linux_RTK:
STRATEGY_NAME: 'Linux_RTK'
imageName: 'ubuntu-latest'
GATE_USE_TORCH: 'OFF'
GATE_USE_RTK: 'ON'
GATE_USE_OPTICAL: 'OFF'
Linux_Optic:
STRATEGY_NAME: 'Linux_Optic'
imageName: 'ubuntu-latest'
GATE_USE_TORCH: 'OFF'
GATE_USE_RTK: 'OFF'
GATE_USE_OPTICAL: 'ON'
macOS:
STRATEGY_NAME: 'macOS'
imageName: 'macos-latest'
GATE_USE_TORCH: 'OFF'
GATE_USE_RTK: 'OFF'
GATE_USE_OPTICAL: 'OFF'
macOS_Torch:
STRATEGY_NAME: 'macOS_Torch'
imageName: 'macos-latest'
GATE_USE_TORCH: 'ON'
GATE_USE_RTK: 'OFF'
GATE_USE_OPTICAL: 'OFF'
macOS_RTK:
STRATEGY_NAME: 'macOS_RTK'
imageName: 'macos-latest'
GATE_USE_TORCH: 'OFF'
GATE_USE_RTK: 'ON'
GATE_USE_OPTICAL: 'OFF'
macOS_Optic:
STRATEGY_NAME: 'macOS_Optic'
imageName: 'macos-latest'
GATE_USE_TORCH: 'OFF'
GATE_USE_RTK: 'OFF'
GATE_USE_OPTICAL: 'ON'
pool:
vmImage: $(imageName)
variables:
ROOT_VERSION: 'v6-19-02'
GEANT4_VERSION: 'v10.6.0'
ROOT_DIR: $(Pipeline.Workspace)/software/root
GEANT4_DIR: $(Pipeline.Workspace)/software/geant4
OSVERSION: 0
steps:
- script: |
if [ "$(Agent.OS)" == "Linux" ]; then
sudo apt-get update -qq
sudo apt-get install -y gcc \
g++ \
make \
binutils \
libx11-dev \
libxpm-dev \
libxft-dev \
libxext-dev \
qt5-default \
git \
cmake \
python3.7-dev \
ccache \
fftw3-dev
gcc -v
elif [ "$(Agent.OS)" == "Darwin" ]; then
brew update
brew install qt5 \
ccache \
fftw \
llvm \
libomp \
wget
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 $(Pipeline.Workspace)
mkdir software
cmake --version
displayName: 'Install dependencies'
- script: |
if [ "$(Agent.OS)" == "Linux" ]; then
OSRELEASE=`lsb_release -rs`
elif [ "$(Agent.OS)" == "Darwin" ]; then
OSRELEASE=`sw_vers -productVersion`
fi
echo "OSVERSION:"
echo $OSRELEASE
echo "##vso[task.setvariable variable=OSVERSION]$OSRELEASE"
displayName: "Set OSVERSION Value"
- task: Cache@2
inputs:
key: 'ccache | "$(Agent.OS)_$(OSVERSION)_root_$(ROOT_VERSION)_geant4_$(GEANT4_VERSION)_v2"'
path: $(Pipeline.Workspace)/software
cacheHitVar: CACHE_RESTORED
displayName: ccache
- script: |
if [ "$CACHE_RESTORED" == "false" ]; then
if [ "$STRATEGY_NAME" == "Linux" ] || [ "$STRATEGY_NAME" == "macOS" ]; then
cd $(Pipeline.Workspace)/software
mkdir root
cd root
mkdir src bin
git clone --branch $ROOT_VERSION https://github.com/root-project/root.git --depth 1 src
cd bin
cmake ../src
make -j4
fi
fi
displayName: 'Install root'
- script: |
if [ "$CACHE_RESTORED" == "false" ]; then
if [ "$STRATEGY_NAME" == "Linux" ] || [ "$STRATEGY_NAME" == "macOS" ]; then
cd $(Pipeline.Workspace)/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_INSTALL_DATADIR=$(GEANT4_DIR)/data \
-DCMAKE_INSTALL_PREFIX=$(GEANT4_DIR)/install \
../src
make -j4 install
cd $(Pipeline.Workspace)/software/geant4
rm -rf src bin
fi
fi
displayName: 'Install geant4'
- script: |
if [ "$CACHE_RESTORED" == "true" ] || [ "$STRATEGY_NAME" == "Linux" ] || [ "$STRATEGY_NAME" == "macOS" ]; then
cd $(Pipeline.Workspace)
if [ "$GATE_USE_TORCH" == "ON" ]; then
if [ "$(Agent.OS)" == "Linux" ]; then
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.4.0%2Bcpu.zip
unzip libtorch-cxx11-abi-shared-with-deps-1.4.0+cpu.zip
elif [ "$(Agent.OS)" == "Darwin" ]; then
wget https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.4.0.zip
unzip libtorch-macos-1.4.0.zip
fi
fi
if [ "$GATE_USE_RTK" == "ON" ]; then
mkdir rtk
cd rtk
mkdir src bin
git clone https://github.com/InsightSoftwareConsortium/ITK.git --depth 1 src
cd bin
cmake -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
else
echo "Just store cache now"
echo "Run the CI again to compile Gate"
fi
displayName: 'Install gate compilation dependencies'
- script: |
if [ "$CACHE_RESTORED" == "true" ] || [ "$STRATEGY_NAME" == "Linux" ] || [ "$STRATEGY_NAME" == "macOS" ]; then
cd $(Pipeline.Workspace)
export ROOTSYS=$(ROOT_DIR)/bin/bin/root-config
export PATH=${ROOTSYS}:${PATH}
source $(ROOT_DIR)/bin/bin/thisroot.sh
source $(GEANT4_DIR)/install/bin/geant4.sh
mkdir build
cd build
cmake -DGATE_USE_TORCH=$GATE_USE_TORCH \
-DTorch_DIR=$(Pipeline.Workspace)/libtorch/share/cmake/Torch \
-DGATE_COMPILE_GATEDIGIT=ON \
-DGATE_USE_RTK=$GATE_USE_RTK \
-DITK_DIR=$(Pipeline.Workspace)/rtk/bin/ \
-DGATE_USE_OPTICAL=$GATE_USE_OPTICAL \
-DBUILD_TESTING=ON \
../s
else
echo "Just store cache now"
echo "Run the CI again to compile Gate"
if [ ! "$STRATEGY_NAME" == "Linux" ] && [ ! "$STRATEGY_NAME" == "macOS" ]; then
exit 1
fi
fi
displayName: 'Configure Gate'
- bash: |
cd $(Pipeline.Workspace)
cat > dashboard.cmake << EOF
set(CTEST_SITE "Azure.\$ENV{AGENT_MACHINENAME}")
file(TO_CMAKE_PATH "\$ENV{AGENT_BUILDDIRECTORY}" CTEST_DASHBOARD_ROOT)
file(TO_CMAKE_PATH "\$ENV{BUILD_SOURCESDIRECTORY}" CTEST_SOURCE_DIRECTORY)
file(TO_CMAKE_PATH "\$ENV{AGENT_BUILDDIRECTORY}/build" CTEST_BINARY_DIRECTORY)
set(dashboard_source_name "$(Build.Repository.Name)")
if(DEFINED ENV{SYSTEM_PULLREQUEST_SOURCEBRANCH})
set(branch "-\$ENV{SYSTEM_PULLREQUEST_SOURCEBRANCH}")
set(dashboard_model "Experimental")
elseif("\$ENV{BUILD_SOURCEBRANCHNAME}" STREQUAL "develop")
set(branch "-develop")
set(dashboard_model "Continuous")
else()
set(branch "-\$ENV{BUILD_SOURCEBRANCHNAME}")
set(dashboard_model "Experimental")
endif()
if(DEFINED ENV{SYSTEM_PULLREQUEST_PULLREQUESTNUMBER})
set(pr "-PR\$ENV{SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}")
else()
set(pr "")
endif()
set(CTEST_BUILD_NAME "azure_$(STRATEGY_NAME)-Build$(Build.BuildId)\${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_test(CAPTURE_CMAKE_ERROR test_errors RETURN_VALUE test_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 \${test_errors} EQUAL 0) OR (NOT \${test_Results} EQUAL 0))
message( FATAL_ERROR "Test error" )
endif()
if (NOT \${submit_Results} EQUAL 0)
message( FATAL_ERROR "Submit error" )
endif()
EOF
cat dashboard.cmake
displayName: 'Configure CTest'
- bash: |
if [ "$CACHE_RESTORED" == "true" ] || [ "$STRATEGY_NAME" == "Linux" ] || [ "$STRATEGY_NAME" == "macOS" ]; then
cd $(Pipeline.Workspace)/build
cp ../dashboard.cmake .
export ROOTSYS=$(ROOT_DIR)/bin/bin/root-config
export PATH=${ROOTSYS}:${PATH}
source $(ROOT_DIR)/bin/bin/thisroot.sh
source $(GEANT4_DIR)/install/bin/geant4.sh
ls -lrt ../s/benchmarks/benchRT/output
ctest -S dashboard.cmake -VV
if [ ! $? -eq 0 ]; then
exit 1
fi
ls -lrt ../s/benchmarks/benchRT/output
cd ../s/benchmarks/benchRT
else
echo "Just store cache now"
echo "Run the CI again to compile Gate"
fi
displayName: 'Build Gate'