Skip to content

Commit

Permalink
Build more wheels for Linux, macOS and Windows (#251)
Browse files Browse the repository at this point in the history
* Build more wheels for Linux, macOS and Windows

* Process feedback

* Add concurrency limit

* Add tags trigger
  • Loading branch information
Schamper committed Feb 12, 2024
1 parent 25f8d6e commit ad0ec37
Showing 1 changed file with 62 additions and 11 deletions.
73 changes: 62 additions & 11 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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:
Expand All @@ -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
Expand Down

0 comments on commit ad0ec37

Please sign in to comment.