Add basic package structure #27
Workflow file for this run
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: CI | |
# by not building all branches on push, we avoid the duplicated builds in PRs | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '**' | |
pull_request: | |
env: | |
NUMBA_NUM_THREADS: 1 | |
MPLBACKEND: Agg | |
PYTEST_ADDOPTS: --color=yes | |
jobs: | |
static-code-checks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- uses: pre-commit/[email protected] | |
with: | |
extra_args: --files $(git diff origin/main --name-only) | |
tests: | |
strategy: | |
matrix: | |
include: | |
# linux builds | |
- python-version: "3.8" | |
os: ubuntu-latest | |
- python-version: "3.9" | |
os: ubuntu-latest | |
- python-version: "3.10" | |
os: ubuntu-latest | |
- python-version: "3.11" | |
os: ubuntu-latest | |
extra-args: ['codecov'] | |
# macos builds | |
- python-version: "3.10" | |
os: macos-latest | |
- python-version: "3.11" | |
os: macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Update pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Build the package | |
run: | | |
pip install build | |
python -m build | |
- name: Install the package | |
run: pip install .[test] | |
- name: Install the package in editable mode | |
run: pip install --editable .[test] | |
- name: Test with pytest | |
run: | | |
pytest --cov --cov-report=xml --cov-branch \ | |
--doctest-modules \ | |
--ignore-glob="*/_dev_version" \ | |
-v | |
- uses: codecov/codecov-action@v3 | |
if: contains(matrix.extra-args, 'codecov') | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Install doc dependencies | |
run: | | |
pip install -e .[doc] | |
git describe --tags | |
python -c 'import template; print(template.__version__)' | |
- name: Build docs | |
run: make html SPHINXOPTS="-W --keep-going -n --color -j auto" | |
- name: Deploy to github pages | |
# only run on push to master | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: build/html | |
clean: true | |
single_commit: true |