-
Notifications
You must be signed in to change notification settings - Fork 0
365 lines (300 loc) · 10.9 KB
/
cd.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
name: CD
on:
pull_request:
push:
branches:
- master
release:
types:
- published
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
native-build:
name:
native-build-${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [macos-13, windows-latest, ubuntu-latest, macos-14]
runs-on: ${{ matrix.platform }}
steps:
- name: checkout vcell-solvers repo
uses: actions/checkout@v4
- name: Install Intel MacOS dependencies
if: matrix.platform == 'macos-13'
shell: bash
run: |
brew install boost
brew install hdf5
brew install ninja
brew install llvm
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> /Users/runner/.bash_profile
source /Users/runner/.bash_profile
gcc --version
gfortran --version
cmake --version
brew info boost
brew info hdf5
- name: Install ARM MacOS dependencies
if: matrix.platform == 'macos-14'
shell: bash
run: |
brew install boost
brew install hdf5
brew install ninja
brew install llvm
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> /Users/runner/.bash_profile
ln -s /opt/homebrew/bin/gfortran-14 /usr/local/bin/gfortran
gcc --version
gfortran --version
cmake --version
brew info boost
brew info hdf5
- name: Build Macos ARM
if: matrix.platform == 'macos-14'
run: |
platform=macos
echo "working dir is $PWD"
mkdir build
cd build
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
cmake \
-G Ninja \
-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang \
-DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++ \
-DOPTION_TARGET_PYTHON_BINDING=OFF \
-DOPTION_MINGW=ON \
-DOPTION_TARGET_MESSAGING=OFF \
-DOPTION_TARGET_SMOLDYN_SOLVER=OFF \
-DOPTION_TARGET_FV_SOLVER=ON \
-DOPTION_TARGET_DOCS=ON \
-B . -S ..
ninja
- name: Build Macos Intel
if: matrix.platform == 'macos-13'
run: |
platform=macos
echo "working dir is $PWD"
mkdir build
cd build
export PATH="/usr/local/opt/llvm/bin:$PATH"
cmake \
-G Ninja \
-DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ \
-DOPTION_TARGET_PYTHON_BINDING=OFF \
-DOPTION_MINGW=ON \
-DOPTION_TARGET_MESSAGING=OFF \
-DOPTION_TARGET_SMOLDYN_SOLVER=OFF \
-DOPTION_TARGET_FV_SOLVER=ON \
-DOPTION_TARGET_DOCS=ON \
-B . -S ..
ninja
- name: Test Macos
if: matrix.platform == 'macos-13' || matrix.platform == 'macos-14'
run: |
platform=macos
echo "working dir is $PWD"
cd build
ctest -VV
echo "------ running FiniteVolume_x64 ------"
./bin/FiniteVolume_x64 || true
echo
echo "------ running NFsim_x64 ------"
./bin/NFsim_x64 || true
echo "------ running SundialsSolverStandalone_x64 ------"
./bin/SundialsSolverStandalone_x64 || true
echo "------ running VCellStoch_x64 ------"
./bin/VCellStoch_x64 || true
echo "------ running smoldyn_x64 ------"
./bin/smoldyn_x64 || true
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: false
- name: Install Windows Dependencies
if: matrix.platform == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
msystem: CLANG64
update: true
install: >
zip
git
mingw-w64-clang-x86_64-curl
mingw-w64-clang-x86_64-toolchain
mingw-w64-clang-x86_64-flang
mingw-w64-clang-x86_64-cmake
mingw-w64-clang-x86_64-boost
mingw-w64-clang-x86_64-hdf5
mingw-w64-clang-x86_64-libzip
mingw-w64-clang-x86_64-zlib
mingw-w64-clang-x86_64-libaec
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: false
- name: Build Windows
if: matrix.platform == 'windows-latest'
shell: msys2 {0}
run: |
platform=windows
echo "working dir is $PWD"
mkdir build
cd build
PATH="/c/Program\ Files/LLVM/bin:$PATH"
cmake \
-G Ninja \
-DCMAKE_C_COMPILER="clang.exe" \
-DCMAKE_CXX_COMPILER="clang++.exe" \
-DOPTION_TARGET_PYTHON_BINDING=OFF \
-DOPTION_TARGET_MESSAGING=OFF \
-DOPTION_TARGET_SMOLDYN_SOLVER=OFF \
-DOPTION_TARGET_FV_SOLVER=ON \
-DOPTION_TARGET_DOCS=OFF \
-B . -S ..
ninja -j 1
- name: Test Windows
if: matrix.platform == 'windows-latest'
shell: msys2 {0}
run: |
platform=windows
echo "working dir is $PWD"
cd build
ctest -VV
echo "------ running FiniteVolume_x64 ------"
./bin/FiniteVolume_x64 || true
echo
- name: Install Linux Dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libboost-all-dev
sudo apt-get install -y libhdf5-dev
sudo apt-get install -y ninja-build
gcc --version
gfortran --version
cmake --version
dpkg -s libboost-all-dev
dpkg -s libhdf5-dev
- name: Build Linux
if: matrix.platform == 'ubuntu-latest'
run: |
platform=linux
echo "working dir is $PWD"
mkdir build
cd build
cmake \
-G Ninja \
-DOPTION_TARGET_PYTHON_BINDING=OFF \
-DOPTION_TARGET_MESSAGING=OFF \
-DOPTION_TARGET_SMOLDYN_SOLVER=OFF \
-DOPTION_TARGET_FV_SOLVER=ON \
-DOPTION_TARGET_DOCS=ON \
-B . -S ..
ninja
- name: Test Linux
if: matrix.platform == 'ubuntu-latest'
run: |
platform=linux
echo "working dir is $PWD"
cd build
ctest -VV
echo "------ running FiniteVolume_x64 ------"
./bin/FiniteVolume_x64 || true
echo
- name: fix Macos shared object paths
if: matrix.platform == 'macos-13' || matrix.platform == 'macos-14'
shell: bash
run: |
mkdir build/upload
cd build/bin
ls *_x64 | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true
ls *.dylib | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true
ls *.dylib | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true
chmod u+w,+x *
tar czvf ../upload/mac64_bad_paths.tgz .
../../.github/scripts/install_name_tool_macos.sh
tar czvf ../upload/fvsolver_mac64.tgz --dereference .
- name: handle shared object paths for Windows native build
if: matrix.platform == 'windows-latest'
shell: msys2 {0}
run: |
mkdir build/upload
cd build/bin
ls *.exe | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
ls *.dll | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep '=> /' | grep -v build | grep -iv windows | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
chmod u+w,+x *
zip ../upload/fvsolver_win64.zip ./*
cd ../..
# fi
- name: handle shared object paths for Linux native build
if: matrix.platform == 'ubuntu-latest'
shell: bash
run: |
mkdir build/upload
cd build/bin
ls *_x64 | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
ls *.so | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
ls *.so | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
chmod u+w,+x *
tar czvf ../upload/fvsolver_linux64.tgz --dereference .
cd ../..
- name: Upload Intel Macos binaries
if: matrix.platform == 'macos-13'
uses: actions/upload-artifact@v4
with:
name: fvsolver_macos_x86_64.tgz
path: build/upload/fvsolver_mac64.tgz
- name: Upload ARM Macos binaries
if: matrix.platform == 'macos-14'
uses: actions/upload-artifact@v4
with:
name: fvsolver_macos_arm64.tgz
path: build/upload/fvsolver_mac64.tgz
- name: Upload Windows binaries
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: fvsolver_win64.zip
path: build/upload/fvsolver_win64.zip
- name: Upload Linux binaries
if: matrix.platform == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: fvsolver_linux64.tgz
path: build/upload/fvsolver_linux64.tgz
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: false