[pre-commit.ci] pre-commit autoupdate #815
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: Build | |
on: [push, pull_request] | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
python-version: '3.10' | |
- run: | | |
python -m pip install pylint | |
python -m pip install -e . | |
- uses: pre-commit/[email protected] | |
with: | |
extra_args: pylint --all-files | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
python-version: '3.10' | |
- name: Build sdist | |
run: | | |
python -m pip install --user build | |
python -m build --sdist | |
- uses: actions/[email protected] | |
with: | |
name: source | |
path: dist/*.tar.gz | |
build_wheels: | |
needs: build_sdist | |
name: Build wheel ${{ matrix.wheel }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- { arch: arm64, wheel: cp310-macosx_arm64, os: macos-latest } | |
- { arch: x86_64, wheel: cp310-macosx_x86_64, os: macos-13 } | |
- { arch: x86_64, wheel: cp310-manylinux_x86_64, os: ubuntu-latest } | |
- { arch: x86_64, wheel: cp310-win_amd64, os: windows-2019 } | |
- { arch: arm64, wheel: cp311-macosx_arm64, os: macos-latest } | |
- { arch: x86_64, wheel: cp311-macosx_x86_64, os: macos-13 } | |
- { arch: x86_64, wheel: cp311-manylinux_x86_64, os: ubuntu-latest } | |
- { arch: x86_64, wheel: cp311-win_amd64, os: windows-2019 } | |
- { arch: arm64, wheel: cp312-macosx_arm64, os: macos-latest } | |
- { arch: x86_64, wheel: cp312-macosx_x86_64, os: macos-13 } | |
- { arch: x86_64, wheel: cp312-manylinux_x86_64, os: ubuntu-latest } | |
- { arch: x86_64, wheel: cp312-win_amd64, os: windows-2019 } | |
steps: | |
- name: Download source distribution | |
uses: actions/[email protected] | |
with: | |
name: source | |
- name: Unpack source distribution | |
shell: bash | |
run: tar --strip-components 1 -xvf *.tar.gz | |
- name: Build wheel | |
uses: pypa/[email protected] | |
with: | |
output-dir: wheelhouse | |
env: | |
CIBW_ARCHS_MACOS: ${{ matrix.arch }} | |
CIBW_BUILD: ${{ matrix.wheel }} | |
CIBW_TEST_COMMAND: python -m unittest discover -v -s {package}/tests | |
CIBW_BUILD_VERBOSITY: 1 | |
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.arch == 'arm64' && '11' || '10.14' }} | |
- uses: actions/[email protected] | |
with: | |
name: ${{ matrix.wheel }} | |
path: ./wheelhouse/*.whl | |
build_docs: | |
name: Build docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
python-version: '3.12' | |
- run: | | |
pip install -e .[docs] | |
cd docs && make html coverage | |
upload_pypi: | |
name: Upload wheels to PyPI | |
needs: [lint, build_docs, build_sdist, build_wheels] | |
environment: | |
name: pypi | |
url: https://pypi.org/p/pypcode | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
# Upload to PyPI on every tag starting with 'v' | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/[email protected] | |
with: | |
path: artifacts | |
- run: | | |
mkdir dist | |
find artifacts -type f -exec mv {} dist \; | |
- uses: pypa/[email protected] |