-
Notifications
You must be signed in to change notification settings - Fork 4
375 lines (343 loc) · 16.3 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
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
365
366
367
368
369
370
371
372
373
374
375
name: BuildAntimony
on:
push:
branches:
- develop
pull_request:
branches:
- '**'
jobs:
build_on_OSs:
name: Build Antimony on ${{ matrix.platform.name }}
strategy:
fail-fast: false
matrix:
platform:
- name: macos-12-release
os_type: macos
os_name: macos-12
build_type: Release
build_python: ON
build_qt_antimony: ON
- name: macos-12-debug
os_type: macos
os_name: macos-12
build_type: Debug
build_python: ON
build_qt_antimony: ON
- name: macos-14-release
os_type: macos
os_name: macos-14
build_type: Release
build_python: ON
build_qt_antimony: OFF
- name: macos-14-debug
os_type: macos
os_name: macos-14
build_type: Debug
build_python: ON
build_qt_antimony: OFF
- name: ubuntu-latest-release
os_type: ubuntu
os_name: ubuntu-latest
build_type: Release
build_python: ON
build_qt_antimony: ON
- name: ubuntu-latest-debug
os_type: ubuntu
os_name: ubuntu-latest
build_type: Debug
build_python: ON
build_qt_antimony: ON
- name: windows-latest-release
os_type: windows
os_name: windows-latest
expat_lib_name: libexpatmd.lib
build_type: Release
build_python: ON
build_qt_antimony: ON
- name: windows-latest-debug
os_type: windows
os_name: windows-latest
expat_lib_name: libexpatdMD.lib
build_type: Debug
build_python: OFF
build_qt_antimony: ON
- name: manylinux2014-release
os_type: manylinux
os_name: ubuntu-latest
container_image: quay.io/pypa/manylinux2014_x86_64
build_type: Release
build_python: ON
build_qt_antimony: OFF
- name: manylinux2014-debug
os_type: manylinux
os_name: ubuntu-latest
container_image: quay.io/pypa/manylinux2014_x86_64
build_type: Debug
build_python: ON
build_qt_antimony: OFF
libroadrunner_deps_owner: [ "sys-bio" ]
libroadrunner_deps_repo: [ "libroadrunner-deps" ]
libroadrunner_deps_name: [ "libroadrunner-deps" ]
libroadrunner_deps_release_version: [ "v2.1.1" ]
python_version: [ "3.12" ]
runs-on: ${{ matrix.platform.os_name }}
container:
image: ${{ matrix.platform.container_image || '' }}
steps:
- name: Checkout Antimony
uses: actions/checkout@v3
- name: Set MSVC as the default compiler on Windows
if: matrix.platform.os_type == 'windows'
uses: ilammy/[email protected]
- name: Upgrade gcc on Linux
if: matrix.platform.os_type == 'manylinux'
shell: bash
run: |
if [ "${{ matrix.platform.os_type }}" == 'ubuntu' ]; then
apt-get update
apt-get install -y software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test
apt-get update
apt-get install -y gcc-11 g++-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 90
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 90
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
yum install -y centos-release-scl
yum install -y devtoolset-11
scl enable devtoolset-11 bash
echo "/opt/rh/devtoolset-11/root/usr/bin" >> "${GITHUB_PATH}"
fi
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@v4
- name: Get Host Architecture
shell: bash
run: |
architecture=$(uname -m)
echo "host_architecture=$architecture" >> "${GITHUB_ENV}"
if [ "${{ matrix.platform.os_type }}" == 'macos' ]; then
echo "OSX_ARCHITECTURES=$architecture" >> "${GITHUB_ENV}"
fi
- name: Install ccache
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
if [ "${{ matrix.platform.os_type }}" == 'macos' ]; then
brew install ccache
elif [ "${{ matrix.platform.os_type }}" == 'ubuntu' ]; then
sudo apt-get update
sudo apt-get install -y ccache
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
mkdir -p ccache
cd ccache
curl -L https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1.tar.gz > ccache.tar.gz
tar -zxf ccache.tar.gz
rm ccache.tar.gz
mkdir -p build-ccache
mkdir -p install-ccache
cd build-ccache
cmake -DCMAKE_INSTALL_PREFIX="$RUNNER_WORKSPACE/ccache/install-ccache" -DCMAKE_BUILD_TYPE=Release ../ccache-4.9.1
cmake --build . --target install
echo "$RUNNER_WORKSPACE/ccache/install-ccache/bin" >> $GITHUB_PATH
fi
- name: Prepare ccache timestamp on non-Windows platforms
if: matrix.platform.os_type != 'windows'
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: Set ccache cache directory on non-Windows
if: matrix.platform.os_type != 'windows'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
echo "CCACHE_DIR=${RUNNER_WORKSPACE}/.ccache" >> "${GITHUB_ENV}"
echo "COMPILER_LAUNCHER=ccache" >> "${GITHUB_ENV}"
- name: Cache ccache files on non-Windows
if: matrix.platform.os_type != 'windows'
uses: actions/cache@v3
with:
path: ${RUNNER_WORKSPACE}/.ccache
key:
${{ runner.os }}-${{ steps.ccache_cache_timestamp.outputs.timestamp
}}
restore-keys: |
${{ runner.os }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
${{ runner.os }}-
- name: Setup Python for non-Manylinux platforms
if: matrix.platform.build_python == 'ON' && matrix.platform.os_type != 'manylinux'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Setup Python for Manylinux platforms
if: matrix.platform.build_python == 'ON' && matrix.platform.os_type == 'manylinux'
shell: bash
run: |
yum install -y wget
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p /Miniconda3
/Miniconda3/bin/conda create -y --name py3 python=${{ matrix.python_version }}
/Miniconda3/bin/conda init && bash ~/.bashrc && . ~/.bashrc cd ${RUNNER_WORKSPACE}
# sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure
echo "python_exe=/Miniconda3/envs/py3/bin/python" >> $GITHUB_ENV
echo "python_dir=/Miniconda3/envs/py3" >> $GITHUB_ENV
- name: Save Python executable for Windows
if: matrix.platform.build_python == 'ON' && matrix.platform.os_type == 'windows'
run: |
cd ${{ env.pythonLocation }}
$pattern = '[\\]'
$pythonWinExecutable = "${{env.pythonLocation }}" -replace $pattern, '/'
echo "python_exe=$pythonWinExecutable/python.exe" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "python_v1_dir=$pythonWinExecutable" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Download dependencies binaries
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
mkdir -p ${{ matrix.libroadrunner_deps_name }}-binaries
cd ${{ matrix.libroadrunner_deps_name }}-binaries
if [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
compiler_version=$(ls "C:\Program Files\Microsoft Visual Studio")
binary_file_name=${{ matrix.libroadrunner_deps_name }}-${{ matrix.platform.os_type }}-msvc${compiler_version}-${host_architecture}-${{ matrix.platform.build_type }}
elif [ "${{ matrix.platform.os_type }}" == 'macos' ]; then
os_version=$(sw_vers -productVersion | cut -d '.' -f 1)
binary_file_name=${{ matrix.libroadrunner_deps_name }}-${{ matrix.platform.os_type }}-${os_version}-${host_architecture}-${{ matrix.platform.build_type }}
elif [ "${{ matrix.platform.os_type }}" == 'ubuntu' ]; then
os_version=$(lsb_release -rs | cut -d '.' -f 1)
binary_file_name=${{ matrix.libroadrunner_deps_name }}-${{ matrix.platform.os_type }}-${os_version}-${host_architecture}-${{ matrix.platform.build_type }}
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
os_name="${{ matrix.platform.name }}"
os_name_without_build_type="${os_name%%-*}"
binary_file_name=${{ matrix.libroadrunner_deps_name }}-${os_name_without_build_type}-${host_architecture}-${{ matrix.platform.build_type }}
fi
curl -LO "https://github.com/${{ matrix.libroadrunner_deps_owner }}/${{ matrix.libroadrunner_deps_repo }}/releases/download/${{ matrix.libroadrunner_deps_release_version }}/$binary_file_name.zip"
unzip -q $binary_file_name.zip
rm $binary_file_name.zip
echo LIBSBML_INSTALL_DIR="-DLIBSBML_INSTALL_DIR=${RUNNER_WORKSPACE}/${{ matrix.libroadrunner_deps_name }}-binaries" >> "${GITHUB_ENV}"
if [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
echo EXPAT_LIBRARY="-DEXPAT_LIBRARY=${RUNNER_WORKSPACE}/${{ matrix.libroadrunner_deps_name }}-binaries/lib/${{ matrix.platform.expat_lib_name }}" >> "${GITHUB_ENV}"
fi
- name: Install libcheck
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
mkdir -p check
cd check
if [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
curl -L https://github.com/sys-bio/antimony/releases/download/libcheck/check-${{ matrix.platform.build_type }}.zip > check.zip
unzip -q check.zip -d check
rm check.zip
echo LIBCHECK_INCLUDE_DIR="-DLIBCHECK_INCLUDE_DIR=${RUNNER_WORKSPACE}/check/check/include" >> "${GITHUB_ENV}"
echo LIBCHECK_LIBRARY="-DLIBCHECK_LIBRARY=${RUNNER_WORKSPACE}/check/check/lib/libcheck.lib" >> "${GITHUB_ENV}"
else
curl -L https://github.com/libcheck/check/releases/download/0.15.2/check-0.15.2.tar.gz > check.tar.gz
tar -zxf check.tar.gz
rm check.tar.gz
mkdir -p build-check
mkdir -p install-check
cd build-check
cmake -G "Ninja" -DCMAKE_INSTALL_PREFIX="${RUNNER_WORKSPACE}/check/install-check" -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=${{ matrix.platform.arch }} ../check-0.15.2
cmake --build . --target install
echo LIBCHECK_INCLUDE_DIR="-DLIBCHECK_INCLUDE_DIR=${RUNNER_WORKSPACE}/check/install-check/include" >> "${GITHUB_ENV}"
if [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
echo LIBCHECK_LIBRARY="-DLIBCHECK_LIBRARY=${RUNNER_WORKSPACE}/check/install-check/lib64/libcheck.so" >> "${GITHUB_ENV}"
else
echo LIBCHECK_LIBRARY="-DLIBCHECK_LIBRARY=${RUNNER_WORKSPACE}/check/install-check/lib/libcheck.a" >> "${GITHUB_ENV}"
fi
fi
- name: Install Qt
if : matrix.platform.build_qt_antimony == 'ON'
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
- name: Create build directory
shell: bash
run: mkdir -p ${RUNNER_WORKSPACE}/build-antimony
- name: Configure CMake for Antimony
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/build-antimony
cmake $GITHUB_WORKSPACE \
-G "Ninja" \
-DCMAKE_C_COMPILER_LAUNCHER=${COMPILER_LAUNCHER} \
-DCMAKE_CXX_COMPILER_LAUNCHER=${COMPILER_LAUNCHER} \
-DCMAKE_BUILD_TYPE=${{ matrix.platform.build_type }} \
-DUSE_UNIVERSAL_BINARIES=OFF \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.platform.arch }} \
-DCMAKE_INSTALL_PREFIX="${RUNNER_WORKSPACE}/install-antimony" \
-DWITH_STATIC_SBML=ON \
${LIBSBML_INSTALL_DIR} \
-DWITH_QTANTIMONY=${{ matrix.platform.build_qt_antimony }} \
-DWITH_LIBSBML_EXPAT=ON \
${EXPAT_LIBRARY} \
-DWITH_LIBSBML_LIBXML=OFF \
-DWITH_CHECK=ON \
${LIBCHECK_INCLUDE_DIR} \
${LIBCHECK_LIBRARY} \
-DWITH_PYTHON=${{ matrix.platform.build_python }}
- name: Build and install Antimony
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/build-antimony
cmake --build . --target install --config ${{ matrix.platform.build_type }}
- name: Run Antimony tests
if : matrix.platform.build_type == 'Release'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/build-antimony
ctest -C ${{ matrix.platform.build_type }} --output-on-failure --verbose --extra-verbose --progress
- name: Set artifacts path and name
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
echo "artifacts_name=antimony-${{ matrix.platform.name }}" >> "${GITHUB_ENV}"
# we need to use relative path as actions/upload-artifact@v1 cannot find it on containerized runners
echo "artifacts_path=${RUNNER_WORKSPACE}/install-antimony" >> "${GITHUB_ENV}"
- name: Upload Antimony binaries
uses: actions/upload-artifact@v3
with:
name: ${{env.artifacts_name}}
path: ${{env.artifacts_path}}
- name: Create Python wheel artifacts
if: matrix.platform.build_type == 'Release' && matrix.platform.build_python == 'ON'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/install-antimony/bindings/python
if [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
${{env.python_exe}} -m pip install setuptools wheel
${{env.python_exe}} setup.py bdist_wheel
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
python${{ matrix.python_version }} -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org setuptools wheel
python${{ matrix.python_version }} setup.py bdist_wheel
else
python${{ matrix.python_version }} -m pip install setuptools wheel
python${{ matrix.python_version }} setup.py bdist_wheel
fi
- name: Rename Python wheel artifacts
if: matrix.platform.build_type == 'Release' && matrix.platform.build_python == 'ON'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/install-antimony/bindings/python/dist
if [ "${{ matrix.platform.os_type }}" == 'macos' ]; then
mv antimony*.whl $(echo antimony*.whl | sed "s/universal2/${host_architecture}/g")
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
mv antimony*.whl $(echo antimony*.whl | sed "s/linux/manylinux2014/g")
fi
python_version_number=$(echo "${{ matrix.python_version }}" | tr -d '.')
mv antimony*.whl $(echo antimony*.whl | sed "s/cp${python_version_number}-cp${python_version_number}/py3-none/g")
- name: Set Python wheel artifacts path and name
if: matrix.platform.build_type == 'Release' && matrix.platform.build_python == 'ON'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
python_wheel_file_name=$(ls install-antimony/bindings/python/dist | grep '^antimony')
echo "python_wheel_artifacts_name=${python_wheel_file_name}" >> "${GITHUB_ENV}"
# we need to use relative path as actions/upload-artifact@v1 cannot find it on containerized runners
echo "python_wheel_artifacts_file=../install-antimony/bindings/python/dist/$python_wheel_file_name" >> "${GITHUB_ENV}"
- name: Upload Python wheel artifacts
if: matrix.platform.build_type == 'Release' && matrix.platform.build_python == 'ON'
uses: actions/upload-artifact@v1
with:
name: ${{env.python_wheel_artifacts_name}}
path: ${{env.python_wheel_artifacts_file}}