From ad0ec3732203362ff504f47ce30a697c6110ff9d Mon Sep 17 00:00:00 2001 From: Erik Schamper <1254028+Schamper@users.noreply.github.com> Date: Mon, 12 Feb 2024 11:04:12 +0100 Subject: [PATCH] Build more wheels for Linux, macOS and Windows (#251) * Build more wheels for Linux, macOS and Windows * Process feedback * Add concurrency limit * Add tags trigger --- .github/workflows/publish-to-pypi.yml | 73 +++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 11 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 1b02bff..171cd7a 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,31 +1,81 @@ name: Publish Python distribution to PyPI -on: push +on: + push: + branches: + - master + tags: + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: build: - runs-on: ubuntu-22.04 + name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-22.04 + arch: x86_64 + - os: ubuntu-22.04 + arch: i686 + - os: ubuntu-22.04 + arch: aarch64 + - os: macos-12 + arch: x86_64 universal2 + - os: windows-2022 + arch: x86 + before: vcpkg install openssl:x86-windows-static + env: LIB="C:\\vcpkg\\packages\\openssl_x86-windows-static\\lib" INCLUDE="C:\\vcpkg\\packages\\openssl_x86-windows-static\\include" + - os: windows-2022 + arch: AMD64 + before: vcpkg install openssl:x64-windows-static + env: LIB="C:\\vcpkg\\packages\\openssl_x64-windows-static\\lib" INCLUDE="C:\\vcpkg\\packages\\openssl_x64-windows-static\\include" steps: - uses: actions/checkout@v4 with: submodules: true - - name: Set up Python - uses: actions/setup-python@v5 + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v2 with: - python-version: "3.x" - - - name: Install cibuildwheel - run: python3 -m pip install cibuildwheel==2.16.4 + platforms: all - name: Build wheels - run: python -m cibuildwheel --output-dir dist/ + uses: pypa/cibuildwheel@v2.16.5 + with: + output-dir: dist + env: + CIBW_ARCHS: ${{ matrix.arch }} + CIBW_BEFORE_ALL_LINUX: | + if [[ ! -z "$(which yum)" ]]; then + yum install -y make gcc perl-core pcre-devel wget zlib-devel git automake + wget https://ftp.openssl.org/source/openssl-1.1.1k.tar.gz + tar xf openssl*.gz + cd openssl* + ./config --prefix=/usr --openssldir=/etc/ssl zlib-dynamic + make -j$(nproc) + make install + elif [[ ! -z "$(which apk)" ]]; then + apk add openssl-dev + fi + CIBW_BEFORE_ALL_WINDOWS: ${{ matrix.before }} + CIBW_BUILD_FRONTEND: build + CIBW_CONFIG_SETTINGS: --enable-cuckoo --enable-magic --enable-dex --enable-macho --enable-openssl + CIBW_ENVIRONMENT: ${{ matrix.env }} + CIBW_SKIP: cp36-* + CIBW_TEST_COMMAND: python {package}/tests.py - name: Store the distribution packages uses: actions/upload-artifact@v4 with: - name: python-package-distributions + name: python-package-distributions-${{ matrix.os }}-${{ matrix.arch }} path: dist/*.whl publish-to-pypi: @@ -45,7 +95,8 @@ jobs: - name: Download all the dists uses: actions/download-artifact@v4 with: - name: python-package-distributions + pattern: python-package-distributions-* + merge-multiple: true path: dist/ - name: Publish distribution to PyPI