From 2710492bc6b3d9c25b6356c6e893f5ebf7b7c1f6 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 17 Jun 2024 17:32:52 +0200 Subject: [PATCH] Simplify CI action for building docs Signed-off-by: Steffen Vogel --- .github/workflows/documentation.yaml | 59 ++++++++++++++++++++++++++++ .github/workflows/workflow.yaml | 35 ----------------- Dockerfile | 32 --------------- action.yaml | 7 ---- documentation/docu.sh | 12 ------ entrypoint.sh | 8 ---- 6 files changed, 59 insertions(+), 94 deletions(-) create mode 100644 .github/workflows/documentation.yaml delete mode 100644 .github/workflows/workflow.yaml delete mode 100644 Dockerfile delete mode 100644 action.yaml delete mode 100755 documentation/docu.sh delete mode 100755 entrypoint.sh diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml new file mode 100644 index 00000000..0af4a432 --- /dev/null +++ b/.github/workflows/documentation.yaml @@ -0,0 +1,59 @@ +name: Documentation + +on: + pull_request: + + push: + branches: + - master + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build-docs: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.8 + + - name: Install Graphviz + shell: bash + run: | + sudo apt-get -y install graphviz + + - name: Install Python dependencies + run: | + pip install .[dev,doc] + + - name: Build documentation + run: | + sphinx-apidoc \ + --full \ + --doc-project "cimpy" \ + --separate \ + --output-dir "../documentation" \ + "../" + + python3 set_inheritance_diagram.py + + make html + + touch ./documentation/_build/html/.nojekyll + + ls -l ./documentation/_build/html + + - name: Upload Artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./documentation/_build/html + + - name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/master' + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml deleted file mode 100644 index 17ed7b0f..00000000 --- a/.github/workflows/workflow.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: Documentation - -on: - push: - branches: [ master ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - build-docs: - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - name: git-checkout - uses: actions/checkout@v3 - - - name: build-documentation - uses: ./ - - - name: Create doc redirect - uses: "finnp/create-file-action@master" - env: - FILE_NAME: ${{ github.workspace }}/built_documentation/.nojekyll - FILE_DATA: "" - - - name: Push - uses: s0/git-publish-subdir-action@develop - env: - REPO: self - BRANCH: gh-pages - FOLDER: ${{ github.workspace }}/built_documentation - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to get a token - MESSAGE: "Build documentation: ({sha}) {msg}" diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 2f66bb5c..00000000 --- a/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -FROM fedora:29 - -LABEL \ - org.label-schema.schema-version = "1.0" \ - org.label-schema.name = "cimpy" \ - org.label-schema.license = "Mozilla Public License Version 2.0" \ - org.label-schema.vendor = "Institute for Automation of Complex Power Systems, RWTH Aachen University" \ - org.label-schema.author.name = "Jan Dinkelbach" - -RUN dnf -y update - -RUN dnf -y install \ - make \ - python3-pip \ - graphviz-devel - -RUN dnf --refresh -y install \ - python3-devel - -RUN pip3 install sphinx_rtd_theme - -RUN pip3 install sphinx - -RUN pip3 install pytest - -RUN pip3 install pytest-check - -ADD . /cimpy - -WORKDIR /cimpy - -RUN python3 setup.py install diff --git a/action.yaml b/action.yaml deleted file mode 100644 index b751e892..00000000 --- a/action.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# action.yml -name: 'Build Documentation' -description: 'We are going to build the documentation!' -runs: - using: 'docker' - image: 'Dockerfile' - entrypoint: './entrypoint.sh' diff --git a/documentation/docu.sh b/documentation/docu.sh deleted file mode 100755 index 720e233c..00000000 --- a/documentation/docu.sh +++ /dev/null @@ -1,12 +0,0 @@ -if [ "$1" = "--release" ] || [ "$1" == "" ]; then - python3 ../setup.py develop - sphinx-apidoc -F -H "cimpy" --separate -o "../documentation" "../" "../setup.py" - python3 set_inheritance_diagram.py - if [ "$1" = "--release" ] ; then - make html - else - make text - fi -else - echo "Usage: $0 [--release]" -fi diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100755 index 9c267ecc..00000000 --- a/entrypoint.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ -n "${GITHUB_WORKSPACE}" ]; -then - cd documentation - ./docu.sh --release - cp -a ${GITHUB_WORKSPACE}/documentation/_build/html ${GITHUB_WORKSPACE}/built_documentation -fi