Skip to content

Commit ad0ec37

Browse files
authored
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
1 parent 25f8d6e commit ad0ec37

File tree

1 file changed

+62
-11
lines changed

1 file changed

+62
-11
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 62 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,81 @@
11
name: Publish Python distribution to PyPI
22

3-
on: push
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
pull_request:
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
414

515
jobs:
616
build:
7-
runs-on: ubuntu-22.04
17+
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }})
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
include:
22+
- os: ubuntu-22.04
23+
arch: x86_64
24+
- os: ubuntu-22.04
25+
arch: i686
26+
- os: ubuntu-22.04
27+
arch: aarch64
28+
- os: macos-12
29+
arch: x86_64 universal2
30+
- os: windows-2022
31+
arch: x86
32+
before: vcpkg install openssl:x86-windows-static
33+
env: LIB="C:\\vcpkg\\packages\\openssl_x86-windows-static\\lib" INCLUDE="C:\\vcpkg\\packages\\openssl_x86-windows-static\\include"
34+
- os: windows-2022
35+
arch: AMD64
36+
before: vcpkg install openssl:x64-windows-static
37+
env: LIB="C:\\vcpkg\\packages\\openssl_x64-windows-static\\lib" INCLUDE="C:\\vcpkg\\packages\\openssl_x64-windows-static\\include"
838

939
steps:
1040
- uses: actions/checkout@v4
1141
with:
1242
submodules: true
1343

14-
- name: Set up Python
15-
uses: actions/setup-python@v5
44+
- name: Set up QEMU
45+
if: runner.os == 'Linux'
46+
uses: docker/setup-qemu-action@v2
1647
with:
17-
python-version: "3.x"
18-
19-
- name: Install cibuildwheel
20-
run: python3 -m pip install cibuildwheel==2.16.4
48+
platforms: all
2149

2250
- name: Build wheels
23-
run: python -m cibuildwheel --output-dir dist/
51+
uses: pypa/cibuildwheel@v2.16.5
52+
with:
53+
output-dir: dist
54+
env:
55+
CIBW_ARCHS: ${{ matrix.arch }}
56+
CIBW_BEFORE_ALL_LINUX: |
57+
if [[ ! -z "$(which yum)" ]]; then
58+
yum install -y make gcc perl-core pcre-devel wget zlib-devel git automake
59+
wget https://ftp.openssl.org/source/openssl-1.1.1k.tar.gz
60+
tar xf openssl*.gz
61+
cd openssl*
62+
./config --prefix=/usr --openssldir=/etc/ssl zlib-dynamic
63+
make -j$(nproc)
64+
make install
65+
elif [[ ! -z "$(which apk)" ]]; then
66+
apk add openssl-dev
67+
fi
68+
CIBW_BEFORE_ALL_WINDOWS: ${{ matrix.before }}
69+
CIBW_BUILD_FRONTEND: build
70+
CIBW_CONFIG_SETTINGS: --enable-cuckoo --enable-magic --enable-dex --enable-macho --enable-openssl
71+
CIBW_ENVIRONMENT: ${{ matrix.env }}
72+
CIBW_SKIP: cp36-*
73+
CIBW_TEST_COMMAND: python {package}/tests.py
2474

2575
- name: Store the distribution packages
2676
uses: actions/upload-artifact@v4
2777
with:
28-
name: python-package-distributions
78+
name: python-package-distributions-${{ matrix.os }}-${{ matrix.arch }}
2979
path: dist/*.whl
3080

3181
publish-to-pypi:
@@ -45,7 +95,8 @@ jobs:
4595
- name: Download all the dists
4696
uses: actions/download-artifact@v4
4797
with:
48-
name: python-package-distributions
98+
pattern: python-package-distributions-*
99+
merge-multiple: true
49100
path: dist/
50101

51102
- name: Publish distribution to PyPI

0 commit comments

Comments
 (0)