-
Notifications
You must be signed in to change notification settings - Fork 3
100 lines (96 loc) · 2.95 KB
/
webpages.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
name: Pages
on:
push:
branches-ignore:
- 'gh-pages'
env:
R-VERSION: "4.4"
jobs:
job_1:
name: sphinx_html
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install systems dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-gnutls-dev
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ env.R-VERSION }}
- name: Cache R packages
uses: actions/cache@v2
env:
cache-name: cache-R-packages
with:
path: /opt/R/**/lib/R/library
key: ${{ runner.os }}-R${{ env.R-VERSION }}-build-${{ env.cache-name }}
restore-keys: |
${{ runner.os }}-${{ env.R_VERSION }}-build-
- name: Install R dependencies
run: |
install.packages("dplyr")
install.packages("arrow")
Sys.setenv(NOT_CRAN = "true")
install.packages("polars", repos = "https://community.r-multiverse.org")
shell: Rscript {0}
- name: Install Python dependencies
run: |
sudo apt-get update
sudo apt-get install pandoc
python -m pip install --upgrade pip
python setup.py install
pip install -r doc/requirements.txt
- name: Build HTML doc
run: |
export LD_LIBRARY_PATH=$(python -m rpy2.situation LD_LIBRARY_PATH):${LD_LIBRARY_PATH}
python -m rpy2.situation
cd doc
make html
git rev-parse --short HEAD > _build/html/.revforbuild
- name: Archive documentation
uses: actions/upload-artifact@v2
with:
name: html-doc
path: doc/_build/html
job_2:
name: commit_ghpages
runs-on: ubuntu-latest
needs: job_1
steps:
- name: Checkout gh-pages
uses: actions/checkout@v2
with:
ref: gh-pages
fetch-depth: 2
- name: download HTML build
uses: actions/download-artifact@v2
with:
name: html-doc
path: html-doc
- name: Prepare git for commit
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Add HTML build
run: |
DOCPATH="docs/version/${GITHUB_REF##*/}/html"
echo "Doc path: ${DOCPATH}"
git rm -r --ignore-unmatch "${DOCPATH}"
echo "Creating docpath."
mkdir -p "${DOCPATH}"
mv html-doc/.revforbuild .
mv -T html-doc "${DOCPATH}"
echo "Adding docpath to local repos"
git add "${DOCPATH}"
if [ -z $(git status -uno --porcelain) ]; then
echo "No changes to be committed."
else
git commit -m "HTML Sphinx build for $(cat .revforbuild)" "${DOCPATH}";
git push;
fi