Build wheels - 7e39e8cb3985970d054b4cc69b3c3e138d71a56b #19
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 wheels | |
run-name: Build wheels - ${{ github.sha }} | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'release/**' | |
jobs: | |
build_windows_wheels: | |
strategy: | |
matrix: | |
py: [cp38, cp39, cp310, cp311, cp312] | |
arch: | |
- [AMD64, win_amd64, x64, x64, 64bit] | |
- [x86, win32, x86, Win32, 32bit] | |
name: ${{ matrix.py }}-${{ matrix.arch[1] }} | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Compile pthread-win32 | |
run: | | |
Import-Module 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' | |
Enter-VsDevShell -VsInstallPath 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise' -DevCmdArguments '-arch=x64' -StartInPath 'C:\' | |
git clone https://github.com/GerHobbelt/pthread-win32.git | |
cd C:\pthread-win32\windows\VS2022 | |
msbuild .\pthread.2022.sln -t:pthread_static_lib -p:Configuration=Release,Platform=${{ matrix.arch[3] }} | |
cd C:\ | |
mkdir C:\pthread-win32_static_lib | |
mkdir C:\pthread-win32_static_lib\include | |
mkdir C:\pthread-win32_static_lib\lib | |
cp C:\pthread-win32\windows\VS2022\bin\Release-Unicode-${{ matrix.arch[4] }}-${{ matrix.arch[2] }}\pthread_static_lib.lib C:\pthread-win32_static_lib\lib\pthread.lib | |
cp C:\pthread-win32\_ptw32.h C:\pthread-win32_static_lib\include | |
cp C:\pthread-win32\pthread.h C:\pthread-win32_static_lib\include | |
cp C:\pthread-win32\sched.h C:\pthread-win32_static_lib\include | |
cp C:\pthread-win32\semaphore.h C:\pthread-win32_static_lib\include | |
- name: Build wheel ${{ matrix.py }}-${{ matrix.arch[1] }} | |
uses: pypa/[email protected] | |
env: | |
PTHREAD_WIN_INCLUDE: C:\pthread-win32_static_lib\include | |
PTHREAD_WIN_LIB: C:\pthread-win32_static_lib\lib | |
CIBW_PLATFORM: windows | |
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.arch[1] }} | |
CIBW_ARCHS_WINDOWS: ${{ matrix.arch[0] }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels_${{ matrix.py }}_${{ matrix.arch[1] }} | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error | |
build_macos_wheels: | |
strategy: | |
matrix: | |
config: | |
[ | |
{ | |
py: cp38, | |
arch: [x86_64, macosx_x86_64, 12.0, macos-12] | |
}, | |
{ | |
py: cp39, | |
arch: [x86_64, macosx_x86_64, 12.0, macos-12] | |
}, | |
{ | |
py: cp310, | |
arch: [x86_64, macosx_x86_64, 12.0, macos-12] | |
}, | |
{ | |
py: cp311, | |
arch: [x86_64, macosx_x86_64, 12.0, macos-12] | |
}, | |
{ | |
py: cp312, | |
arch: [x86_64, macosx_x86_64, 12.0, macos-12] | |
}, | |
{ | |
py: cp38, | |
arch: [arm64, macosx_arm64, 12.0, macos-14] | |
}, | |
{ | |
py: cp39, | |
arch: [arm64, macosx_arm64, 12.0, macos-14] | |
}, | |
{ | |
py: cp310, | |
arch: [arm64, macosx_arm64, 12.0, macos-14] | |
}, | |
{ | |
py: cp311, | |
arch: [arm64, macosx_arm64, 12.0, macos-14] | |
}, | |
{ | |
py: cp312, | |
arch: [arm64, macosx_arm64, 12.0, macos-14] | |
} | |
] | |
name: ${{ matrix.config.py }}-${{ matrix.config.arch[1] }} | |
runs-on: ${{ matrix.config.arch[3] }} | |
if: | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install pipx # NOTE: required only for arm64 | |
if: startsWith(matrix.config.arch[0], 'arm64') | |
run: | | |
brew install pipx | |
- name: Build wheel ${{ matrix.config.py }}-${{ matrix.config.arch[1] }} | |
uses: pypa/[email protected] | |
env: | |
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.config.arch[2] }} | |
CIBW_PLATFORM: macos | |
CIBW_BUILD: ${{ matrix.config.py }}-${{ matrix.config.arch[1] }} | |
CIBW_ARCHS_MACOS: ${{ matrix.config.arch[0] }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels_${{ matrix.config.py }}_${{ matrix.config.arch[1] }} | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error | |
build_linux_wheels: | |
strategy: | |
matrix: | |
py: [cp38, cp39, cp310, cp311, cp312] | |
arch: | |
- [x86_64, manylinux_x86_64, amd64] | |
- [aarch64, manylinux_aarch64, arm64] | |
name: ${{ matrix.py }}-${{ matrix.arch[1] }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
with: | |
platforms: ${{ matrix.arch[2] }} | |
- name: Build wheel ${{ matrix.py }}-${{ matrix.arch[1] }} | |
uses: pypa/[email protected] | |
env: | |
CIBW_PLATFORM: linux | |
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.arch[1] }} | |
CIBW_ARCHS_LINUX: ${{ matrix.arch[0] }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels_${{ matrix.py }}_${{ matrix.arch[1] }} | |
path: ./wheelhouse/*.whl | |
if-no-files-found: error | |
build_source_distribution: | |
name: sdist | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build source distribution | |
run: | | |
pip install -U pip | |
pip install -U build | |
python -m build --sdist | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: ./dist/*.tar.gz | |
if-no-files-found: error | |
run_id: | |
name: Create/Update WHEELS_ARTIFACTS_RUN_ID secret | |
runs-on: ubuntu-latest | |
needs: [build_windows_wheels, build_macos_wheels, build_linux_wheels, build_source_distribution] | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
gh secret set WHEELS_ARTIFACTS_RUN_ID --body ${{ github.run_id }} | |
env: | |
GH_TOKEN: ${{ secrets.GH_PAT }} |