Skip to content

Testing notebooks and publish HTML #231

Testing notebooks and publish HTML

Testing notebooks and publish HTML #231

name: Testing notebooks and publish HTML
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '0 5 * * 1'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
# Don't cancel jobs if one is failing
fail-fast: false
matrix:
include:
- name: Linux with the oldest version of dependencies
os: ubuntu-latest
python: '3.8'
toxenv: py38-test-oldestdeps
- name: OSX
os: macos-latest
python: '3.11'
toxenv: py311-test
- name: Windows
os: windows-latest
python: '3.9'
toxenv: py39-test
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: python -m pip install --upgrade tox
- name: Execute notebooks as testing
run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}
conda:
name: test conda env file
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
# Don't cancel jobs if one is failing
fail-fast: false
matrix:
os: ["windows-latest", "ubuntu-latest", "macos-latest"]
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2.2.0
with:
environment-file: environment.yml
activate-environment: navo-env
auto-activate-base: false
- run: pip install -r doc-requirements.txt
- run: |
python check_env.py
bash -c 'find content -name "*.md" | xargs jupytext --to notebook '
pytest --nbval content/
publish:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
name: Publish HTML
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: python -m pip install --upgrade tox
- name: Execute notebooks as testing
run: tox -e py310-buildhtml
- name: Publish
uses: peaceiris/actions-gh-pages@v3.6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html/
commit_message: ${{ github.event.head_commit.message }}