Skip to content

- correct path

- correct path #519

Workflow file for this run

name: CMake (rapid build on push)
on: [push]
env:
BUILD_TYPE: Release
jobs:
build:
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}}, c++ standard ${{matrix.cpp_standard}}
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
xml_parser_option: ["-DWITH_EXPAT"]
with_namespace: ["True"]
strict: ["True"]
with_examples: ["True"]
package_option: ["-DWITH_ALL_PACKAGES=ON"]
language_bindings:
[ "-DWITH_JAVA=True -DWITH_CSHARP=True"]
cpp_standard: [98, 20]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Add msbuild to PATH (Windows)
if: matrix.platform == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
### 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@v4
with:
path: |
./dependencies
key: ${{ runner.os }}-dependencies-static
- 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
- name: Download SWIG on Windows
if: matrix.platform == 'windows-latest'
shell: bash
run: |
curl -L https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.0.2/swigwin-4.0.2.zip/download > swig.zip
unzip -o swig.zip -d swig
echo $GITHUB_WORKSPACE"/swig/swigwin-4.0.2/" >> $GITHUB_PATH
- 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 RUNTIME_LINKING_OPTION="-DWITH_STATIC_RUNTIME=ON" >> "${GITHUB_ENV}"
echo PYTHON_LINKING_OPTION="-DWITH_PYTHON=ON" >> "${GITHUB_ENV}"
- name: Install Ubuntu dependencies
# ubuntu already has SWIG and libxml2 by default
if: matrix.platform == 'ubuntu-latest'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y check ccache
echo PYTHON_LINKING_OPTION="-DWITH_PYTHON=ON -DPYTHON_USE_DYNAMIC_LOOKUP=ON" >> "${GITHUB_ENV}"
echo R_BINDINGS="-DWITH_R=True" >> "${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 libxml2 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}"
### 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@v4
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 the selected XML_parser
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake $GITHUB_WORKSPACE \
-G "Ninja" \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_C_COMPILER_LAUNCHER=${COMPILER_LAUNCHER} \
-DCMAKE_CXX_COMPILER_LAUNCHER=${COMPILER_LAUNCHER} \
-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}}=True \
${{matrix.package_option}} \
${{matrix.language_bindings}} \
${R_BINDINGS} \
${RUNTIME_LINKING_OPTION} \
${PYTHON_LINKING_OPTION}
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE
### run tests ###
- name: Test
if: matrix.platform == 'macos-latest'
working-directory: ${{runner.workspace}}/build
shell: bash
run: ctest -V -C $BUILD_TYPE -E test_cs
- name: Test
if: matrix.platform != 'macos-latest'
working-directory: ${{runner.workspace}}/build
shell: bash
run: ctest -V -C $BUILD_TYPE
manylinuxbuild:
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_LIBXML"]
with_namespace: ["True"]
strict: ["True"]
with_examples: ["True"]
package_option: ["-DWITH_STABLE_PACKAGES=ON"]
cpp_standard: [98, 20]
language_bindings:
["-DWITH_JAVA=True -DWITH_PYTHON=True"]
container: ["quay.io/pypa/manylinux_2_28_x86_64"]
runs-on: ${{ matrix.platform }}
container: ${{ matrix.container}}
steps:
- uses: actions/checkout@v4
- 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
cd ..
mkdir build
cd build
cmake ../libsbml \
-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}}=True \
${{matrix.package_option}} \
${{matrix.language_bindings}} \
-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
- name: Test
run: |
cd ../build
ctest -V -C $BUILD_TYPE