diff --git a/.github/actions/setup-amici-cpp/action.yml b/.github/actions/setup-amici-cpp/action.yml new file mode 100644 index 0000000000..09ec9311bf --- /dev/null +++ b/.github/actions/setup-amici-cpp/action.yml @@ -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" diff --git a/.github/workflows/test_python_cplusplus.yml b/.github/workflows/test_python_cplusplus.yml index acc8759a3c..e82adc34f4 100644 --- a/.github/workflows/test_python_cplusplus.yml +++ b/.github/workflows/test_python_cplusplus.yml @@ -9,19 +9,12 @@ on: jobs: build: - name: Tests Ubuntu - - # TODO: prepare image with more deps preinstalled + name: C++ 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 }} @@ -33,89 +26,13 @@ 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 - run: | - source build/venv/bin/activate \ - && pytest \ - --ignore-glob=*petab* \ - --ignore-glob=*test_splines.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: | - 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_splines.py - - - 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 - - - name: Codecov Python - uses: codecov/codecov-action@v3.1.0 - 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/codecov-action@v3.1.0 with: