Skip to content

Bump actions/download-artifact from 4 to 7 #321

Bump actions/download-artifact from 4 to 7

Bump actions/download-artifact from 4 to 7 #321

name: Test and Publish
on:
push:
pull_request:
branches: ["develop"]
jobs:
is-duplicate:
name: Is Duplicate
runs-on: ubuntu-24.04
outputs:
should_skip: ${{ steps.skip-check.outputs.should_skip }}
permissions:
actions: write
contents: read
steps:
- id: skip-check
name: Skip Check
uses: fkirc/skip-duplicate-actions@master
with:
paths_ignore: '["**.rst", "**.md", "**.txt"]'
test-code:
name: Test code
runs-on: ${{ matrix.os }}
needs: is-duplicate
if: needs.is-duplicate.outputs.should_skip != 'true'
strategy:
matrix:
# List of runner versions:
# https://docs.github.com/en/actions/reference/runners/github-hosted-runners
os: [ubuntu-24.04, macos-26-intel, windows-2025]
# List of Python versions:
# https://devguide.python.org/versions/
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Check out code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test with Tox
run: tox -e ${{ matrix.python-version }},lint
build-wheels:
name: Build wheels
runs-on: ${{ matrix.os }}
needs: test-code
if: |
!failure() &&
(
startsWith(github.ref, 'refs/heads/develop') ||
(
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
)
)
strategy:
matrix:
# List of runner versions:
# https://docs.github.com/en/actions/reference/runners/github-hosted-runners
os: [ubuntu-24.04, macos-26-intel, windows-2025]
steps:
- name: Check out code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.0
- name: Upload artefacts to GitHub
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: wheelhouse/*.whl
build-sdist:
name: Build source distribution
runs-on: ubuntu-24.04
needs: test-code
if: |
!failure() &&
(
startsWith(github.ref, 'refs/heads/develop') ||
(
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
)
)
steps:
- name: Check out code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build sdist
run: |
pipx run build --sdist
pipx run twine check dist/*
- name: Upload artefacts to GitHub
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
publish-to-test-pypi:
name: Publish to TestPyPI
environment: staging
runs-on: ubuntu-24.04
needs: [build-sdist, build-wheels]
if: |
!failure() &&
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artefacts
uses: actions/download-artifact@v8
with:
name: cibw-*
path: dist
merge-multiple: true
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@v1.8.14
with:
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.PYPI_API_TOKEN }}
print-hash: true
publish-to-pypi:
name: Publish to PyPI
environment: production
runs-on: ubuntu-24.04
needs: [publish-to-test-pypi]
if: |
!failure() &&
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artefacts
uses: actions/download-artifact@v8
with:
name: cibw-*
path: dist
merge-multiple: true
- name: Publish to test PyPI
uses: pypa/gh-action-pypi-publish@v1.8.14
with:
password: ${{ secrets.PYPI_API_TOKEN }}
print-hash: true