Skip to content

Commit

Permalink
Documentation workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
EltonCN committed Nov 26, 2024
1 parent 6c264a6 commit a9d6ae2
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Simple workflow for deploying static content to GitHub Pages
name: Build and deploy documentation

on:
# Runs on pushes targeting the default branch
release:
types: [published]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
cd docs
python3 install_doc_requirements.py
cd ..
- name: Install pandoc
uses: pandoc/actions/setup@v1
- name: Build documentation
run: |
cd docs
make html
cd ..
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload docs dir
path: './docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
11 changes: 6 additions & 5 deletions docs/install_doc_requirements.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import subprocess
import sys
import configparser
import tomllib
import os

config = configparser.ConfigParser()
config.read(os.path.join("..", "setup.cfg"))
packages = config["options.extras_require"]["doc_generation"]
with open("../pyproject.toml", "rb") as file:
data = tomllib.load(file)

subprocess.check_call([sys.executable, "-m", "pip", "install"]+packages.split(";"))
packages = data["project"]["optional-dependencies"]["doc_generation"]

subprocess.check_call([sys.executable, "-m", "pip", "install"]+packages)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Homepage = "https://hiaac.unicamp.br"

[project.optional-dependencies]
tests = ["mypy", "testbook", "ipython", "ipykernel", "numpy", "matplotlib"]
doc_generation = ["sphinx", "sphinx_rtd_theme", "nbsphinx", "sphinx-mdinclude==0.5.4"]

[tool.setuptools]
include-package-data = true
Expand Down

0 comments on commit a9d6ae2

Please sign in to comment.