-
Notifications
You must be signed in to change notification settings - Fork 28
379 lines (342 loc) · 14.5 KB
/
store-artefact.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
376
377
378
379
name: Nightly build (binaries)
on:
workflow_dispatch:
schedule:
- cron: "0 5 * * *"
env:
BUILD_TYPE: Release
jobs:
build:
if: github.repository_owner == 'sbmlteam'
name:
${{ matrix.platform }}, Parser option ${{ matrix.xml_parser_option }},
with namespaces ${{ matrix.with_namespace}}, strict includes ${{
matrix.strict }}, with examples ${{ matrix.with_examples}}, package option
${{ matrix.package_option}}
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
xml_parser_option: ["-DWITH_EXPAT=ON"]
with_namespace: ["True"]
strict: ["True"]
with_examples: ["True"]
package_option: ["-DWITH_ALL_PACKAGES=ON", "-DWITH_STABLE_PACKAGES=ON"]
language_bindings:
[
"-DWITH_JAVA=True -DWITH_CSHARP=True -DWITH_PYTHON=True
-DWITH_R=OFF",
]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Add msbuild to PATH (Windows)
if: matrix.platform == 'windows-latest'
uses: ilammy/[email protected]
### configure the operating system ###
- name: Cache Windows dependencies and SWIG
# On Windows, the dependencies live inside the source folder, ie `.`.
# For the CI, we put SWIG there too, for simplicity.
if: matrix.platform == 'windows-latest'
id: cache-win-dependencies-static
uses: actions/cache@v2
with:
path: |
./dependencies
./swig
key: ${{ runner.os }}-dependencies-static-2
- name: Download pre-built Windows dependencies and SWIG
# Windows dependencies have to be in a subfolder called `dependencies`, directly under the git repository root.
# also gets SWIG, completing the set of dependencies needed for windows
if:
matrix.platform == 'windows-latest' &&
steps.cache-win-dependencies-static.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L https://github.com/sbmlteam/libSBML-dependencies/releases/download/latest/libSBML-dependencies-1.0.1-x64-Release-static.zip > dependencies.zip
unzip dependencies.zip
mv libSBML-dependencies-1.0.1-x64-Release-static dependencies
curl -L https://prdownloads.sourceforge.net/swig/swigwin-3.0.12.zip > swig.zip
unzip -o swig.zip -d swig
- name: setup Windows environment
# this is separate from the SWIG download itself, because it needs to be added to the path also when SWIG is cached
if: matrix.platform == 'windows-latest'
shell: bash
run: |
echo $GITHUB_WORKSPACE"/swig/swigwin-3.0.12/" >> $GITHUB_PATH
echo RUNTIME_LINKING_OPTION="-DWITH_STATIC_RUNTIME=ON" >> "${GITHUB_ENV}"
./dev/utilities/expdef/expdef64.exe -dRlib.def -l R.dll
echo R_PLATFORM_SPECIFIC_OPTIONS="-DR_LIB=${GITHUB_WORKSPACE}\Rlib.lib" >> "${GITHUB_ENV}"
- name: Find Windows R include path
# robust to R version changing
if: matrix.platform == 'windows-latest'
shell: bash
run: |
cd /c/Program\ Files/R/
R_INCLUDE_DIR_VERSION=$(ls -d *)
echo R_INCLUDE_PATH="/c/Program Files/R/"$R_INCLUDE_DIR_VERSION"/include" >> "${GITHUB_ENV}"
- name: Install Ubuntu dependencies
# ubuntu already has SWIG but expat is too old
if: matrix.platform == 'ubuntu-latest'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y check ccache
echo PYTHON_LINKING_OPTION="-DPYTHON_USE_DYNAMIC_LOOKUP=ON" >> "${GITHUB_ENV}"
git clone https://github.com/libexpat/libexpat
cmake -G Ninja -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DEXPAT_BUILD_TESTS=OFF -DEXPAT_BUILD_TOOLS=OFF -DEXPAT_BUILD_EXAMPLES=OFF -DEXPAT_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=./dependencies -B libexpat -S libexpat/expat
cmake --build libexpat
cmake --install libexpat
- name: Install MacOS dependencies
# MacOS already has expat by default
if: matrix.platform == 'macos-latest'
shell: bash
run: |
brew install check swig ccache
echo PYTHON_LINKING_OPTION="-DPYTHON_USE_DYNAMIC_LOOKUP=ON" >> "${GITHUB_ENV}"
- name: Unix R options
if: matrix.platform != 'windows-latest'
shell: bash
run:
echo R_PLATFORM_SPECIFIC_OPTIONS="-DWITH_CREATE_R_SOURCE=ON
-DWITH_SKIP_R_BINARY=ON" >> "${GITHUB_ENV}"
### setup ccache, not on Windows ###
- name: Prepare ccache timestamp
if: matrix.platform != 'windows-latest'
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
if: matrix.platform != 'windows-latest'
shell: bash
run: |
echo "CCACHE_DIR=${{runner.workspace}}/.ccache" >> "${GITHUB_ENV}"
echo "COMPILER_LAUNCHER=ccache" >> "${GITHUB_ENV}"
- name: cache ccache files
if: matrix.platform != 'windows-latest'
uses: actions/cache@v2
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 }}-
### build the project ###
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake for XML_parser (expat)
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
mkdir ../install
cmake $GITHUB_WORKSPACE \
-G "Ninja" \
-DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_C_COMPILER_LAUNCHER=${COMPILER_LAUNCHER} \
-DCMAKE_CXX_COMPILER_LAUNCHER=${COMPILER_LAUNCHER} \
-DCMAKE_CXX_STANDARD=98 \
-DWITH_CHECK=True \
-DWITH_CPP_NAMESPACE=${{matrix.with_namespace}} \
-DLIBSBML_USE_STRICT_INCLUDES=${{matrix.strict}} \
-DWITH_EXAMPLES=${{matrix.with_examples}} \
-DWITH_LIBXML=OFF \
${{matrix.xml_parser_option}} \
${{matrix.package_option}} \
${{matrix.language_bindings}} \
${R_PLATFORM_SPECIFIC_OPTIONS} \
-DR_INCLUDE_DIRS="$R_INCLUDE_PATH" \
${RUNTIME_LINKING_OPTION} \
${PYTHON_LINKING_OPTION} \
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cmake --build . --config $BUILD_TYPE
# - name: Build Unix R binaries from source package
# if: matrix.platform != 'windows-latest'
# shell: bash
# working-directory: ${{runner.workspace}}/build
# run: |
# mkdir r-binaries
# R CMD INSTALL -l r-binaries --build ./src/bindings/r/out/libSBML_5.19.3.tar.gz
### run tests ###
- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
run: ctest -C $BUILD_TYPE
### create binaries ###
- name: Install
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --install . --config $BUILD_TYPE
- name: Remove large .lib file on Windows
### file temporarily needed for bindings ###
if: matrix.platform == 'windows-latest'
working-directory: ${{runner.workspace}}/install
shell: bash
run: rm lib/libsbml-static.lib
### setup artifact environment ###
- name: Store libSBML version in environment
shell: bash
run: echo "LIBSBML_VERSION=$( cat VERSION.txt)" >> "${GITHUB_ENV}"
- name: Set artifact name suffix to stable packages
if: matrix.package_option=='-DWITH_STABLE_PACKAGES=ON'
shell: bash
run: |
echo "ARTIFACT_NAME_SUFFIX=stable-packages" >> "${GITHUB_ENV}"
- name: Set artifact name suffix to all packages
if: matrix.package_option=='-DWITH_ALL_PACKAGES=ON'
shell: bash
run: |
echo "ARTIFACT_NAME_SUFFIX=all-packages" >> "${GITHUB_ENV}"
### Upload installed versions ###
- name: Upload Windows binary archive
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@v2
with:
name:
Windows (zip, libSBML ${{env.LIBSBML_VERSION}},
${{env.ARTIFACT_NAME_SUFFIX}})
path: ${{runner.workspace}}/install/*
retention-days: 1
if-no-files-found: error
- name: Upload MacOS binary archive
if: matrix.platform == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name:
MacOS (zip, libSBML ${{env.LIBSBML_VERSION}},
${{env.ARTIFACT_NAME_SUFFIX}})
path: |
${{runner.workspace}}/install/*
${{runner.workspace}}/build/r-binaries/*
retention-days: 1
if-no-files-found: error
- name: Upload Ubuntu binary archive
if: matrix.platform == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name:
Ubuntu nightly (zip, libSBML ${{env.LIBSBML_VERSION}},
${{env.ARTIFACT_NAME_SUFFIX}})
path: |
${{runner.workspace}}/install/*
# ${{runner.workspace}}/build/r-binaries/*
retention-days: 1
if-no-files-found: error
manylinuxbuild:
if: github.repository_owner == 'sbmlteam'
name:
${{ matrix.container }}, Parser option ${{ matrix.xml_parser_option }},
with namespaces ${{ matrix.with_namespace}}, strict includes ${{
matrix.strict }}, with examples ${{ matrix.with_examples}}, package option
${{ matrix.package_option}}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
xml_parser_option: ["-DWITH_EXPAT=ON"]
with_namespace: ["True"]
strict: ["True"]
with_examples: ["True"]
package_option: ["-DWITH_ALL_PACKAGES=ON", "-DWITH_STABLE_PACKAGES=ON"]
cpp_standard: [98]
language_bindings:
["-DWITH_JAVA=True -DWITH_PYTHON=True -DWITH_CSHARP=True -DWITH_R=True"]
container: ["quay.io/pypa/manylinux2010_x86_64"]
runs-on: ${{ matrix.platform }}
container: ${{ matrix.container}}
steps:
- uses: actions/checkout@v1
- name: install Swig 4 from source
run: |
yum install -y pcre-devel
echo "SWIG_DIR=/usr/local/swig/" >> "${GITHUB_ENV}"
curl -L https://sourceforge.net/projects/swig/files/swig/swig-4.0.2/swig-4.0.2.tar.gz/download > swig.tar.gz
tar -zxvf swig.tar.gz
cd swig-4.0.2/
./configure --disable-dependency-tracking --prefix=$SWIG_DIR
make clean
make -j 2
make install
swig -version
- name: install CMake using pip
run: |
/opt/python/cp38-cp38/bin/pip install cmake
ln -s /opt/python/cp38-cp38/bin/cmake /usr/bin/cmake
ln -s /opt/python/cp38-cp38/bin/ctest /usr/bin/ctest
cmake --version
ctest --version
- name: Install dependencies, configure, build
run: |
yum install -y libxml2-devel check-devel java-devel mono-devel R
git clone https://github.com/libexpat/libexpat
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DEXPAT_BUILD_TESTS=OFF -DEXPAT_BUILD_TOOLS=OFF -DEXPAT_BUILD_EXAMPLES=OFF -DEXPAT_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=./dependencies -B libexpat -S libexpat/expat
cmake --build libexpat
cmake --install libexpat
cd ..
mkdir build
cd build
mkdir ../install
cmake ../libsbml \
-DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_CXX_STANDARD=${{matrix.cpp_standard}} \
-DWITH_CHECK=True \
-DWITH_CPP_NAMESPACE=${{matrix.with_namespace}} \
-DLIBSBML_USE_STRICT_INCLUDES=${{matrix.strict}} \
-DWITH_EXAMPLES=${{matrix.with_examples}} \
-DWITH_LIBXML=OFF \
${{matrix.xml_parser_option}} \
${{matrix.package_option}} \
${{matrix.language_bindings}} \
-DWITH_CREATE_R_SOURCE=ON \
-DWITH_SKIP_R_BINARY=ON \
-DPYTHON_EXECUTABLE=/opt/python/cp38-cp38/bin/python \
-DPYTHON_INCLUDE_DIR=/opt/python/cp38-cp38/include/python3.8/ \
-DWITH_STATIC_RUNTIME=ON \
-DPYTHON_USE_DYNAMIC_LOOKUP=ON
cmake --build . --config $BUILD_TYPE
# mkdir r-binaries
# R CMD INSTALL -l r-binaries --build ./src/bindings/r/out/libSBML_5.19.3.tar.gz
- name: Test
run: |
cd ../build
ctest -V -C $BUILD_TYPE
### create binaries ###
- name: Install
run: |
cd ../build
cmake --install . --config $BUILD_TYPE
### setup artifact environment ###
- name: Store libSBML version in environment
run: |
echo "LIBSBML_VERSION=$( cat VERSION.txt)" >> "${GITHUB_ENV}"
- name: Set artifact name suffix to stable packages
if: matrix.package_option=='-DWITH_STABLE_PACKAGES=ON'
run: |
echo "ARTIFACT_NAME_SUFFIX=stable-packages" >> "${GITHUB_ENV}"
- name: Set artifact name suffix to all packages
if: matrix.package_option=='-DWITH_ALL_PACKAGES=ON'
run: |
echo "ARTIFACT_NAME_SUFFIX=all-packages" >> "${GITHUB_ENV}"
- name: Upload Manylinux2010 binary archive
uses: actions/upload-artifact@v1 # note v1 used here, because v2 incompatible
with:
name:
Manylinux2010 nightly (zip, libSBML ${{env.LIBSBML_VERSION}},
${{env.ARTIFACT_NAME_SUFFIX}})
path: ../install # paths handled differently by v1 - note that "./install/*" does not work
# - name: Upload Manylinux2010 R binary archive
# uses: actions/upload-artifact@v1 # note v1 used here, because v2 incompatible
# with:
# name:
# Manylinux2010 R nightly (zip, libSBML ${{env.LIBSBML_VERSION}},
# ${{env.ARTIFACT_NAME_SUFFIX}})
# path: ../build/r-binaries # paths handled differently by v1 - note that v1 doesn't allow multiple paths