From b48019cce6b51abbd27e919656bfb9408a7f1b30 Mon Sep 17 00:00:00 2001
From: Daniel Weindl <daniel.weindl@helmholtz-munich.de>
Date: Thu, 16 Nov 2023 11:07:12 +0100
Subject: [PATCH] GHA: further cleanup

---
 .github/workflows/deploy_release.yml          |  3 +-
 .../test_benchmark_collection_models.yml      |  4 +-
 .github/workflows/test_doc.yml                | 16 ++++----
 .github/workflows/test_install.yml            | 30 +++++----------
 .github/workflows/test_petab_test_suite.yml   |  6 +--
 .github/workflows/test_python_cplusplus.yml   | 38 ++++++-------------
 .github/workflows/test_python_ver_matrix.yml  |  6 +--
 .github/workflows/test_valgrind.yml           | 17 +++------
 8 files changed, 42 insertions(+), 78 deletions(-)

diff --git a/.github/workflows/deploy_release.yml b/.github/workflows/deploy_release.yml
index 001d0328bf..8fe931763c 100644
--- a/.github/workflows/deploy_release.yml
+++ b/.github/workflows/deploy_release.yml
@@ -30,8 +30,7 @@ jobs:
     - run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV
 
     - name: sdist
-      run: |
-        scripts/buildSdist.sh
+      run: scripts/buildSdist.sh
 
     - name: Publish a Python distribution to PyPI
       uses: pypa/gh-action-pypi-publish@release/v1
diff --git a/.github/workflows/test_benchmark_collection_models.yml b/.github/workflows/test_benchmark_collection_models.yml
index e5d13946e7..bf9509e5ce 100644
--- a/.github/workflows/test_benchmark_collection_models.yml
+++ b/.github/workflows/test_benchmark_collection_models.yml
@@ -44,8 +44,8 @@ jobs:
 
     # install AMICI
     - name: Create AMICI sdist
-      run: |
-        pip3 install build && cd python/sdist && python3 -m build --sdist
+      run: pip3 install build && cd python/sdist && python3 -m build --sdist
+
     - name: Install AMICI sdist
       run: |
         pip3 install --user petab[vis] && \
diff --git a/.github/workflows/test_doc.yml b/.github/workflows/test_doc.yml
index 717ec9cc53..07e0afdcc8 100644
--- a/.github/workflows/test_doc.yml
+++ b/.github/workflows/test_doc.yml
@@ -59,18 +59,18 @@ jobs:
       - name: Set up doxygen
         uses: ./.github/actions/setup-doxygen
 
-      # install amici dependencies
-      - name: apt
+      - name: Install apt dependencies
+        uses: ./.github/actions/install-apt-dependencies
+
+      - name: Install further dependencies
         run: |
           sudo apt-get update \
             && sudo apt-get install -y \
-              g++ \
-              libatlas-base-dev \
-              libboost-serialization-dev \
               pandoc \
-              python3-venv \
+              python3-venv
 
-      - uses: ./.github/actions/setup-swig
+      - name: Set up SWIG
+        uses: ./.github/actions/setup-swig
 
-      - name: sphinx
+      - name: Run sphinx
         run: scripts/run-sphinx.sh
diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml
index 0ad1ec0a14..be74cfa4c6 100644
--- a/.github/workflows/test_install.yml
+++ b/.github/workflows/test_install.yml
@@ -32,20 +32,16 @@ jobs:
             cmake
 
     - name: Build suitesparse
-      run: |
-        scripts/buildSuiteSparse.sh
+      run: scripts/buildSuiteSparse.sh
 
     - name: Build sundials
-      run: |
-        scripts/buildSundials.sh
+      run: scripts/buildSundials.sh
 
     - name: Build AMICI
-      run: |
-        scripts/buildAmici.sh
+      run: scripts/buildAmici.sh
 
     - name: Install python archive
-      run: |
-        scripts/installAmiciArchive.sh
+      run: scripts/installAmiciArchive.sh
 
   sdist_ubuntu:
     name: sdist Install Ubuntu
@@ -71,16 +67,13 @@ jobs:
       uses: ./.github/actions/install-apt-dependencies
 
     - name: Create AMICI sdist
-      run: |
-        scripts/buildSdist.sh
+      run: scripts/buildSdist.sh
 
     - name: Install python sdist
-      run: |
-        pip3 install -v --user $(ls -t python/sdist/dist/amici-*.tar.gz | head -1)
+      run: pip3 install -v --user $(ls -t python/sdist/dist/amici-*.tar.gz | head -1)
 
     - name: Test import
-      run: |
-        python -m amici
+      run: python -m amici
 
 
   sdist_macos:
@@ -113,13 +106,10 @@ jobs:
           && echo CPPFLAGS="-I /usr/local/Cellar/boost/1.81.0_1/include/" >> $GITHUB_ENV
 
     - name: Create AMICI sdist
-      run: |
-        scripts/buildSdist.sh
+      run: scripts/buildSdist.sh
 
     - name: Install python sdist
-      run: |
-        pip3 install -v --user $(ls -t python/sdist/dist/amici-*.tar.gz | head -1)
+      run: pip3 install -v --user $(ls -t python/sdist/dist/amici-*.tar.gz | head -1)
 
     - name: Test import
-      run: |
-        python -m amici
+      run: python -m amici
diff --git a/.github/workflows/test_petab_test_suite.yml b/.github/workflows/test_petab_test_suite.yml
index 26a4ac7a26..d5c4dc4fe8 100644
--- a/.github/workflows/test_petab_test_suite.yml
+++ b/.github/workflows/test_petab_test_suite.yml
@@ -44,8 +44,7 @@ jobs:
             && sudo apt-get install -y python3-venv
 
       - name: Build BNGL
-        run: |
-          scripts/buildBNGL.sh
+        run: scripts/buildBNGL.sh
 
       - run: |
           echo "${HOME}/.local/bin/" >> $GITHUB_PATH
@@ -54,8 +53,7 @@ jobs:
 
       # install AMICI
       - name: Install python package
-        run: |
-          scripts/installAmiciSource.sh
+        run: scripts/installAmiciSource.sh
 
       - name: Install petab
         run: |
diff --git a/.github/workflows/test_python_cplusplus.yml b/.github/workflows/test_python_cplusplus.yml
index 546b297712..acc8759a3c 100644
--- a/.github/workflows/test_python_cplusplus.yml
+++ b/.github/workflows/test_python_cplusplus.yml
@@ -47,26 +47,20 @@ jobs:
         sudo apt-get update \
           && sudo apt-get install -y \
             cmake \
-            g++ \
             python3-venv \
-            lcov \
-            libboost-math-dev
+            lcov
 
     - name: Build AMICI dependencies
-      run: |
-        scripts/buildDependencies.sh
+      run: scripts/buildDependencies.sh
 
     - name: Build AMICI
-      run: |
-        CI_SONARCLOUD=TRUE scripts/buildAmici.sh
+      run: CI_SONARCLOUD=TRUE scripts/buildAmici.sh
 
     - name: C++ tests
-      run: |
-        scripts/run-cpp-tests.sh
+      run: scripts/run-cpp-tests.sh
 
     - name: Install python package
-      run: |
-        scripts/installAmiciSource.sh
+      run: scripts/installAmiciSource.sh
 
     - name: Python tests
       run: |
@@ -98,12 +92,10 @@ jobs:
         && pip install jax[cpu]
 
     - name: example notebooks
-      run: |
-        scripts/runNotebook.sh python/examples/example_*/
+      run: scripts/runNotebook.sh python/examples/example_*/
 
     - name: doc notebooks
-      run: |
-        scripts/runNotebook.sh documentation/GettingStarted.ipynb
+      run: scripts/runNotebook.sh documentation/GettingStarted.ipynb
 
     - name: Codecov Python
       uses: codecov/codecov-action@v3.1.0
@@ -143,7 +135,6 @@ jobs:
 
   osx:
     name: Tests OSX
-
     runs-on: macos-latest
 
     steps:
@@ -170,21 +161,16 @@ jobs:
           && echo CPPFLAGS="-I /usr/local/Cellar/boost/1.81.0_1/include/" >> $GITHUB_ENV
 
     - name: Build AMICI
-      run: |
-        scripts/buildAll.sh
+      run: scripts/buildAll.sh
 
     - name: Install python package
-      run: |
-        scripts/installAmiciSource.sh
+      run: scripts/installAmiciSource.sh
 
     - name: cppcheck
-      run: |
-        scripts/run-cppcheck.sh
+      run: scripts/run-cppcheck.sh
 
     - name: Python tests
-      run: |
-        scripts/run-python-tests.sh
+      run: scripts/run-python-tests.sh
 
     - name: C++ tests
-      run: |
-        scripts/run-cpp-tests.sh
+      run: scripts/run-cpp-tests.sh
diff --git a/.github/workflows/test_python_ver_matrix.yml b/.github/workflows/test_python_ver_matrix.yml
index 73aba014cd..866a3fc0f7 100644
--- a/.github/workflows/test_python_ver_matrix.yml
+++ b/.github/workflows/test_python_ver_matrix.yml
@@ -46,11 +46,9 @@ jobs:
 
     # install AMICI
     - name: Build BNGL
-      run: |
-        scripts/buildBNGL.sh
+      run: scripts/buildBNGL.sh
     - name: Install python package
-      run: |
-        scripts/installAmiciSource.sh
+      run: scripts/installAmiciSource.sh
 
     - name: Python tests
       run: |
diff --git a/.github/workflows/test_valgrind.yml b/.github/workflows/test_valgrind.yml
index 7b513f28dd..32eea2e0c0 100644
--- a/.github/workflows/test_valgrind.yml
+++ b/.github/workflows/test_valgrind.yml
@@ -14,8 +14,6 @@ on:
 jobs:
   valgrind_cpp:
     name: Valgrind C++
-
-    # TODO: prepare image with more deps preinstalled
     runs-on: ubuntu-22.04
 
     strategy:
@@ -47,12 +45,10 @@ jobs:
             valgrind
 
     - name: Build AMICI
-      run: |
-        scripts/buildAll.sh
+      run: scripts/buildAll.sh
 
     - name: C++ tests / Valgrind
-      run: |
-        scripts/run-valgrind-cpp.sh
+      run: scripts/run-valgrind-cpp.sh
 
   valgrind_python:
     name: Valgrind Python
@@ -88,13 +84,10 @@ jobs:
             valgrind
 
     - name: Build AMICI
-      run: |
-        scripts/buildAll.sh
+      run: scripts/buildAll.sh
 
     - name: Install python package
-      run: |
-        scripts/installAmiciSource.sh
+      run: scripts/installAmiciSource.sh
 
     - name: Python tests / Valgrind
-      run: |
-        scripts/run-valgrind-py.sh
+      run: scripts/run-valgrind-py.sh