Merge pull request #374 from glotzerlab/dependabot/pip/doc/pip-a8b236… #37
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
name: PyPI | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
push: | |
branches: | |
- "trunk-*" | |
tags: | |
- "v*" | |
workflow_dispatch: | |
env: | |
UV_VERSION: 0.2.2 | |
jobs: | |
build_wheels: | |
name: Build wheels [${{ matrix.python.version }}, ${{ matrix.os.base }}-${{ matrix.os.arch }}] | |
runs-on: ${{ matrix.os.base }}-${{ matrix.os.version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- base: ubuntu | |
version: latest | |
arch: 'x86_64' | |
- base: windows | |
version: latest | |
arch: 'amd64' | |
- base: macos | |
version: 14 | |
arch: 'arm64' | |
- base: macos | |
version: 13 | |
arch: 'x86_64' | |
python: | |
- version: 'cp39' | |
oldest_numpy: '1.21.6' | |
- version: 'cp310' | |
oldest_numpy: '1.21.6' | |
- version: 'cp311' | |
oldest_numpy: '1.23.2' | |
- version: 'cp312' | |
oldest_numpy: '1.26.2' | |
steps: | |
- uses: actions/[email protected] | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: "${{ matrix.python.version }}-*" | |
CIBW_TEST_REQUIRES: pytest==8.2.1 numpy==${{ matrix.python.oldest_numpy }} | |
- uses: actions/[email protected] | |
with: | |
name: dist-python-${{ matrix.python.version }}-${{ matrix.os.base }}-${{ matrix.os.arch }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
name: Install Python | |
with: | |
python-version: '3.12' | |
- name: Install uv | |
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${{ env.UV_VERSION }}/uv-installer.sh | bash | |
- name: Install build | |
run: 'uv pip install -r .github/requirements-build-sdist.txt --only-binary :all: --system --reinstall' | |
- name: Build sdist | |
run: python -m build --sdist --outdir dist/ . | |
- uses: actions/[email protected] | |
with: | |
name: dist-sdist | |
path: dist/*.tar.gz | |
upload_pypi: | |
name: Publish [PyPI] | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/[email protected] | |
with: | |
merge-multiple: 'true' | |
pattern: dist-* | |
path: dist | |
- name: Check files | |
run: ls -lR dist | |
- name: Upload to PyPI | |
# upload to PyPI on every tag starting with 'v' | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Upload to TestPyPI | |
# otherwise, upload to TestPyPi | |
if: ${{ !startsWith(github.ref, 'refs/tags/v') && (github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) }} | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true |