Modify README format #14
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 | |
on: [push, pull_request] | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Install Microsoft Visual C++ 2010 Redistributable Package | |
if: runner.os == 'Windows' | |
run: | | |
curl -L -o vcredist.exe https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe | |
Start-Process -FilePath vcredist.exe -ArgumentList '/Q' -Wait -PassThru | |
- name: Set up pthreads | |
if: runner.os == 'Windows' | |
run: | | |
curl -O https://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip | |
7z x -y pthreads-w32-2-9-1-release.zip -opthreads | |
robocopy pthreads\Pre-built.2\dll\x64 build\pthreads /COPYALL /E || true | |
robocopy pthreads\Pre-built.2\include build\pthreads /COPYALL /E || true | |
robocopy pthreads\Pre-built.2\lib\x64 build\pthreads /COPYALL /E || true | |
- name: Set up lzma | |
if: runner.os == 'Windows' | |
run: | | |
curl -O -L https://github.com/ShiftMediaProject/liblzma/releases/download/v5.4.1/liblzma_v5.4.1_msvc17.zip | |
7z x -y liblzma_v5.4.1_msvc17.zip -oliblzma | |
robocopy liblzma\bin\x64 build\lzma /COPYALL /E || true | |
robocopy liblzma\include build\lzma /COPYALL /E || true | |
robocopy liblzma\lib\x64 build\lzma /COPYALL /E || true | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS_MACOS: "x86_64 arm64" | |
CIBW_ARCHS_LINUX: "x86_64 aarch64" | |
CIBW_ARCHS_WINDOWS: "AMD64" | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: "pytest {project}/tests" | |
CIBW_TEST_SKIP: "*-*linux_aarch64 *-macosx_arm64" | |
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" | |
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --add-path build\\pthreads;build\\lzma -w {dest_dir} {wheel}" | |
# CIBW_BEFORE_ALL_LINUX: "yum install -y xz xz-devel || apk add xz-dev" | |
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*" | |
# Use manylinux_2_28 image | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 | |
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 | |
# Robust package installation | |
CIBW_BEFORE_ALL_LINUX: | | |
if command -v dnf; then \ | |
dnf install -y xz xz-devel; \ | |
elif command -v yum; then \ | |
yum install -y xz xz-devel; \ | |
elif command -v apt-get; then \ | |
apt-get update && apt-get install -y xz-utils liblzma-dev; \ | |
elif command -v apk; then \ | |
apk add xz-dev; \ | |
else \ | |
echo "No known package manager found"; \ | |
exit 1; \ | |
fi | |
# Install xz on macOS | |
CIBW_BEFORE_ALL_MACOS: brew install xz | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz |