-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from AT0myks/cibuildwheel
Integrate cibuildwheel
- Loading branch information
Showing
8 changed files
with
299 additions
and
164 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
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-11] | ||
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" | ||
- os: ubuntu-20.04 | ||
arch: "arm64" | ||
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/cibuildwheel@v2.12.3 | ||
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 | ||
|
||
wheels-old: | ||
name: Build old wheels on ${{ matrix.os }} for ${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-20.04, windows-2019, macos-11] | ||
arch: ["x86_64"] | ||
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/cibuildwheel@v1.12.0 | ||
env: | ||
CIBW_ARCHS: all | ||
CIBW_BUILD_VERBOSITY: 3 | ||
CIBW_BUILD: "*${{ matrix.arch }}" | ||
CIBW_SKIP: cp36-* cp37-* cp38-* cp39-* pp37-* pp*-macosx* cp35-macosx_x86_64 | ||
CIBW_TEST_REQUIRES: pytest | ||
CIBW_TEST_COMMAND: pytest {package}/tests | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ runner.os }}-${{ matrix.arch }} | ||
path: wheelhouse/*.whl | ||
if-no-files-found: error | ||
|
||
wheels-win27: | ||
name: Build Python 2.7 wheels on Windows ${{ matrix.arch }} | ||
runs-on: windows-2019 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: ["amd64", "win32"] | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Prepare compiler environment for Windows | ||
if: runner.os == 'Windows' | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
with: | ||
arch: ${{ matrix.arch }} | ||
- name: Set Windows environment variables | ||
if: runner.os == 'Windows' | ||
shell: bash | ||
run: | | ||
echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV | ||
echo "MSSdk=1" >> $GITHUB_ENV | ||
- name: Build and test wheels | ||
uses: pypa/cibuildwheel@v1.12.0 | ||
env: | ||
CIBW_BUILD_VERBOSITY: 3 | ||
CIBW_BUILD: "*27*${{ matrix.arch }}" | ||
CIBW_TEST_REQUIRES: pytest | ||
CIBW_TEST_COMMAND: pytest {package}/tests | ||
- 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, wheels-old, wheels-win27] | ||
if: ${{ always() && (needs.sdist.result == 'success' || needs.wheels.result == 'success' || needs.wheels-old.result == 'success' || needs.wheels-win27.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/ |
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
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
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
Oops, something went wrong.