Switch from flake8/yapf to ruff #781
Workflow file for this run
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: | |
# Trigger on pull requests. | |
pull_request: | |
# Trigger on pushes to the mainline branches and version tags. This prevents building commits | |
# twice when the pull request source branch is in the same repository. | |
push: | |
branches: | |
- "trunk-patch" | |
- "trunk-minor" | |
- "trunk-major" | |
tags: | |
- "v*" | |
# Trigger on request. | |
workflow_dispatch: | |
jobs: | |
build_wheels: | |
name: Build wheels [py${{ matrix.python_version }}, ${{ matrix.os }}] | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu, windows, macos] | |
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.2 | |
env: | |
CIBW_PROJECT_REQUIRES_PYTHON: "==${{ matrix.python_version }}.*" | |
- uses: actions/upload-artifact@v4.1.0 | |
with: | |
name: dist-python-${{ matrix.python_version }}-${{ matrix.os }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
- uses: actions/setup-python@v5.0.0 | |
name: Install Python | |
with: | |
python-version: '3.11' | |
- uses: actions/cache@v3.3.2 | |
with: | |
path: ~/.cache/pip | |
key: gsd-build-wheels-pip-${{ hashFiles('.github/requirements-build-sdist.txt') }} | |
restore-keys: | | |
gsd-build-wheels-pip- | |
- name: Install build | |
run: python3 -m pip --disable-pip-version-check install -r .github/requirements-build-sdist.txt --progress-bar=off | |
- name: Build sdist | |
run: python -m build --sdist --outdir dist/ . | |
- uses: actions/upload-artifact@v4.1.0 | |
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/download-artifact@v4.1.0 | |
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/gh-action-pypi-publish@v1.8.11 | |
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/gh-action-pypi-publish@v1.8.11 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true |