Skip to content

[pre-commit.ci] pre-commit autoupdate (#150) #314

[pre-commit.ci] pre-commit autoupdate (#150)

[pre-commit.ci] pre-commit autoupdate (#150) #314

# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: tests
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: ${{ matrix.platform }} py${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
with:
python-version: ${{ matrix.python-version }}
activate-environment: "true"
- name: Setup headless screen
uses: pyvista/setup-headless-display-action@7d84ae825e6d9297a8e99bdbbae20d1b919a0b19 # v4.2
with:
qt: true
wm: herbstluftwm
# note: if you need dependencies from conda, considering using
# setup-miniconda: https://github.com/conda-incubator/setup-miniconda
# and
# tox-conda: https://github.com/tox-dev/tox-conda
- name: Test with tox
run: uvx --with tox-gh-actions tox
env:
PLATFORM: ${{ matrix.platform }}
- name: Upload coverage data
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: covreport-${{ matrix.platform }}-py${{ matrix.python-version }}
include-hidden-files: true
path: .coverage*
if-no-files-found: error
coverage_report:
if: ${{ always() }}
secrets: inherit
needs: [test]
uses: napari/shared-workflows/.github/workflows/upload_coverage.yml@main
with:
artifact-pattern: 'covreport-*'
build-and-inspect-package:
name: Build & inspect package.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: hynek/build-and-inspect-python-package@efb823f52190ad02594531168b7a2d5790e66516 # v2.14.0
deploy:
# this will run when you have tagged a commit, starting with "v*"
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
needs: [test, build-and-inspect-package]
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')
permissions:
id-token: write
steps:
- name: Download built artifact to dist/
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: Packages
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0