tests #118
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: tests | |
on: | |
# Trigger the workflow on push or pull request on main branch | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
# Run cron job every month, https://crontab.guru/every-month | |
- cron: '0 0 1 * *' | |
workflow_dispatch: | |
jobs: | |
# This job tests that the CC works | |
test-cc-and-jb-build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] # currently not testing on windows | |
python-version: [3.9] | |
steps: | |
- uses: actions/checkout@v2 | |
# Setup | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
# Use the default CC | |
- name: Check black style | |
run: | | |
black ./ --check | |
# Run tests | |
- name: Pytest tests | |
run: | | |
pytest | |
# Build the example book | |
- name: Build default book | |
run: | | |
cookiecutter . --no-input --overwrite-if-exists | |
pip install -r my_book/requirements.txt | |
jupyter-book build my_book/my_book/ | |
# Push example book to gh-pages-test | |
- name: GitHub Pages action | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: my_book/my_book/_build/html | |
publish_branch: gh-pages-test |