pyebur128/.github/workflows/build-test-pypi.yml

99 lines
2.8 KiB
YAML

name: Upload to Test PyPI
on:
workflow_dispatch:
inputs:
overrideVersion:
description: Manually force a version
env:
CIBW_BUILD_VERBOSITY: 1
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.overrideVersion }}
jobs:
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install build twine
- name: Build SDist
run: |
python -m build --sdist
- name: Put SDist in artifact container
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
- name: Check SDist metadata
run: |
twine check dist/*
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU on Linux images
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Get Python Version Name
uses: mad9000/actions-find-and-replace-string@5
id: pythonversion
with:
source: ${{ matrix.python }}
find: '.'
replace: ''
- name: "Install Python 3.8 universal2 on macOS arm64"
if: runner.os == 'macOS' && runner.arch == 'arm64'
uses: actions/setup-python@v5
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
with:
python-version: 3.8
- name: Build wheels
uses: joerick/cibuildwheel@v2.20.0
env:
CIBW_BUILD: "cp${{ steps.pythonversion.outputs.value }}-*"
CIBW_ENVIRONMENT: "SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.overrideVersion }}"
- name: Upload wheels to artifact container
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
upload_all:
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- name: Get SDist and wheels from artifact container
uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish wheels to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/