Drop Python 3.8, test Python 3.13 #496
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: Python Package | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
merge_group: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- 'macos-13' | |
- 'windows-latest' | |
runs-on: ${{ matrix.os }} | |
name: Wheel for ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: Add powerpc-unknown-linux-gnu | |
run: rustup target add --toolchain stable powerpc-unknown-linux-gnu | |
- uses: Swatinem/[email protected] | |
- name: Build wheels | |
run: pipx run cibuildwheel==2.20.0 --output-dir dist | |
env: | |
CIBW_BUILD: 'cp39-*' | |
CIBW_SKIP: '*-win32 *-manylinux_i686' | |
- name: Check if there are changes | |
run: git diff --exit-code | |
- name: Store the packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-${{ matrix.os }} | |
path: dist/ | |
linux-build: | |
runs-on: ubuntu-latest | |
container: ghcr.io/pyca/cryptography-manylinux_2_28:x86_64 | |
name: Wheel for Linux | |
env: | |
RUSTUP_HOME: /root/.rustup | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: Avoid issues with Git's solution for CVE-2022-24765 breaking setuptools-scm | |
run: git config --global --add safe.directory $(pwd) | |
- name: Add powerpc-unknown-linux-gnu | |
run: rustup target add --toolchain stable powerpc-unknown-linux-gnu | |
- uses: Swatinem/[email protected] | |
- run: /opt/python/cp39-cp39/bin/python -m venv .venv | |
- name: Update pip | |
run: .venv/bin/python -m pip install --upgrade pip | |
- name: Install Python packages | |
run: .venv/bin/python -m pip install --upgrade build auditwheel | |
- name: build wheel | |
run: .venv/bin/python -m build | |
- name: multilinux stuff | |
run: | | |
.venv/bin/python -m auditwheel repair --plat manylinux_2_28_x86_64 dist/*-linux_x86_64.whl -w dist | |
rm dist/*-linux_x86_64.whl | |
- name: Check if there are changes | |
run: git diff --exit-code | |
- name: Store the packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-linux | |
path: dist/ | |
test: | |
needs: | |
- build | |
- linux-build | |
runs-on: ${{ matrix.os.image }} | |
name: ${{ matrix.os.name }} - Test Python ${{ matrix.python }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- {name: 'macOS', image: 'macos-13', wheel: 'macosx_*'} | |
- {name: 'Windows', image: 'windows-latest', wheel: 'win_amd64'} | |
- {name: 'Linux', image: 'ubuntu-latest', wheel: 'manylinux_2_28_x86_64'} | |
python: | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
- "3.13.0-beta - 3.13.0" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: python-package-* | |
merge-multiple: true | |
path: dist/ | |
- name: Install Python packages | |
run: python -m pip install --upgrade pip pytest | |
- name: install built wheel | |
run: python -m pip install dist/*-${{ matrix.os.wheel }}.whl | |
shell: bash | |
- name: test | |
run: python -m pytest | |
working-directory: test | |
pypi: | |
runs-on: 'ubuntu-latest' | |
needs: | |
- test | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: python-package-* | |
merge-multiple: true | |
path: dist/ | |
- name: Publish 📦 to TestPyPI | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.testpypi_password }} | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish 📦 to PyPI | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.pypi_password }} |