[CI Bot] environment lockfiles auto-update #341
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
# Reference: | |
# - https://github.com/actions/checkout | |
# - https://github.com/actions/download-artifact | |
# - https://github.com/actions/upload-artifact | |
# - https://github.com/pypa/cibuildwheel | |
# - https://github.com/pypa/build | |
# - https://github.com/pypa/gh-action-pypi-publish | |
# - https://test.pypi.org/help/#apitoken | |
name: ci-wheels | |
on: | |
pull_request: | |
push: | |
branches: | |
- "main" | |
- "v*x" | |
- "!auto-update-lockfiles" | |
- "!pre-commit-ci-update-config" | |
- "!dependabot/*" | |
tags: | |
- "v*" | |
jobs: | |
build_bdist: | |
name: "build ${{ matrix.os }} (${{ matrix.arch }}) wheels" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
arch: ["x86_64", "arm64"] | |
exclude: | |
- os: "ubuntu-latest" | |
arch: "arm64" | |
- os: "windows-latest" | |
arch: "x86_64" | |
- os: "windows-latest" | |
arch: "arm64" | |
include: | |
- os: "windows-latest" | |
arch: "AMD64" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "build ${{ matrix.os }} (${{ matrix.arch }}) wheels" | |
uses: pypa/[email protected] | |
env: | |
CIBW_SKIP: "cp39-* cp313-* pp* *-musllinux*" | |
CIBW_ARCHS: ${{ matrix.arch }} | |
CIBW_BUILD_FRONTEND: "build" | |
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" | |
CIBW_TEST_SKIP: "*-macosx_arm64" | |
CIBW_TEST_REQUIRES: "pytest" | |
CIBW_TEST_COMMAND: > | |
python -m pytest --pyargs stratify | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pypi-${{ matrix.os }}-${{ matrix.arch }}-artifact | |
path: ${{ github.workspace }}/wheelhouse/*.whl | |
build_sdist: | |
name: "Build sdist" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Building sdist" | |
shell: bash | |
run: | | |
pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pypi-sdist | |
path: ${{ github.workspace }}/dist/*.tar.gz | |
show-artifacts: | |
needs: [build_bdist, build_sdist] | |
name: "Show artifacts" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: ${{ github.workspace }}/dist | |
- shell: bash | |
run: | | |
ls -l ${{ github.workspace }}/dist | |
publish-artifacts-test-pypi: | |
needs: [build_bdist, build_sdist] | |
name: "Publish to Test PyPI" | |
runs-on: ubuntu-latest | |
# upload to Test PyPI for every commit on main branch | |
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: ${{ github.workspace }}/dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
skip_existing: true | |
print_hash: true | |
publish-artifacts-pypi: | |
needs: [build_bdist, build_sdist] | |
name: "Publish to PyPI" | |
runs-on: ubuntu-latest | |
# upload to PyPI for every tag starting with 'v' | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: ${{ github.workspace }}/dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
print_hash: true |