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

102 lines
2.9 KiB
YAML
Raw Normal View History

2021-03-25 19:08:17 +00:00
name: Upload to Test PyPI
on:
workflow_dispatch:
inputs:
overrideVersion:
description: Manually force a version
2021-03-25 19:08:17 +00:00
env:
CIBW_BUILD_VERBOSITY: 1
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.overrideVersion }}
2021-03-25 19:08:17 +00:00
jobs:
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
2024-09-03 19:19:03 +00:00
uses: actions/checkout@v4
2021-03-25 19:29:10 +00:00
with:
submodules: recursive
2021-03-25 19:08:17 +00:00
- name: Setup Python
2024-09-03 19:19:03 +00:00
uses: actions/setup-python@v5
2021-03-25 19:08:17 +00:00
with:
2024-09-03 19:19:03 +00:00
python-version: '3.12'
2021-03-25 19:08:17 +00:00
- name: Install dependencies
run: |
python -m pip install build twine
- name: Build SDist
run: |
python -m build --sdist
- name: Put SDist in artifact container
2024-09-03 19:19:03 +00:00
uses: actions/upload-artifact@v4
2021-03-25 19:08:17 +00:00
with:
2024-09-04 01:17:17 +00:00
name: cibw-sdist
2021-03-25 19:08:17 +00:00
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:
2024-09-04 00:46:30 +00:00
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
2024-09-03 19:19:03 +00:00
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2021-03-25 19:08:17 +00:00
steps:
- name: Checkout repository
2024-09-03 19:19:03 +00:00
uses: actions/checkout@v4
2021-03-25 19:29:10 +00:00
with:
submodules: recursive
- name: Set up QEMU on Linux images
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
2024-09-04 01:03:15 +00:00
- 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
2021-03-25 19:08:17 +00:00
with:
python-version: 3.8
2021-03-25 19:08:17 +00:00
- name: Build wheels
2024-09-03 19:19:03 +00:00
uses: joerick/cibuildwheel@v2.20.0
2021-03-25 19:08:17 +00:00
env:
CIBW_ARCHS_LINUX: "auto aarch64 ppc64le s390x"
CIBW_ARCHS_WINDOWS: "auto ARM64"
2024-09-04 01:03:15 +00:00
CIBW_BUILD: "cp${{ steps.pythonversion.outputs.value }}-*"
CIBW_ENVIRONMENT: "SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.inputs.overrideVersion }}"
2021-03-25 19:08:17 +00:00
- name: Upload wheels to artifact container
2024-09-03 19:19:03 +00:00
uses: actions/upload-artifact@v4
2021-03-25 19:08:17 +00:00
with:
2024-09-04 01:17:17 +00:00
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
2024-09-04 00:46:30 +00:00
path: ./wheelhouse/*.whl
2021-03-25 19:08:17 +00:00
upload_all:
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
2024-09-04 01:42:55 +00:00
environment: release
permissions:
id-token: write
2021-03-25 19:08:17 +00:00
steps:
- name: Get SDist and wheels from artifact container
2024-09-03 19:19:03 +00:00
uses: actions/download-artifact@v4
2021-03-25 19:08:17 +00:00
with:
2024-09-04 01:17:17 +00:00
pattern: cibw-*
2021-03-25 19:08:17 +00:00
path: dist
2024-09-04 01:17:17 +00:00
merge-multiple: true
2021-03-25 19:08:17 +00:00
- name: Publish wheels to Test PyPI
2024-09-04 01:42:55 +00:00
uses: pypa/gh-action-pypi-publish@release/v1
2021-03-25 19:08:17 +00:00
with:
2024-09-04 01:42:55 +00:00
repository-url: https://test.pypi.org/legacy/