-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (147 loc) · 7.86 KB
/
build-libantimonyjs-github-actions.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
name: build-libantimonyjs-github-actions
run-name: ${{ github.actor }} is building libantimonyjs
on:
workflow_dispatch:
inputs:
antimony_version:
description: 'Antimony version number'
required: true
default: '2.13.4'
libsbml_version:
description: 'LibSBML version number'
required: true
default: '5.20.0'
jobs:
build-new-version-antimonyjs:
runs-on: ubuntu-latest
env:
EMSDK: emsdk
EMSCRIPTEN_VERS: '3.1.20'
EMSDK_NODE: emsdk/node/16.20.0_64bit/bin/node
SBML_VERS: ${{ inputs.libsbml_version }}
ANT_VERS: ${{ inputs.antimony_version }}
steps:
- uses: actions/checkout@v4
- name: get emscripten
run: git clone https://github.com/emscripten-core/emsdk.git
- name: change emsdk script permissions
run: chmod +x emsdk
working-directory: emsdk
- name: install emscripten sdk
run: ./emsdk install $EMSCRIPTEN_VERS
working-directory: emsdk
- name: activate emscripten
run: ./emsdk activate $EMSCRIPTEN_VERS
working-directory: emsdk
- run: echo "$GITHUB_WORKSPACE/emsdk/upstream/emscripten" >> $GITHUB_PATH
- run: echo "$GITHUB_WORKSPACE/emsdk" >> $GITHUB_PATH
- name: confirm emscripten works
run: emcc -v
- run: echo $PATH
- run: echo $EMSDK_NODE
- run: mkdir install
- run: wget https://github.com/libexpat/libexpat/releases/download/R_2_2_10/expat-2.2.10.tar.bz2
- run: tar -xf expat-2.2.10.tar.bz2
- run: mv expat-2.2.10 expat
- name: make expat build dir
run: mkdir build
working-directory: expat
- name: build expat lib
run: emcmake cmake .. -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install/expat
working-directory: expat/build
- name: Compile expat lib
run: emmake make
working-directory: expat/build
- name: install expat lib
run: emmake make install
working-directory: expat/build
- name: Get libSBML
run: wget https://github.com/sbmlteam/libsbml/archive/refs/tags/v$SBML_VERS.zip
- run: unzip v$SBML_VERS.zip
- run: mv libsbml-$SBML_VERS libsbml
- name: make libsbml build dir
run: mkdir build
working-directory: libsbml
- name: build libsbml library
run: emcmake cmake .. -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install/sbml -DCMAKE_BUILD_TYPE=Release -DWITH_CPP_NAMESPACE=ON -DWITH_EXPAT=ON -DWITH_LIBXML=OFF -DLIBSBML_SKIP_SHARED_LIBRARY=ON -DENABLE_ARRAYS=ON -DENABLE_COMP=ON -DENABLE_DISTRIB=ON -DENABLE_FBC=ON -DENABLE_GROUPS=ON -DENABLE_MULTI=ON -DENABLE_QUAL=ON -DWITH_STABLE_PACKAGES=ON -DWITH_SWIG=OFF -DEXPAT_INCLUDE_DIR=$GITHUB_WORKSPACE/install/expat/include -DEXPAT_LIBRARY=$GITHUB_WORKSPACE/install/expat/lib/libexpat.a
working-directory: libsbml/build
- name: compile libsbml lib
run: emmake make
working-directory: libsbml/build
- name: install libsbml
run: emmake make install
working-directory: libsbml/build
- name: Get antimony
run: wget https://github.com/sys-bio/antimony/archive/refs/tags/v$ANT_VERS.zip
- run: unzip v$ANT_VERS.zip
- run: mv antimony-$ANT_VERS/ antimony
- name: make antimony build dir
run: mkdir build
working-directory: antimony
- name: Build antimony library
run: emcmake cmake .. -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install/antimony -DCMAKE_BUILD_TYPE=Release -DEXPAT_LIBRARY=$GITHUB_WORKSPACE/install/expat/lib/libexpat.a -DLIBSBML_INCLUDE_DIR=$GITHUB_WORKSPACE/install/sbml/include -DLIBSBML_INSTALL_DIR=$GITHUB_WORKSPACE/install/sbml -DLIBSBML_LIBRARY=$GITHUB_WORKSPACE/install/sbml/lib/libsbml-static.a -DWITH_CELLML=OFF -DWITH_CHECK=OFF -DWITH_COMP_SBML=ON -DWITH_LIBSBML_COMPRESSION=OFF -DWITH_LIBSBML_EXPAT=ON -DWITH_LIBSBML_LIBXML=OFF -DWITH_LIBSBML_XERCES=OFF -DWITH_PYTHON=OFF -DWITH_QTANTIMONY=OFF -DWITH_SBML=ON -DWITH_STATIC_SBML=ON -DWITH_SWIG=OFF
working-directory: antimony/build
- name: Compile antimony lib
run: emmake make
working-directory: antimony/build
- name: Install antimony lib
run: emmake make install
working-directory: antimony/build
- name: Generate antimony javascript and wasm files
run: emcc -Oz -sDISABLE_EXCEPTION_CATCHING=0 -sMODULARIZE=1 -sSINGLE_FILE=1 -sEXPORT_NAME=libantimony -sALLOW_MEMORY_GROWTH=1 -I$GITHUB_WORKSPACE/install/antimony/include -I$GITHUB_WORKSPACE/install/sbml/include -I$GITHUB_WORKSPACE/install/expat/include $GITHUB_WORKSPACE/install/antimony/lib/libantimony.a $GITHUB_WORKSPACE/install/sbml/lib/libsbml-static.a $GITHUB_WORKSPACE/install/expat/lib/libexpat.a -o libantimony.js -sEXPORTED_FUNCTIONS=_loadString,_loadAntimonyString,_loadSBMLString,_clearPreviousLoads,_getAntimonyString,_getSBMLString,_getCompSBMLString,_getLastError,_getWarnings,_getSBMLInfoMessages,_getSBMLWarnings,_freeAll,_malloc,_free -sEXPORTED_RUNTIME_METHODS=ccall,cwrap,allocateUTF8,UTF8ToString
working-directory: install
- name: List build libantimonyjs files
run: ls -l
working-directory: install
- name: Copy libantimonyjs to test dir
run: cp libantimony.* $GITHUB_WORKSPACE/test
working-directory: install
- name: check built files exist
run: ls -l
working-directory: test
- name: Check node is available
run: node -v
working-directory: test
- name: run tests
run: node test_antimony.js >> results.txt
working-directory: test
- name: output test results
run: cat results.txt
working-directory: test
- name: Check test results
run: grep 'Fail- 0' results.txt
working-directory: test
- name: Commit new libantimony files
run: mkdir v$ANT_VERS
working-directory: release
- name: Copy libantimonyjs to release dir
run: cp libantimony.* $GITHUB_WORKSPACE/release/v$ANT_VERS
working-directory: install
- name: Copy antimony_wrap.js to release dir
run: cp $GITHUB_WORKSPACE/scripts/antimony_wrap.js $GITHUB_WORKSPACE/release/v$ANT_VERS
- name: generate ReleaseInfo.txt
run: echo "libantimonyjs release $ANT_VERS" > v$ANT_VERS/ReleaseInfo.txt
working-directory: release
- run: echo "libSBML source- $SBML_VERS" >> v$ANT_VERS/ReleaseInfo.txt
working-directory: release
- run: echo "Antimony source- $ANT_VERS" >> v$ANT_VERS/ReleaseInfo.txt
working-directory: release
- run: echo "Emscripten version- $EMSCRIPTEN_VERS" >> v$ANT_VERS/ReleaseInfo.txt
working-directory: release
- run: echo "Following methods are available- From Antimony library - _loadString, _loadAntimonyString, _loadSBMLString, _clearPreviousLoads, _getAntimonyString, _freeAll, _getSBMLString, _getCompSBMLString, _getLastError, _getWarnings, _getSBMLInfoMessages, _getSBMLWarnings." >> v$ANT_VERS/ReleaseInfo.txt
working-directory: release
- run: echo "From Emscripten - _malloc, _free, ccall, cwrap, allocateUTF8, UTF8ToString." >> v$ANT_VERS/ReleaseInfo.txt
working-directory: release
- run: cp -f v$ANT_VERS/ReleaseInfo.txt $GITHUB_WORKSPACE/docs/demo
working-directory: release
- name: Copy libantimonyjs to docs dir
run: cp -f libantimony.* $GITHUB_WORKSPACE/docs/demo
working-directory: install
- name: Check in changes
run: |
date > generated.txt
git config user.name github-actions
git config user.email [email protected]
git add release/v$ANT_VERS/libantimony.js release/v$ANT_VERS/ReleaseInfo.txt
git commit -m "new build for antimony v$ANT_VERS" release/v$ANT_VERS/libantimony.js release/v$ANT_VERS/ReleaseInfo.txt docs/demo/libantimony.js docs/demo/ReleaseInfo.txt
git push