Install dev deps as dependencies #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run static analysis with | |
# Qodana, generate docs, check coverage and deploy reports. | |
name: Documentation | |
on: | |
workflow_dispatch: | |
workflow_call: | |
push: | |
branches: | |
- main | |
env: | |
PYTHON_VERSION: '3.11' | |
permissions: | |
contents: write | |
jobs: | |
sphinx: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install -U pip | |
python -m pip install -r requirements-freeze.txt | |
- name: Generate docs | |
run: | | |
sphinx-apidoc -o docs . | |
sphinx-build -b html docs docs/_build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-sphinx | |
path: docs/_build/ | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install -U pip | |
python -m pip install -r requirements-freeze.txt | |
- name: Run coverage | |
run: | | |
coverage run -m unittest discover | |
coverage html | |
rm htmlcov/.gitignore | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-coverage | |
path: htmlcov/ | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [ sphinx, coverage ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifact (sphinx) | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact-sphinx | |
path: build/docs | |
- name: Download artifact (coverage) | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact-coverage | |
path: build/cov | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: build | |
destination_dir: ./ | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
cleanup: | |
runs-on: ubuntu-latest | |
if: always() | |
needs: deploy | |
steps: | |
- name: Delete artifacts | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
failOnError: false | |
name: | | |
artifact-* |