Building libsbmlnetworkjs #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-libsbmlnetworkjs-github-actions | |
run-name: Building libsbmlnetworkjs | |
on: | |
workflow_dispatch: | |
inputs: | |
sbmlnetwork_version: | |
description: 'SBMLNetwork version number' | |
required: true | |
default: '0.4.5' | |
libsbml_version: | |
description: 'LibSBML version number' | |
required: true | |
default: '5.20.0' | |
jobs: | |
build-new-version-libsbmlnetworkjs: | |
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 }} | |
SBMLNETWORK_VERS: ${{ inputs.SBMLNETWORK_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_LAYOUT=ON -DENABLE_RENDER=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 SBMLNetwork | |
run: wget https://github.com/sys-bio/SBMLNetwork/archive/refs/tags/v$SBMLNETWORK_VERS.zip | |
- run: unzip v$SBMLNETWORK_VERS.zip | |
- run: mv SBMLNetwork-$SBMLNETWORK_VERS/ SBMLNetwork | |
- name: make SBMLNetwork build dir | |
run: mkdir build | |
working-directory: SBMLNetwork | |
- name: Build SBMLNetwork library | |
run: emcmake cmake .. -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install/SBMLNetwork -DCMAKE_BUILD_TYPE=Release -DEXPAT_INSTALL_PREFIX=$GITHUB_WORKSPACE/install/expat -DLIBEXPAT_LIBRARY=$GITHUB_WORKSPACE/install/expat/lib/libexpat.a -DLIBSBML_INSTALL_PREFIX=$GITHUB_WORKSPACE/install/sbml -DLIBSBML_LIBRARY=$GITHUB_WORKSPACE/install/sbml/lib/libsbml-static.a -DWITH_PYTHON=OFF | |
working-directory: SBMLNetwork/build | |
- name: Compile SBMLNetwork lib | |
run: emmake make | |
working-directory: SBMLNetwork/build | |
- name: Install SBMLNetwork lib | |
run: emmake make install | |
working-directory: SBMLNetwork/build | |
- name: Generate SBMLNetwork javascript and wasm files | |
run: em++ -I$GITHUB_WORKSPACE/install/SBMLNetwork/include -I$GITHUB_WORKSPACE/install/sbml/include -I$GITHUB_WORKSPACE/install/expat/include $GITHUB_WORKSPACE/install/SBMLNetwork/lib/libsbmlnetwork.a $GITHUB_WORKSPACE/install/sbml/lib/libsbml-static.a $GITHUB_WORKSPACE/install/expat/lib/libexpat.a -o libsbmlnetwork.js -s WASM=1 -s LINKABLE=1 -s EXPORT_ALL=1 -s EXPORTED_RUNTIME_METHODS='["ccall", "cwrap", "allocateUTF8", "UTF8ToString"]' | |
working-directory: install | |
- name: List build libsbmlnetworkjs files | |
run: ls -l | |
working-directory: install | |
- name: Build output directory | |
run: | | |
mkdir -p $GITHUB_WORKSPACE/libsbmlnetworkjs | |
echo "artifacts_path=$GITHUB_WORKSPACE/libsbmlnetworkjs" >> "${GITHUB_ENV}" | |
- name: Copy libsbmlnetworkjs files to the workspace | |
run: | | |
cp install/libsbmlnetwork.js $GITHUB_WORKSPACE/libsbmlnetworkjs/ | |
cp install/libsbmlnetwork.wasm $GITHUB_WORKSPACE/libsbmlnetworkjs/ | |
- name: Verify copied files | |
run: ls -l $GITHUB_WORKSPACE/libsbmlnetworkjs | |
- name: Upload libsbmlnetworkjs files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libsbmlnetworkjs | |
path: ${{env.artifacts_path}} |