Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
separated documentation environment and modified github workflows acc…
…ordingly
  • Loading branch information
Florian Maas committed Sep 5, 2022
commit 345bb4f6d42ae8f5ab62858b46852f18b2e2c6b2
56 changes: 56 additions & 0 deletions .github/actions/check-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "check-docs"
description: "Composite action to verify the documentation."
inputs:
python-version:
required: false
description: "The python version to use"
default: 3.9.7
runs:
using: "composite"
steps:
#----------------------------------------------
# from: https://github.com/snok/install-poetry
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: ${{ inputs.python-version }}

#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: docs-venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }}

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
cd docs
poetry install --no-interaction --no-root
shell: bash

- name: Run checks
run: |
cd docs
poetry run mkdocs build -s
shell: bash
56 changes: 56 additions & 0 deletions .github/actions/deploy-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "deploy-docs"
description: "Composite action to verify the documentation."
inputs:
python-version:
required: false
description: "The python version to use"
default: 3.9.7
runs:
using: "composite"
steps:
#----------------------------------------------
# from: https://github.com/snok/install-poetry
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: ${{ inputs.python-version }}

#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: docs-venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }}

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
cd docs
poetry install --no-interaction --no-root
shell: bash

- name: Run checks
run: |
cd docs
poetry run mkdocs gh-deploy --force
shell: bash
4 changes: 1 addition & 3 deletions .github/actions/setup-poetry-env/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# checkout-and-yarn/action.yml

name: "setup-poetry-env"
description: "Composite action to setup the Python and poetry environment."
inputs:
Expand Down Expand Up @@ -38,7 +36,7 @@ runs:
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
key: venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }}

#----------------------------------------------
# install dependencies if cache does not exist
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/on-merge-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,15 @@ jobs:
run: |
source .venv/bin/activate
poetry add tox-gh-actions
tox
tox

check-docs:
runs-on: ubuntu-latest
needs: quality
steps:

- name: Check out
uses: actions/checkout@v2

- name: check documentation
uses: ./.github/actions/check-docs
14 changes: 14 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,17 @@ jobs:
source .venv/bin/activate
poetry add tox-gh-actions
tox

check-docs:
runs-on: ubuntu-latest
needs: quality
steps:

- name: Check out
uses: actions/checkout@v2

- name: check documentation
uses: ./.github/actions/check-docs



34 changes: 19 additions & 15 deletions .github/workflows/on-release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ jobs:
- name: Run checks
uses: ./.github/actions/run-checks

- name: Documentation Test
run: |
source .venv/bin/activate
make docs-test

tox:
needs: quality
runs-on: ubuntu-latest
Expand All @@ -46,6 +41,18 @@ jobs:
poetry add tox-gh-actions
tox


check-docs:
runs-on: ubuntu-latest
needs: quality
steps:

- name: Check out
uses: actions/checkout@v2

- name: check documentation
uses: ./.github/actions/check-docs

publish:
runs-on: ubuntu-latest
needs: tox
Expand All @@ -70,18 +77,15 @@ jobs:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}

documentation:

deploy-docs:
runs-on: ubuntu-latest
needs: publish
needs: quality
steps:

- name: Check out
uses: actions/checkout@v2

- name: Set up the environment
uses: ./.github/actions/setup-poetry-env

- name: Generate documentation
run: |
source .venv/bin/activate
mkdocs gh-deploy --force
- name: check documentation
uses: ./.github/actions/deploy-docs

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ publish: ## publish a release to pypi.
build-and-publish: build publish ## Build and publish.

docs-test: ## Test if documentation can be built without warnings or errors
@mkdocs build -s
@( cd docs ; poetry run mkdocs build -s)

docs: ## Build and serve the documentation
@mkdocs serve
@( cd docs ; poetry run mkdocs serve )

.PHONY: docs

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading