Merge pull request #1117 from QCoDeS/pre-commit-ci-update-config #2842
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
name: build docs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'release/*' | |
- 'version1.0' | |
tags: | |
- 'v*' | |
pull_request: | |
merge_group: | |
branches: ['main'] | |
jobs: | |
builddocs: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
exclude: | |
- os: windows-latest | |
python-version: "3.10" | |
- os: windows-latest | |
python-version: "3.12" | |
- os: windows-latest | |
python-version: "3.13" | |
env: | |
DISPLAY: ':99.0' | |
OS: ${{ matrix.os }} | |
UPLOAD_TO_GHPAGES: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' && github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
with: | |
fetch-depth: '0' | |
# if we upload to ghpages we need the full | |
# history to generate correct version info | |
if: ${{ fromJSON(env.UPLOAD_TO_GHPAGES) }} | |
- uses: actions/checkout@v4.2.2 | |
if: ${{ !fromJSON(env.UPLOAD_TO_GHPAGES) }} | |
- name: install pandoc linux | |
run: sudo apt install pandoc | |
if: runner.os == 'Linux' | |
- name: Install pandoc on windows | |
uses: Wandalen/wretry.action@v3.7.3 | |
with: | |
action: crazy-max/ghaction-chocolatey@v1.6.0 | |
with: | | |
args: install pandoc | |
attempt_limit: 5 | |
attempt_delay: 1000 | |
if: runner.os == 'Windows' | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5.3.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: | | |
pyproject.toml | |
requirements.txt | |
- name: upgrade pip setuptools wheel | |
run: python -m pip install --upgrade pip setuptools wheel | |
shell: bash | |
- name: install broadbean & docs dependencies | |
run: | | |
pip install -c requirements.txt .[docs,test] | |
# currently we are building api docs of the whole package including tests so we need to be able to import the tests and therefore require test dependencies to build the docs. | |
- name: Build docs on linux | |
run: | | |
cd docs | |
export SPHINXOPTS="-W -v" | |
make html | |
if: runner.os == 'Linux' | |
- name: Build docs on windows | |
run: | | |
cd docs | |
$env:SPHINXOPTS = "-W -v" | |
./make.bat html | |
if: runner.os == 'Windows' | |
- name: Upload build docs | |
uses: actions/upload-artifact@v4.4.3 | |
with: | |
name: docs_${{ matrix.python-version }}_${{ matrix.os }} | |
path: ${{ github.workspace }}/docs/_build/html | |
- name: Deploy to gh pages | |
uses: JamesIves/github-pages-deploy-action@v4.6.9 | |
with: | |
branch: gh-pages | |
folder: ${{ github.workspace }}/docs/_build/html | |
clean: true | |
single-commit: true | |
git-config-email: "bot" | |
git-config-name: "Documentation Bot" | |
if: ${{ fromJSON(env.UPLOAD_TO_GHPAGES) }} |