Skip to content

Move code-quality into its own job. #61

Move code-quality into its own job.

Move code-quality into its own job. #61

Workflow file for this run

name: Pages
on:
push:
branches-ignore:
- 'gh-pages'
env:
R-VERSION: "4.2"
jobs:
job_1:
name: sphinx_html
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- 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 dependencies
run: |
sudo apt-get update
sudo apt-get install pandoc
python -m pip install --upgrade pip
python setup.py install
sudo Rscript scripts/install_r_packages.r scales R6
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@v3
with:
ref: gh-pages
fetch-depth: 2
- name: download HTML build
uses: actions/download-artifact@v3
with:
name: html-doc
path: html-doc
- name: Prepare git for commit
run: |
git config user.name github-actions
git config user.email [email protected]
- 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