Skip to content

Commit

Permalink
GHA: split into smaller jobs
Browse files Browse the repository at this point in the history
Split current C++/Python/Notebook tests into three separate workflows.

Closes #2195
Closes #2014
  • Loading branch information
dweindl committed Nov 17, 2023
1 parent 3330ccb commit e90bbe9
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 36 deletions.
35 changes: 35 additions & 0 deletions .github/actions/setup-amici-cpp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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: Build AMICI dependencies
run: scripts/buildDependencies.sh
shell: bash

- name: Build AMICI
run: scripts/buildAmici.sh
shell: bash
env:
CI_SONARCLOUD: "TRUE"
138 changes: 102 additions & 36 deletions .github/workflows/test_python_cplusplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,13 @@ on:
- master

jobs:
build:
ubuntu-cpp-tests:
name: Tests Ubuntu

# TODO: prepare image with more deps preinstalled
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,31 +26,51 @@ 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: Set up AMICI C++ libraries
uses: ./.github/actions/setup-amici-cpp

- name: Install apt dependencies
uses: ./.github/actions/install-apt-dependencies
- name: C++ tests
run: scripts/run-cpp-tests.sh

# install amici dependencies
- name: apt
- name: Codecov CPP
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.info
flags: cpp
fail_ci_if_error: true

- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sudo apt-get update \
&& sudo apt-get install -y \
cmake \
python3-venv \
lcov
sonar-scanner \
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.projectVersion="$(git describe --abbrev=4 --dirty=-dirty --always --tags | tr -d '\n')"
- name: Build AMICI dependencies
run: scripts/buildDependencies.sh
ubuntu-python-tests:
name: Tests Ubuntu
runs-on: ubuntu-22.04

- name: Build AMICI
run: CI_SONARCLOUD=TRUE scripts/buildAmici.sh
strategy:
matrix:
python-version: [ "3.9" ]

- name: C++ tests
run: scripts/run-cpp-tests.sh
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
Expand All @@ -74,7 +87,6 @@ jobs:
--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,6 +98,68 @@ jobs:
--durations=10 \
${AMICI_DIR}/python/tests/test_splines.py
- name: Codecov Python
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: build/coverage_py.xml
flags: python
fail_ci_if_error: true
verbose: true

- name: lcov
run: |
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: Codecov CPP
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.info
flags: cpp_python
fail_ci_if_error: true

- name: Run sonar-scanner
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-notebook-tests:
name: 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 \
Expand Down Expand Up @@ -116,14 +190,6 @@ jobs:
-b ${AMICI_DIR}/python/sdist -c -o coverage_py.info \
&& lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info
- name: Codecov CPP
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.info
flags: cpp
fail_ci_if_error: true

- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit e90bbe9

Please sign in to comment.