Skip to content

Install pytest in release-tests session #207

Install pytest in release-tests session

Install pytest in release-tests session #207

Workflow file for this run

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: 8
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13-dev']
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
# NOTE: pdm caching unsupported
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "pdm.lock"
- name: Install dependencies
run: |
python --version
python -m pip install --upgrade pip nox nox-pdm pdm
- name: Run tests
run: |
nox --session tests-cov -- -v --cov-report=xml
nox --session tests-cov-vtk --no-error-on-missing-interpreters -- -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@v4
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 nox-pdm pdm
- 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@v4
with:
submodules: recursive
- name: Cache conda
uses: actions/cache@v4
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@v3
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@v4
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 nox-pdm pdm
- name: Build docs
run: |
nox --session docs -- -W