Update test_and_deploy.yml, actions/checkout and actions/setup-python versions #81
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
# This workflow: | |
# - runs tests on pull requests | |
# - runs tests on pushing to main | |
# - if it's a tag push and the tag starts with v, and if the tests pass, | |
# deploys to PyPI using Trusted Publishers: | |
# https://docs.pypi.org/trusted-publishers/ | |
name: test-and-deploy | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
name: ${{ matrix.platform }} py${{ matrix.python }} | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest, windows-latest, macos-latest] | |
# test spec-0 earliest and latest Python versions | |
# https://scientific-python.org/specs/spec-0000/ | |
python: ["3.10", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
# these libraries enable testing Qt on Linux | |
- uses: tlambert03/setup-qt-libs@v1 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox-gh-actions | |
python -m pip install .[dev,testing] | |
- name: Test with tox | |
run: tox | |
- name: Coverage | |
uses: codecov/codecov-action@v1 | |
if: runner.os == 'Linux' && matrix.python == '3.11' | |
deploy: | |
needs: [test] | |
runs-on: ubuntu-latest | |
if: contains(github.ref, 'tags') | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install .[dev,testing] | |
- name: Build | |
run: | | |
git tag | |
python -m build | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Publish to GitHub | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.ref }} | |
name: ${{ env.tag }} | |
# body: add when we add release notes | |
draft: false | |
prerelease: ${{ contains(github.ref, 'rc') }} | |
files: | | |
dist/* |