diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5490c27..ace2ed4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,13 +14,116 @@ concurrency: cancel-in-progress: true jobs: - build-wheels: - strategy: - matrix: - os: [ubuntu-latest] - name: Build and publish Python package (${{ matrix.os }}) - timeout-minutes: 600 - runs-on: ${{ matrix.os }} + build-wheels-x86: + name: Build x86_64 wheels + timeout-minutes: 360 + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install cibuildwheel + shell: bash + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: all + + - name: Build package + env: + CIBW_SKIP: "pp* *-musllinux*" + CIBW_ARCHS_LINUX: auto + CIBW_BEFORE_ALL_LINUX: | + yum install -y libudev-devel pkgconfig python3-devel python3-pip python3-wheel + CIBW_BEFORE_BUILD: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + export PATH="$HOME/.cargo/bin:$PATH" + pip install setuptools-rust + CIBW_ENVIRONMENT: | + PATH="/usr/local/bin:$HOME/.cargo/bin:$PATH" + CARGO_NET_GIT_FETCH_WITH_CLI=true + run: | + cibuildwheel --output-dir dist + + - name: Upload wheel artifacts + uses: actions/upload-artifact@v3 + with: + name: wheels-x86_64 + path: | + dist/*.whl + + build-wheels-arm64: + name: Build ARM64 wheels + timeout-minutes: 360 + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install cibuildwheel + shell: bash + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: all + + - name: Build package + env: + CIBW_SKIP: "pp* *-musllinux*" + CIBW_ARCHS_LINUX: aarch64 + CIBW_BEFORE_ALL_LINUX: | + yum install -y libudev-devel pkgconfig python3-devel python3-pip python3-wheel + CIBW_BEFORE_BUILD: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + export PATH="$HOME/.cargo/bin:$PATH" + pip install setuptools-rust + CIBW_ENVIRONMENT: | + PATH="/usr/local/bin:$HOME/.cargo/bin:$PATH" + CARGO_NET_GIT_FETCH_WITH_CLI=true + run: | + cibuildwheel --output-dir dist + + - name: Upload wheel artifacts + uses: actions/upload-artifact@v3 + with: + name: wheels-arm64 + path: | + dist/*.whl + + build-wheels-s390x: + name: Build s390x wheels + timeout-minutes: 360 + runs-on: ubuntu-latest steps: - name: Checkout code @@ -49,10 +152,10 @@ jobs: - name: Build package env: - CIBW_SKIP: "pp* *-musllinux*" # Skip PyPy and musllinux builds + CIBW_SKIP: "pp* *-musllinux*" + CIBW_ARCHS_LINUX: s390x CIBW_BEFORE_ALL_LINUX: | yum install -y libudev-devel pkgconfig python3-devel python3-pip python3-wheel - CIBW_ARCHS_LINUX: auto aarch64 s390x CIBW_BEFORE_BUILD: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y export PATH="$HOME/.cargo/bin:$PATH" @@ -66,7 +169,7 @@ jobs: - name: Upload wheel artifacts uses: actions/upload-artifact@v3 with: - name: wheels-${{ matrix.os }} + name: wheels-s390x path: | dist/*.whl @@ -107,7 +210,7 @@ jobs: dist/*.tar.gz publish-wheels: - needs: [build-wheels, build-source-dist] + needs: [build-wheels-x86, build-wheels-arm64, build-wheels-s390x, build-source-dist] name: Publish Python wheels timeout-minutes: 10 runs-on: ubuntu-latest