|
1 | 1 | name: Publish Python distribution to PyPI |
2 | 2 |
|
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 |
4 | 14 |
|
5 | 15 | jobs: |
6 | 16 | 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" |
8 | 38 |
|
9 | 39 | steps: |
10 | 40 | - uses: actions/checkout@v4 |
11 | 41 | with: |
12 | 42 | submodules: true |
13 | 43 |
|
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 |
16 | 47 | with: |
17 | | - python-version: "3.x" |
18 | | - |
19 | | - - name: Install cibuildwheel |
20 | | - run: python3 -m pip install cibuildwheel==2.16.4 |
| 48 | + platforms: all |
21 | 49 |
|
22 | 50 | - 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 |
24 | 74 |
|
25 | 75 | - name: Store the distribution packages |
26 | 76 | uses: actions/upload-artifact@v4 |
27 | 77 | with: |
28 | | - name: python-package-distributions |
| 78 | + name: python-package-distributions-${{ matrix.os }}-${{ matrix.arch }} |
29 | 79 | path: dist/*.whl |
30 | 80 |
|
31 | 81 | publish-to-pypi: |
|
45 | 95 | - name: Download all the dists |
46 | 96 | uses: actions/download-artifact@v4 |
47 | 97 | with: |
48 | | - name: python-package-distributions |
| 98 | + pattern: python-package-distributions-* |
| 99 | + merge-multiple: true |
49 | 100 | path: dist/ |
50 | 101 |
|
51 | 102 | - name: Publish distribution to PyPI |
|
0 commit comments