Testing notebooks and publish HTML #245
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: 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@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
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@v4 | |
- uses: conda-incubator/setup-miniconda@v3 | |
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@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
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/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_build/html/ | |
commit_message: ${{ github.event.head_commit.message }} |