Skip to content

Commit ed60fd6

Browse files
committed
build documentation from master and preview from docs
1 parent f5d8e64 commit ed60fd6

4 files changed

Lines changed: 132 additions & 70 deletions

File tree

.github/workflows/docs.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build-and-deploy:
9+
name: build and deploy docs
10+
runs-on: ubuntu-latest
11+
env:
12+
MPLBACKEND: 'Agg'
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python 3.11
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: 3.11
21+
22+
- name: Install OQ and dependencies
23+
run: |
24+
sudo apt-get install -y libspatialindex-dev
25+
git clone --depth=1 https://github.com/gem/oq-engine.git
26+
cd oq-engine
27+
python ./install.py devel
28+
cd ..
29+
source $HOME/openquake/bin/activate
30+
pip install h3
31+
pip install -r requirements.txt
32+
pip install -e .
33+
pip install sphinx furo recommonmark
34+
35+
- name: Build HTML docs
36+
run: |
37+
source $HOME/openquake/bin/activate
38+
sphinx-build -b html doc_src/source doc_src/build/html
39+
touch doc_src/build/html/.nojekyll
40+
41+
- name: Deploy to GitHub Pages
42+
uses: peaceiris/actions-gh-pages@v4
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_branch: gh-pages
46+
publish_dir: doc_src/build/html/
47+
commit_message: "deploy docs from master"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: docs preview
2+
3+
on:
4+
push:
5+
branches: [ docs ]
6+
7+
jobs:
8+
build-and-deploy:
9+
name: build and deploy docs preview
10+
runs-on: ubuntu-latest
11+
env:
12+
MPLBACKEND: 'Agg'
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python 3.11
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: 3.11
21+
22+
- name: Install OQ and dependencies
23+
run: |
24+
sudo apt-get install -y libspatialindex-dev
25+
git clone --depth=1 https://github.com/gem/oq-engine.git
26+
cd oq-engine
27+
python ./install.py devel
28+
cd ..
29+
source $HOME/openquake/bin/activate
30+
pip install h3
31+
pip install -r requirements.txt
32+
pip install -e .
33+
pip install sphinx furo recommonmark
34+
35+
- name: Build HTML docs
36+
run: |
37+
source $HOME/openquake/bin/activate
38+
sphinx-build -b html doc_src/source doc_src/build/html
39+
touch doc_src/build/html/.nojekyll
40+
41+
- name: Deploy preview to gh-pages/preview/docs
42+
uses: peaceiris/actions-gh-pages@v4
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_branch: gh-pages
46+
publish_dir: doc_src/build/html/
47+
destination_dir: preview/docs
48+
commit_message: "docs preview from docs branch"

.github/workflows/test.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
schedule:
9+
- cron: "0 1 * * *"
10+
11+
jobs:
12+
test:
13+
name: pytest
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python 3.11
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: 3.11
22+
- name: Install OQ and dependencies
23+
run: |
24+
sudo apt-get install libspatialindex-dev
25+
git clone --depth=1 https://github.com/gem/oq-engine.git
26+
cd oq-engine
27+
python ./install.py devel
28+
cd ..
29+
source $HOME/openquake/bin/activate
30+
pip install h3
31+
pip install -r requirements.txt
32+
pip install -e .
33+
deactivate
34+
- name: Run test with pytest
35+
run: |
36+
source $HOME/openquake/bin/activate
37+
pytest openquake tests -W ignore::UserWarning

.github/workflows/test_page.yaml

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)