Test limited API #647
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: CI | |
on: [push, pull_request] | |
jobs: | |
lint: | |
# Run for PRs only if they come from a forked repo (avoids duplicate runs) | |
if: >- | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
toxenv: [flake8, black, mypy, docs] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install tox | |
run: python -m pip install tox | |
- name: Run tox ${{ matrix.toxenv }} | |
run: tox -e ${{ matrix.toxenv }} | |
build: | |
if: >- | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # required for setuptools_scm | |
- name: Build sdist and temporary wheel | |
run: pipx run build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: dist/*.tar.gz | |
test: | |
if: >- | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
timeout-minutes: 10 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
include: | |
- os: macos-13 | |
python-version: "3.10" | |
- os: macos-14 | |
python-version: "3.10" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install tox | |
run: python -m pip install tox | |
- name: Test | |
run: tox -e py | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
wheels: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: [lint, test] | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # required for setuptools_scm | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: "cp*-manylinux_x86_64 cp3*-win_amd64 cp3*-macosx_x86_64 cp3*-macosx_arm64" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.os }} | |
path: wheelhouse/*.whl | |
publish: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: [build, wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: sdist | |
path: dist/ | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: wheels-* | |
path: dist/ | |
merge-multiple: true | |
- name: Publish to PyPI | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.pypi_password }} | |
#password: ${{ secrets.test_pypi_password }} | |
#repository_url: https://test.pypi.org/legacy/ |