diff --git a/.github/actions/setup-doxygen/action.yml b/.github/actions/setup-doxygen/action.yml new file mode 100644 index 0000000000..f6a62181c1 --- /dev/null +++ b/.github/actions/setup-doxygen/action.yml @@ -0,0 +1,20 @@ +name: Set up doxygen +description: | + Download, build, and install doxygen. + +runs: + using: "composite" + steps: + - name: Install apt dependencies for doxygen + run: | + sudo apt-get update \ + && sudo apt-get install -y \ + bison \ + ragel \ + graphviz \ + texlive-latex-extra + shell: bash + + - name: Download and build doxygen + run: sudo scripts/downloadAndBuildDoxygen.sh + shell: bash diff --git a/.github/workflows/test_doc.yml b/.github/workflows/test_doc.yml index 98c023ba79..64dc0b301d 100644 --- a/.github/workflows/test_doc.yml +++ b/.github/workflows/test_doc.yml @@ -16,7 +16,6 @@ on: jobs: doxygen: name: Test Doxygen - runs-on: ubuntu-22.04 strategy: @@ -32,26 +31,14 @@ jobs: - uses: actions/checkout@v3 - run: git fetch --prune --unshallow - - name: apt - run: | - sudo apt-get update \ - && sudo apt-get install -y \ - bison \ - ragel \ - graphviz \ - texlive-latex-extra - - - name: Build doxygen - run: | - sudo scripts/downloadAndBuildDoxygen.sh + - name: Set up doxygen + uses: ./.github/actions/setup-doxygen - name: Run doxygen - run: | - scripts/run-doxygen.sh + run: scripts/run-doxygen.sh sphinx: name: Test Sphinx - runs-on: ubuntu-22.04 strategy: @@ -70,9 +57,8 @@ jobs: - run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV - run: echo "SWIG=${AMICI_DIR}/ThirdParty/swig-4.1.1/install/bin/swig" >> $GITHUB_ENV - - name: Build doxygen - run: | - sudo scripts/downloadAndBuildDoxygen.sh + - name: Set up doxygen + uses: ./.github/actions/setup-doxygen # install amici dependencies - name: apt @@ -90,5 +76,4 @@ jobs: sudo scripts/downloadAndBuildSwig.sh - name: sphinx - run: | - scripts/run-sphinx.sh + run: scripts/run-sphinx.sh diff --git a/scripts/downloadAndBuildDoxygen.sh b/scripts/downloadAndBuildDoxygen.sh index c51c05c599..19d86be5a1 100755 --- a/scripts/downloadAndBuildDoxygen.sh +++ b/scripts/downloadAndBuildDoxygen.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Download and build Doxygen (in case apt or homebrew version is buggy again) -set -e +set -euo pipefail SCRIPT_PATH=$(dirname "$BASH_SOURCE") AMICI_PATH=$(cd "$SCRIPT_PATH"/.. && pwd) @@ -8,8 +8,11 @@ AMICI_PATH=$(cd "$SCRIPT_PATH"/.. && pwd) DOXYGEN_DIR="${AMICI_PATH}"/ThirdParty/doxygen cd "${AMICI_PATH}"/ThirdParty if [[ ! -d ${DOXYGEN_DIR} ]]; then - # git clone --depth 1 https://github.com/doxygen/doxygen.git "${DOXYGEN_DIR}" - git clone --single-branch --branch Release_1_9_7 --depth 1 https://github.com/doxygen/doxygen.git "${DOXYGEN_DIR}" + git clone --single-branch \ + --branch Release_1_9_7 \ + --depth 1 \ + -c advice.detachedHead=false \ + https://github.com/doxygen/doxygen.git "${DOXYGEN_DIR}" fi cd "${DOXYGEN_DIR}"