Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 30 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: Test
on:
pull_request:
push:
branches: ["**"]
branches: [master]
tags: ["v*"]
workflow_dispatch:
inputs:
publish_to:
Expand All @@ -16,26 +17,30 @@ on:
- testpypi
- pypi

permissions:
contents: read

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}
cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' }}

jobs:
build:
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

name: Build source distribution
name: Build distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- uses: actions/checkout@v7.0.1
- uses: actions/setup-python@v7.0.0
with:
python-version: "3.15"
cache: pip

- name: Build sdist
- name: Build sdist and wheel
run: |
pip install nox
python -m pip install nox
nox -s build

- uses: actions/upload-artifact@v6
- uses: actions/upload-artifact@v6.0.0
with:
name: build-dist
path: ${{ github.workspace }}/dist/
Expand All @@ -50,31 +55,33 @@ jobs:
shell: bash -l {0}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]

steps:
- uses: actions/checkout@v7
- uses: actions/checkout@v7.0.1
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
uses: actions/setup-python@v7.0.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: pip

- name: Download source distribution
uses: actions/download-artifact@v8
- name: Download distributions
uses: actions/download-artifact@v8.0.2
with:
name: build-dist
path: ${{ github.workspace }}/dist

- name: Test
run: |
pip install --upgrade pip
pip install nox
python -m pip install nox
nox -s test -- dist/*.whl

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v7
uses: codecov/codecov-action@v7.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -88,13 +95,13 @@ jobs:
RESULT: ${{ needs.test.result }}
run: |
if [ "$RESULT" != "success" ]; then
echo "One or more tests failed: $RESULT"
echo "Checks did not succeed: test=$RESULT"
exit 1
fi
echo "All tests passed."

publish:
needs: [test]
needs: [tests-passed]
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && inputs.publish_to != 'none'
env:
Expand All @@ -104,17 +111,16 @@ jobs:
id-token: write

steps:
- uses: actions/download-artifact@v8
- uses: actions/download-artifact@v8.0.2
with:
pattern: build-*
merge-multiple: true
path: ${{ github.workspace }}/dist

- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@v1.14.2
with:
repository-url: ${{ env.REPOSITORY_URL }}
packages-dir: dist
skip-existing: true
skip-existing: false
print-hash: true
verify-metadata: false
Loading