From 0706000a0cac7251e27ffbcdd1a1f753b68d88f6 Mon Sep 17 00:00:00 2001 From: Schamper <1254028+Schamper@users.noreply.github.com> Date: Sat, 3 Feb 2024 20:19:38 +0100 Subject: [PATCH 1/4] Build more wheels for Linux, macOS and Windows --- .github/workflows/publish-to-pypi.yml | 54 +++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 1b02bff..57e30dd 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -4,23 +4,61 @@ on: push 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 + 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 From 5702ce8919b04868c6b985ef32c28fc7bc8060bb Mon Sep 17 00:00:00 2001 From: Schamper <1254028+Schamper@users.noreply.github.com> Date: Mon, 5 Feb 2024 22:17:37 +0100 Subject: [PATCH 2/4] Process feedback --- .github/workflows/publish-to-pypi.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 57e30dd..a7a03ed 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,6 +1,11 @@ name: Publish Python distribution to PyPI -on: push +on: + push: + branches: + - master + pull_request: + workflow_dispatch: jobs: build: @@ -39,6 +44,8 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.16.5 + with: + output-dir: dist env: CIBW_ARCHS: ${{ matrix.arch }} CIBW_BEFORE_ALL_LINUX: | @@ -63,7 +70,7 @@ jobs: - 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: @@ -83,7 +90,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 From d4455a9a68e486a16e198c07e44efab2c6f6f6b6 Mon Sep 17 00:00:00 2001 From: Schamper <1254028+Schamper@users.noreply.github.com> Date: Mon, 5 Feb 2024 22:22:49 +0100 Subject: [PATCH 3/4] Add concurrency limit --- .github/workflows/publish-to-pypi.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index a7a03ed..4e5a1d8 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -7,6 +7,10 @@ on: pull_request: workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: build: name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }}) From d3b7a78750c45067c1c589cbac6ce69ecebe371e Mon Sep 17 00:00:00 2001 From: Erik Schamper <1254028+Schamper@users.noreply.github.com> Date: Tue, 6 Feb 2024 11:21:07 +0100 Subject: [PATCH 4/4] Add tags trigger --- .github/workflows/publish-to-pypi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 4e5a1d8..171cd7a 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -4,6 +4,7 @@ on: push: branches: - master + tags: pull_request: workflow_dispatch: