Skip to content

[pre-commit.ci] pre-commit autoupdate #279

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #279

Workflow file for this run

name: Unit Testing and Deployment
on:
pull_request:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ALLOW_PLOTTING: true
SHELLOPTS: 'errexit:pipefail'
jobs:
doc:
name: Build Documentation
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install pytest-pyvista with test dependencies
run: pip install .[docs] 'pyvista>=0.37'
- uses: awalsh128/[email protected]
with:
packages: libgl1-mesa-glx xvfb
version: 3.0
- name: Build Documentation
run: |
make -C doc html
touch doc/_build/html/.nojekyll
- name: Deploy on release
if: startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: doc/_build/html/
Linux:
name: Linux Unit Testing
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: '3.8'
vtk-version: '9.0.3'
- python-version: '3.9'
vtk-version: '9.1'
- python-version: '3.10'
vtk-version: '9.2.2'
- python-version: '3.11'
vtk-version: 'latest'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install pytest-pyvista with test dependencies
run: |
pip install .[tests] 'pyvista>=0.37'
- name: Set up vtk
if: ${{ matrix.vtk-version != 'latest' }}
run: pip install vtk==${{ matrix.vtk-version }}
- name: Limit NumPy for VTK 9.0.3
if: ${{ matrix.vtk-version == '9.0.3' }}
run: pip install 'numpy<1.24'
- uses: awalsh128/[email protected]
with:
packages: libgl1-mesa-glx xvfb python-tk
version: 3.0
- name: Software Report
run: |
xvfb-run python -c "import pytest_pyvista; pytest_pyvista"
which python
pip list
- name: Unit Testing
run: xvfb-run coverage run -m --source=pytest_pyvista --module pytest --verbose .
- uses: codecov/codecov-action@v3
if: matrix.python-version == '3.9'
name: 'Upload coverage to CodeCov'
release:
name: Release
if: |
github.event_name == 'push' &&
contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip build twine
- name: Build artifacts
run: |
python -m build && python -m twine check dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m twine upload --skip-existing ./**/*.whl
python -m twine upload --skip-existing ./**/*.tar.gz
- name: Publish to GitHub
uses: softprops/action-gh-release@v1
with:
files: |
./**/*.whl
./**/*.tar.gz
downstream:
name: Downstream tests
runs-on: ubuntu-20.04 # matching pyvista
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: git clone --depth=1 https://github.com/pyvista/pyvista.git --branch main --single-branch
- name: Install pyvista
run: pip install -ve .
working-directory: pyvista
- name: Install pyvista test requirements
run: pip install -v -r requirements_test.txt
working-directory: pyvista
- name: Install pytest-pyvista
run: pip install -ve .
- name: Software Report
run: |
xvfb-run python -c "import pyvista; print(pyvista.Report()); from pyvista import examples; print('User data path:', examples.USER_DATA_PATH)"
which python
pip list
working-directory: pyvista
- name: Unit Testing
run: xvfb-run python -m pytest --fail_extra_image_cache -v --generated_image_dir gen_dir tests/plotting/test_plotting.py
working-directory: pyvista
- name: Upload generated image artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: generated_images
path: pyvista/gen_dir