Build and test wheels #4
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 and test wheels | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- v* | |
jobs: | |
wheels: | |
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, windows-2019, macos-12] | |
arch: ["x86_64", "arm64"] | |
include: | |
- os: windows-2019 | |
arch: win_amd64 | |
- os: windows-2019 | |
arch: win32 | |
- os: ubuntu-20.04 | |
arch: i686 | |
- os: ubuntu-20.04 | |
arch: aarch64 | |
- os: ubuntu-20.04 | |
arch: ppc64le | |
- os: ubuntu-20.04 | |
arch: s390x | |
exclude: | |
- os: windows-2019 | |
arch: "x86_64" | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Build and test wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: "*${{ matrix.arch }}" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ runner.os }}-${{ matrix.arch }} | |
path: wheelhouse/*.whl | |
if-no-files-found: error | |
sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
# Build sdist on lowest supported Python. | |
# 3.8 is used because 3.6 has issues with pyproject.toml | |
# and 3.7 has bpo-41316. | |
python-version: '3.8' | |
- name: Build sdist | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U build | |
python -m build -s | |
- name: Test sdist | |
run : python -m pip install dist/*.gz | |
- name: Upload sdist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sdist | |
path: dist/* | |
if-no-files-found: error | |
publish: | |
name: Publish builds on PyPI | |
runs-on: ubuntu-latest | |
needs: [sdist, wheels] | |
if: ${{ always() && (needs.sdist.result == 'success' || needs.wheels.result == 'success') }} | |
environment: | |
name: release | |
url: https://test.pypi.org/p/python-lzo | |
permissions: | |
id-token: write | |
steps: | |
- name: Download builds | |
uses: actions/download-artifact@v3 | |
with: | |
path: dist | |
- name: Organise | |
working-directory: dist | |
run: | | |
mv **/*.whl . | |
mv **/*.gz . | |
find . -type d -delete | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Publish package distributions to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
print-hash: true | |
repository-url: https://test.pypi.org/legacy/ |