-
-
Notifications
You must be signed in to change notification settings - Fork 199
91 lines (75 loc) · 2.49 KB
/
documentation.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
name: Documentation
# Run on all pushes and pull requests, and on demand
on:
push:
pull_request:
workflow_dispatch:
# Limit workflow permissions
permissions:
contents: read
# Limit simultaneous workflow runs
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
FORCE_COLOR: "1"
jobs:
render:
name: Render
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: |
requirements/base.txt
requirements/docs.txt
- name: Install Pandoc
run: sudo apt-get install --yes pandoc
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install HARK
run: python -m pip install .[docs]
- name: Run Sphinx
run: >
sphinx-build -M html docs HARK-docs -T -c docs -j 1
- name: Set up git for deployment
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git config --local --unset-all http.https://github.com/.extraheader
- name: Commit all rendered HTML files
run: |
git switch --orphan gh-pages
git add --all HARK-docs/html
git commit -qm "Documentation from @ ${{ github.repository }}@${{ github.sha }}"
- name: Deploy to GitHub Pages
# Only deploy to Pages on pushes to HEAD
if:
(github.repository_owner == 'Econ-ARK') && (github.event_name ==
'push') && (github.ref_name == 'master')
run: >
git push --force https://x-access-token:${{ github.token
}}@github.com/${{ github.repository }} `git subtree split --prefix
HARK-docs/html gh-pages`:refs/heads/gh-pages
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade sphinx-lint
- name: Lint documentation with sphinx-lint
run: >
sphinx-lint --ignore docs/example_notebooks/GenIncProcessModel.py
--enable all --max-line-length 85 README.md docs/