wheels #55
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: wheels | |
on: | |
workflow_dispatch: | |
inputs: | |
upload: | |
description: 'Upload wheels to PyPI? (0: no, 1: yes)' | |
required: true | |
default: '0' | |
env: | |
CIBW_BUILD_VERBOSITY: 1 | |
CIBW_SKIP: "*-musllinux* pp*" | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
CIBW_ARCHS_WINDOWS: auto64 | |
CIBW_ARCHS_LINUX: auto64 | |
CIBW_TEST_COMMAND: "python -c \"import sgl\"" | |
# zip required for vcpkg, rest for glfw | |
CIBW_BEFORE_ALL_LINUX: yum install -y zip wayland-devel libxkbcommon-devel libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel | |
jobs: | |
wheels: | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
matrix: | |
os: [windows, linux] | |
platform: [x86_64, aarch64] | |
python: [cp39, cp310, cp311, cp312, cp313] | |
exclude: | |
# Exclude aarch64 for windows/linux | |
- { os: windows, platform: aarch64 } | |
- { os: linux, platform: aarch64 } | |
include: | |
# Specify runners | |
- { os: windows, runs-on: [windows-latest] } | |
- { os: linux, runs-on: [ubuntu-latest] } | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
lfs: true | |
# Used to host cibuildwheel. | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
# Install cibuildwheel. | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.20.0 | |
# Setup MSVC. | |
- name: Setup MSVC | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x64 | |
# Build wheels. | |
- name: Build wheels | |
env: | |
CIBW_BUILD: ${{ matrix.python }}-* | |
run: | | |
python -m cibuildwheel --output-dir wheelhouse | |
# Copy wheels to artifact. | |
- name: Copy wheels to artifact | |
# Version v4 fails to copy files from same folder for multiple builds. | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
upload_pypi: | |
name: Upload wheels to PyPI | |
runs-on: ubuntu-latest | |
if: ${{ github.event.inputs.upload == '1'}} | |
needs: [wheels] | |
environment: pypi | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |