-
Notifications
You must be signed in to change notification settings - Fork 85
120 lines (101 loc) · 3.29 KB
/
docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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@v4
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
# Ubuntu 22.04's pandoc is too old (2.9.2.x), so install manually
# until the ubuntu-latest updates.
curl --silent --location --remote-name https://github.com/jgm/pandoc/releases/download/3.1.6.2/pandoc-3.1.6.2-1-amd64.deb
sudo apt-get install ./pandoc-*amd64.deb
- 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