Skip to content

Commit 0455970

Browse files
authored
Merge pull request #2621 from ReactionMechanismGenerator/docs_push_fix
documentation builder bug fixes and general overhaul
2 parents 0419c44 + 697dac7 commit 0455970

File tree

1 file changed

+56
-29
lines changed

1 file changed

+56
-29
lines changed

.github/workflows/docs.yml

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,27 @@ on:
55
branches:
66
- main
77
pull_request:
8+
schedule:
9+
# * is a special character in YAML so you have to quote this string
10+
- cron: "0 8 * * 1"
811

912
jobs:
1013
build-documentation:
1114
runs-on: ubuntu-latest
12-
strategy:
13-
max-parallel: 5
1415
defaults:
1516
run:
1617
shell: bash -l {0}
1718
steps:
18-
- uses: actions/checkout@v2
19+
- name: Sign into GitHub Actions Bot
20+
run: |
21+
git config --global user.name "github-actions"
22+
git config --global user.email "github-actions@github.com"
23+
24+
- name: Clone RMG-Py
25+
uses: actions/checkout@v2
26+
with:
27+
fetch-depth: 0
28+
1929
- name: Setup Mambaforge Python 3.7
2030
uses: conda-incubator/setup-miniconda@v2
2131
with:
@@ -25,51 +35,68 @@ jobs:
2535
python-version: 3.7
2636
activate-environment: rmg_env
2737
use-mamba: true
38+
2839
- name: Install sphinx
2940
run: mamba install -y sphinx
41+
3042
- name: Mamba info
3143
run: |
3244
mamba info
3345
mamba list
34-
- name: Install and link Julia dependencies
35-
run: |
36-
julia -e "using Pkg; Pkg.add(PackageSpec(url=\"https://github.com/ReactionMechanismGenerator/ReactionMechanismSimulator.jl\", rev=\"main\"))"
37-
julia -e "using Pkg; Pkg.add(\"PyCall\"); Pkg.add(\"DifferentialEquations\")"
38-
python -c "import julia; julia.install()"
39-
- name: Install and compile RMG
46+
47+
- name: Clone RMG-database
4048
run: |
4149
cd ..
4250
git clone https://github.com/ReactionMechanismGenerator/RMG-database.git
43-
cd RMG-Py
44-
sed -i '/embedsignature/s/# //g' setup.py
51+
52+
- name: Set Environment Variables
53+
run: |
54+
RUNNER_CWD=$(pwd)
55+
echo "PYTHONPATH=$RUNNER_CWD/RMG-Py:$PYTHONPATH" >> $GITHUB_ENV
56+
echo "$RUNNER_CWD/RMG-Py" >> $GITHUB_PATH
57+
58+
- name: make RMG
59+
run: |
60+
make clean
4561
make
46-
- uses: actions/checkout@v2
62+
63+
- name: Install and link Julia dependencies
64+
timeout-minutes: 120 # this usually takes 20-45 minutes (or hangs for 6+ hours).
65+
run: |
66+
python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"
67+
julia -e 'using Pkg; Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="main")); using ReactionMechanismSimulator'
68+
69+
- name: Checkout gh-pages Branch
70+
uses: actions/checkout@v2
4771
with:
4872
ref: gh-pages
49-
path: build/html
50-
- name: Make documentation - for testing
51-
if: ${{ github.event_name != 'push' || github.repository != 'ReactionMechanismGenerator/RMG-Py' }}
52-
run: |
53-
cd documentation
54-
sphinx-build -b html -d build/doctrees/ source/ build/html -w errors.log -W --keep-going
55-
- name: Report documentation errors
56-
if: ${{ failure() }}
57-
run: |
58-
cat documentation/errors.log
59-
- name: Make documentation - to publish
60-
if: ${{ github.event_name == 'push' && github.repository == 'ReactionMechanismGenerator/RMG-Py' }}
73+
fetch-depth: 0
74+
path: documentation/build/html
75+
clean: false
76+
77+
- name: Build Documentation
6178
run: |
62-
git config --global user.name "github-actions"
63-
git config --global user.email "github-actions@github.com"
6479
cd documentation
6580
make html
81+
cd build/html
82+
touch .nojekyll
83+
git add -A --force .
84+
git commit -m "Automated documentation rebuild"
85+
6686
- name: Check documentation links
6787
continue-on-error: true
6888
run: |
6989
cd documentation
7090
sphinx-build -b linkcheck -d build/doctrees/ source/ build/linkcheck | grep -e broken -e redirect | grep -v -e 'redirect https://doi.org/' -e 'broken https://doi.org/.* 403 Client Error: Forbidden'
71-
- name: Publish documentation
91+
92+
- name: Test Publish Documentation
93+
if: ${{ github.event_name != 'push' && github.repository == 'ReactionMechanismGenerator/RMG-Py' }}
94+
run: |
95+
cd documentation/build/html
96+
git push --dry-run origin gh-pages
97+
98+
- name: Publish Updated Documentation
7299
if: ${{ github.event_name == 'push' && github.repository == 'ReactionMechanismGenerator/RMG-Py' }}
73100
run: |
74-
touch build/html/.nojekyll
75-
cd build/html; git add -A .; git commit -m "Automated documentation rebuild"; git push origin gh-pages
101+
cd documentation/build/html
102+
git push origin gh-pages

0 commit comments

Comments
 (0)