diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 00000000..77dda829 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,33 @@ +name: Build documentation + +on: + push: + branches: + - main + +jobs: + build_documentation: + name: Build documentation + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup virtual python environment + uses: ./.github/actions/setup_virtual_python_environment + - name: Install dependencies + run: | + cd ${GITHUB_WORKSPACE} + source python-testing-environment/bin/activate + pip install -e .[CI-CD] + - name: Build API documentation + run: | + source python-testing-environment/bin/activate + pdoc --output-dir api-documentation meshpy/ + - name: Upload API documentation artifact + uses: actions/upload-artifact@v4 + with: + name: api-documentation + path: api-documentation/ diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 543175bc..2c1b578a 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -3,7 +3,7 @@ name: Build and deploy website on: # Only build and deploy the website once the testsuite is completed => coverage badge and report are necessary workflow_run: - workflows: [Test suite] + workflows: [Test suite, Build documentation] types: [completed] branches: [main] @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: false jobs: - build_website_and_documentation: + build_website: runs-on: ubuntu-latest steps: - name: Checkout repository @@ -35,21 +35,13 @@ jobs: with: name: website path: website/docs/build/ - - name: Build API documentation - run: | - pdoc --output-dir api-documentation meshpy/ - - name: Upload API documentation artifact - uses: actions/upload-artifact@v4 - with: - name: api-documentation - path: api-documentation/ deploy: environment: name: Website url: http://imcs-compsim.github.io/meshpy runs-on: ubuntu-latest - needs: build_website_and_documentation + needs: build_website permissions: pages: write id-token: write @@ -61,10 +53,12 @@ jobs: name: website path: ${{ github.workspace }} - name: Download API documentation artifact - uses: actions/download-artifact@v4 + uses: dawidd6/action-download-artifact@v8 with: + workflow: documentation.yml name: api-documentation path: ${{ github.workspace }}/api-documentation + branch: ${{ github.event.repository.default_branch }} - name: Download coverage report artifact uses: dawidd6/action-download-artifact@v8 with: diff --git a/pyproject.toml b/pyproject.toml index bf3f83a4..3f0e82b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,6 +59,7 @@ CI-CD = [ "coverage==7.4.4", "coverage-badge", "cubitpy@git+https://github.com/imcs-compsim/cubitpy.git@main", + "pdoc", "setuptools", # Needed for coverage-badge "testbook" ] diff --git a/website/requirements.txt b/website/requirements.txt index 030a5419..df30ecdb 100644 --- a/website/requirements.txt +++ b/website/requirements.txt @@ -1,5 +1,4 @@ linkify-it-py myst-parser -pdoc pydata-sphinx-theme sphinx