Skip to content

Commit

Permalink
Merge branch 'develop' into py312
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl authored Dec 11, 2023
2 parents d1e5ef8 + ecbae3f commit d233d5d
Show file tree
Hide file tree
Showing 116 changed files with 4,567 additions and 3,706 deletions.
44 changes: 44 additions & 0 deletions .github/actions/setup-amici-cpp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Set up AMICI C++
description: |
Build the AMICI C++ interface and set things for for coverage analysis.
(Currently ubuntu-only).
runs:
using: "composite"
steps:
# BioNetGen Path
- run: echo "BNGPATH=${GITHUB_WORKSPACE}/ThirdParty/BioNetGen-2.7.0" >> $GITHUB_ENV
shell: bash

# use all available cores
- run: echo "AMICI_PARALLEL_COMPILE=" >> $GITHUB_ENV
shell: bash

# enable coverage
- run: echo "ENABLE_GCOV_COVERAGE=TRUE" >> $GITHUB_ENV
shell: bash

- name: Set up Sonar tools
uses: ./.github/actions/setup-sonar-tools

- name: Install apt dependencies
uses: ./.github/actions/install-apt-dependencies

- name: Install additional apt dependencies
run: |
sudo apt-get update \
&& sudo apt-get install -y \
cmake \
python3-venv \
lcov
shell: bash

- name: Build AMICI dependencies
run: scripts/buildDependencies.sh
shell: bash

- name: Build AMICI
run: scripts/buildAmici.sh
shell: bash
env:
CI_SONARCLOUD: "TRUE"
3 changes: 2 additions & 1 deletion .github/actions/setup-sonar-tools/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ runs:

- name: Install sonarcloud tools
run: |
sudo apt-get install nodejs curl unzip \
sudo apt-get update \
&& sudo apt-get install nodejs curl unzip \
&& curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip \
https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip \
&& unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_branch.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Deploy Branch
on: [push, merge_group, workflow_dispatch]
on: [push, pull_request, merge_group, workflow_dispatch]

jobs:
sdist:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ jobs:
sudo apt-get update \
&& sudo apt-get install -y \
pandoc \
python3-venv
&& pip install tox
- name: Set up SWIG
uses: ./.github/actions/setup-swig

- name: Run sphinx
run: scripts/run-sphinx.sh
run: tox -e doc
2 changes: 1 addition & 1 deletion .github/workflows/test_install.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Installation
on: [push, merge_group, workflow_dispatch]
on: [push, pull_request, merge_group, workflow_dispatch]

jobs:
archive:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_petab_test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
tests/petab_test_suite/
- name: Codecov
if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
181 changes: 133 additions & 48 deletions .github/workflows/test_python_cplusplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,16 @@ on:
pull_request:
branches:
- master
- develop

jobs:
build:
name: Tests Ubuntu

# TODO: prepare image with more deps preinstalled
ubuntu-cpp-python-tests:
name: C++/Python tests Ubuntu
runs-on: ubuntu-22.04

env:
AMICI_PARALLEL_COMPILE: ""
ENABLE_GCOV_COVERAGE: "TRUE"
CI_SONARCLOUD: "TRUE"

strategy:
matrix:
python-version: [ 3.9 ]
python-version: [ "3.9" ]

steps:
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -33,48 +27,33 @@ jobs:
- run: git fetch --prune --unshallow

- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV
- run: echo "BNGPATH=${GITHUB_WORKSPACE}/ThirdParty/BioNetGen-2.7.0" >> $GITHUB_ENV

- name: Set up Sonar tools
uses: ./.github/actions/setup-sonar-tools

- name: Install apt dependencies
uses: ./.github/actions/install-apt-dependencies

# install amici dependencies
- name: apt
run: |
sudo apt-get update \
&& sudo apt-get install -y \
cmake \
python3-venv \
lcov
- name: Build AMICI dependencies
run: scripts/buildDependencies.sh

- name: Build AMICI
run: CI_SONARCLOUD=TRUE scripts/buildAmici.sh
- name: Set up AMICI C++ libraries
uses: ./.github/actions/setup-amici-cpp

- name: C++ tests
run: scripts/run-cpp-tests.sh

- name: Install python package
run: scripts/installAmiciSource.sh

- name: Python tests
- name: Check OpenMP support
run: source build/venv/bin/activate && python -c "import amici; import sys; sys.exit(not amici.compiledWithOpenMP())"

- name: Python tests (part 1)
run: |
source build/venv/bin/activate \
&& pytest \
--ignore-glob=*petab* \
--ignore-glob=*test_splines.py \
--ignore-glob=*test_splines_short.py \
--ignore-glob=*test_pysb.py \
--cov=amici \
--cov-report=xml:"${AMICI_DIR}/build/coverage_py.xml" \
--cov-append \
--durations=10 \
${AMICI_DIR}/python/tests
- name: Python tests splines
if: ${{ github.base_ref == 'master' || github.event.merge_group.base_ref == 'master'}}
run: |
Expand All @@ -86,18 +65,83 @@ jobs:
--durations=10 \
${AMICI_DIR}/python/tests/test_splines.py
- name: Install notebook dependencies
- name: Codecov Python
if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: build/coverage_py.xml
flags: python
fail_ci_if_error: true
verbose: true

- name: Capture coverage info (lcov)
run: |
source build/venv/bin/activate \
&& pip install jax[cpu]
lcov --compat-libtool --no-external \
-d ${AMICI_DIR}/build/CMakeFiles/amici.dir/src \
-b ${AMICI_DIR} -c -o coverage_cpp.info \
&& lcov --compat-libtool --no-external \
-d ${AMICI_DIR}/python/sdist/build/temp_amici/CMakeFiles/amici.dir/src \
-b ${AMICI_DIR}/python/sdist -c -o coverage_py.info \
&& lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info
- name: example notebooks
run: scripts/runNotebook.sh python/examples/example_*/
- name: Codecov CPP
if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.info
flags: cpp
fail_ci_if_error: true

- name: doc notebooks
run: scripts/runNotebook.sh documentation/GettingStarted.ipynb
- name: Run sonar-scanner
if: ${{ env.SONAR_TOKEN != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner \
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.projectVersion="$(git describe --abbrev=4 --dirty=-dirty --always --tags | tr -d '\n')"
ubuntu-python-tests:
name: Python tests Ubuntu
runs-on: ubuntu-22.04

strategy:
matrix:
python-version: [ "3.9" ]

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/checkout@v3
- run: git fetch --prune --unshallow

- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV

- name: Set up AMICI C++ libraries
uses: ./.github/actions/setup-amici-cpp

- name: Install python package
run: scripts/installAmiciSource.sh

- name: Python tests
run: |
source build/venv/bin/activate \
&& pytest \
--cov=amici \
--cov-report=xml:"${AMICI_DIR}/build/coverage_py.xml" \
--cov-append \
--durations=10 \
${AMICI_DIR}/python/tests/test_pysb.py \
${AMICI_DIR}/python/tests/test_splines_short.py
- name: Codecov Python
if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -106,7 +150,7 @@ jobs:
fail_ci_if_error: true
verbose: true

- name: lcov
- name: Capture coverage info (lcov)
run: |
lcov --compat-libtool --no-external \
-d ${AMICI_DIR}/build/CMakeFiles/amici.dir/src \
Expand All @@ -117,14 +161,16 @@ jobs:
&& lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info
- name: Codecov CPP
if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.info
flags: cpp
flags: cpp_python
fail_ci_if_error: true

- name: Run sonar-scanner
if: ${{ env.SONAR_TOKEN != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand All @@ -133,6 +179,45 @@ jobs:
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.projectVersion="$(git describe --abbrev=4 --dirty=-dirty --always --tags | tr -d '\n')"
ubuntu-notebook-tests:
name: Notebook tests Ubuntu
runs-on: ubuntu-22.04

strategy:
matrix:
python-version: [ "3.9" ]

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- uses: actions/checkout@v3
- run: git fetch --prune --unshallow

- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV

- name: Set up AMICI C++ libraries
uses: ./.github/actions/setup-amici-cpp

- name: Install python package
run: scripts/installAmiciSource.sh

- name: Install notebook dependencies
run: |
source build/venv/bin/activate \
&& pip install jax[cpu]
- name: example notebooks
run: scripts/runNotebook.sh python/examples/example_*/

- name: doc notebooks
run: scripts/runNotebook.sh documentation/GettingStarted.ipynb

# TODO: Include notebooks in coverage report

osx:
name: Tests OSX
runs-on: macos-latest
Expand All @@ -150,22 +235,22 @@ jobs:
- run: echo "BNGPATH=${AMICI_DIR}/ThirdParty/BioNetGen-2.7.0" >> $GITHUB_ENV
# Ensure CMake is using the python version that we will use for the python tests later on
- run: echo "PYTHON_EXECUTABLE=${Python3_ROOT_DIR}/bin/python3" >> $GITHUB_ENV
- run: echo "OpenMP_ROOT=$(brew --prefix)/opt/libomp" >> $GITHUB_ENV
- run: echo "BOOST_ROOT=$(brew --prefix)/opt/boost" >> $GITHUB_ENV

# install amici dependencies
- name: homebrew
run: |
brew install hdf5 swig gcc cppcheck libomp boost \
&& brew ls -v boost \
&& brew ls -v libomp \
&& echo LDFLAGS="-L/usr/local/lib/ -L/usr/local/Cellar/boost/1.81.0_1/lib/" >> $GITHUB_ENV \
&& echo CPPFLAGS="-I /usr/local/Cellar/boost/1.81.0_1/include/" >> $GITHUB_ENV
run: brew install hdf5 swig gcc cppcheck libomp boost

- name: Build AMICI
run: scripts/buildAll.sh

- name: Install python package
run: scripts/installAmiciSource.sh

- name: Check OpenMP support
run: source build/venv/bin/activate && python -c "import amici; import sys; sys.exit(not amici.compiledWithOpenMP())"

- name: cppcheck
run: scripts/run-cppcheck.sh

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_sbml_semantic_test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
path: tests/amici-semantic-results

- name: Codecov SBMLSuite
if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- cron: '48 4 * * *'
pull_request:
branches:
- develop
- master

jobs:
Expand Down
Loading

0 comments on commit d233d5d

Please sign in to comment.