Update test_helpers.py #111
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GH Pages | |
on: | |
push: | |
branches: | |
- "master" | |
- "main" | |
- "doc*" | |
#pull_request: | |
# types: | |
# - labeled | |
workflow_dispatch: | |
env: | |
# Increase this value to reset cache if etc/example-environment.yml has not changed | |
CACHE_NUMBER: 1 | |
jobs: | |
build: | |
# if: ${{ github.event.label.name == 'documentation' }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3/envs/docs | |
name: ${{ matrix.label }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: docs | |
auto-activate-base: false | |
use-mamba: true | |
- name: Set cache date | |
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ matrix.prefix }} | |
key: ${{ matrix.label }}-conda-${{ hashFiles('docs/requirements.yaml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update environment | |
run: mamba env update -n docs -f docs/requirements.yaml | |
if: steps.cache.outputs.cache-hit != 'true' | |
#- name: Cache conda | |
# uses: actions/cache@v2 | |
# with: | |
# path: ~/conda_pkgs_dir | |
# key: | |
# ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ | |
# hashFiles('docs/requirements.yaml') }} | |
#- name: Create conda env | |
## # More info on options: https://github.com/conda-incubator/setup-miniconda | |
# uses: conda-incubator/setup-miniconda@v2 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# environment-file: docs/requirements.yaml | |
# channels: conda-forge,defaults | |
# activate-environment: docs | |
## auto-update-conda: false | |
# # auto-activate-base: false | |
# show-channel-urls: true | |
# use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
- name: Run sphinx | |
shell: bash -l {0} | |
run: | | |
sphinx-build docs docs/_build/html/ | |
# Create an artifact of the html output. | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: DocumentationHTML | |
path: docs/_build/html/ | |
# Publish built docs to gh-pages branch. | |
# =============================== | |
- name: Commit documentation changes | |
run: | | |
git clone https://github.com/florianj77/protex.git --branch gh-pages --single-branch gh-pages | |
cp -r docs/_build/html/* gh-pages/ | |
cd gh-pages | |
touch .nojekyll | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Update documentation" -a || true | |
# The above command will fail if no changes were present, so we ignore | |
# that. | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: gh-pages | |
directory: gh-pages |