[pre-commit.ci] pre-commit autoupdate #157
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: build | |
on: | |
push: | |
branches: [ main ] | |
# tags: ['*'] | |
pull_request: | |
branches: [ main ] | |
release: | |
types: | |
- published | |
env: | |
FORCE_COLOR: 1 | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 5 | |
matrix: | |
python-version: ['3.9', '3.10'] # No vtk available for 3.11 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "requirements/tests.txt" | |
- name: Verify Python environment | |
run: | | |
pip list | |
pip cache list | |
pip check | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip nox | |
- name: Run tests | |
run: | | |
nox --session tests-cov -- -v --cov-report=xml | |
nox --session tests-cov-vtk -- -v --cov-report=xml | |
- name: Run mypy | |
run: | | |
nox --session types | |
- name: Upload coverage | |
if: ${{ success() && matrix.python-version == '3.7' }} | |
run: | | |
pip install coveralls coverage[toml] | |
coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
needs: [tests, tests-miniforge, docs] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: python -m pip install --upgrade pip nox | |
- name: Package | |
run: nox --session release-build | |
- name: Publish package | |
if: | | |
( | |
( github.event_name == 'release' && github.event.action == 'published' ) || | |
( github.event_name == 'push' && startsWith(github.ref, 'refs/tags') ) | |
) | |
env: | |
TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} | |
run: nox --session release-upload -- --repository testpypi | |
tests-miniforge: | |
name: test (${{ matrix.os }}, ${{ matrix.miniforge-variant }}) | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu", "macos", "windows"] | |
include: | |
- os: ubuntu | |
environment-file: .github/environment_pypy.yml | |
miniforge-variant: Mambaforge-pypy3 | |
- os: macos | |
environment-file: .github/environment.yml | |
miniforge-variant: Mambaforge | |
- os: windows | |
environment-file: .github/environment.yml | |
miniforge-variant: Mambaforge | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Cache conda | |
uses: actions/cache@v2 | |
env: | |
# Increase this value to reset cache if environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: ${{ matrix.miniforge-variant }} | |
environment-file: ${{ matrix.environment-file }} | |
condarc-file: .github/condarc.yml | |
use-mamba: true | |
- name: Verify Python environment | |
shell: bash -l {0} | |
run: | | |
mamba list | |
python --version | |
- name: Install dependencies | |
shell: bash -l {0} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install .[tests] | |
- name: Run tests | |
shell: bash -l {0} | |
run: | | |
python -m pytest -v -n auto | |
docs: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
# This is required because asv (air speed velocity) needs this | |
- name: Fetch main | |
if: github.ref != 'refs/heads/main' | |
run: git fetch origin $GITHUB_BASE_REF:main $GITHUB_REF:pr | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
cache: "pip" | |
cache-dependency-path: "requirements/docs.txt" | |
- name: Verify Python environment | |
run: | | |
pip list | |
pip cache list | |
pip check | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip nox | |
- name: Build docs | |
run: | | |
nox --session docs -- -W |