chore: [pre-commit.ci] pre-commit autoupdate #4131
Workflow file for this run
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: Docs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip --quiet install --upgrade .[docs,test] | |
python -m pip install yq | |
python -m pip list | |
- name: Install apt-get dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -qq install pandoc | |
- name: Check docstrings | |
run: | | |
# Group 1 is related to docstrings | |
pydocstyle --select D1 src/pyhf/pdf.py \ | |
src/pyhf/workspace.py \ | |
src/pyhf/probability.py \ | |
src/pyhf/patchset.py \ | |
src/pyhf/compat.py \ | |
src/pyhf/interpolators \ | |
src/pyhf/infer \ | |
src/pyhf/optimize \ | |
src/pyhf/contrib \ | |
src/pyhf/cli | |
- name: Verify CITATION.cff schema | |
run: | | |
jsonschema <(curl -sL "https://citation-file-format.github.io/1.2.0/schema.json") --instance <(cat CITATION.cff | yq) | |
- name: Check for broken links | |
run: | | |
pushd docs | |
make linkcheck | |
# Don't ship the linkcheck | |
rm -r _build/linkcheck | |
popd | |
- name: Test and build docs | |
run: | | |
python -m doctest README.rst | |
pushd docs | |
make html | |
- name: Check schemas are copied over | |
run: | | |
# is a directory | |
[ -d "docs/_build/html/schemas" ] | |
# is not a symlink | |
[ ! -L "docs/_build/html/schemas" ] | |
# is not empty | |
[ "$(ls -A docs/_build/html/schemas)" ] | |
# is not empty | |
[ "$(ls -A docs/_build/html/lite)" ] | |
- name: Fix permissions if needed | |
run: | | |
chmod -c -R +rX "docs/_build/html/" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: 'docs/_build/html' | |
deploy: | |
name: Deploy docs to GitHub Pages | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
needs: build | |
# Set permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |