Merge pull request #5445 from jenshnielsen/pyright332 #12483
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/*' | |
tags: | |
- 'v*' | |
pull_request: | |
merge_group: | |
branches: ['main'] | |
jobs: | |
builddocs: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# don't stop other jobs if one fails | |
# this is often due to network issues | |
# and or flaky tests | |
# and the time lost in such cases | |
# is bigger than the gain from canceling the job | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: ["3.9", "3.10", "3.11"] | |
exclude: | |
- os: windows-latest | |
python-version: 3.9 | |
- os: windows-latest | |
python-version: 3.10 | |
env: | |
OS: ${{ matrix.os }} | |
UPLOAD_TO_GHPAGES: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' && github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
# we expect no warnings from Sphinx in 3.10 | |
# The std-lib docstring of IntEnum in 3.11.0 is not valid | |
# causing errors like in the docstring of from_bytes (from Int) | |
# WARNING: Inline interpreted text or phrase reference start-string without end-string. | |
SPHINX_WARNINGS_AS_ERROR: ${{ matrix.python-version == '3.10' }} | |
SPHINX_OPTS: "-v" | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
with: | |
# we need full history with tags for the version number | |
fetch-depth: '0' | |
- name: set-sphinx-opts | |
run: | | |
echo "SPHINX_OPTS=-W -v" >> $GITHUB_ENV | |
if: ${{ fromJSON(env.SPHINX_WARNINGS_AS_ERROR) }} | |
- name: install pandoc linux | |
run: | | |
sudo apt update | |
sudo apt install pandoc | |
if: runner.os == 'Linux' | |
- name: Install pandoc on windows | |
uses: Wandalen/wretry.action@v1.3.0 | |
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@v4.3.1 | |
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 qcodes | |
run: pip install -c requirements.txt .[docs] | |
- name: Build docs on linux | |
run: | | |
cd docs | |
export SPHINXOPTS="${{ env.SPHINX_OPTS }}" | |
make html | |
if: runner.os == 'Linux' | |
- name: Build docs on windows | |
run: | | |
cd docs | |
$env:SPHINXOPTS = "${{ env.SPHINX_OPTS }}" | |
./make.bat html | |
if: runner.os == 'Windows' | |
- name: Upload build docs | |
uses: actions/upload-artifact@v3.1.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.4.3 | |
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) }} |