-
Notifications
You must be signed in to change notification settings - Fork 48
127 lines (117 loc) · 3.7 KB
/
cibuildwheel.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Build and Upload Wheels
on:
release:
types: [published]
push:
branches:
- setuptools
workflow_dispatch:
inputs:
deploy_target:
type: choice
description: "Choose the deployment target"
options:
- None
- PyPI
- Test PyPI
jobs:
build_wheels:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [manylinux-x86_64, macos-x86_64, macos-arm64]
include:
- name: manylinux-x86_64
os: ubuntu-latest
arch: x86_64
- name: macos-x86_64
os: macos-13
macos-target: 10.13
- name: macos-arm64
os: macos-14
macos-target: 11
extra_macos_packages: "" # We can specify additional packages per architecture if needed
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Install system-level dependencies first
- name: Install Packages (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
gperf \
libgmp-dev \
ninja-build \
openjdk-8-jdk
- name: Install Packages (macOS)
if: runner.os == 'macOS'
run: |
brew update
brew install \
gperf \
ninja \
${{ matrix.extra_macos_packages }}
# Set up environment variables for compiler and linker to find brew-installed packages
echo "LDFLAGS=-L$(brew --prefix)/lib $LDFLAGS" >> "$GITHUB_ENV"
echo "CFLAGS=-I$(brew --prefix)/include $CFLAGS" >> "$GITHUB_ENV"
echo "CPPFLAGS=-I$(brew --prefix)/include $CPPFLAGS" >> "$GITHUB_ENV"
# Set up Python virtual environment and install Python dependencies
- name: Python Dependencies
run: |
python3 -m venv ./.venv
source ./.venv/bin/activate
python3 -m pip install \
Cython \
meson \
pyparsing \
pytest \
setuptools \
toml \
wheel
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Build C++ libraries
run: |
bash ./ci-scripts/cibw_build_before.sh
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos-target }}
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
with:
# Where the setup.py/pyproject.toml build infrastructure is
package-dir: ./build/python
env:
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
CIBW_SKIP: "*-win32 *-win_amd64 *-win_arm64 *-musllinux_*"
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_ENVIRONMENT_MACOS: >
DYLD_LIBRARY_PATH="$(pwd)/install/lib:$DYLD_LIBRARY_PATH"
MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos-target }}
CIBW_TEST_COMMAND: pytest {project}/tests
- name: Upload wheels to PyPI
if: >
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' &&
github.event.inputs.deploy_target == 'PyPI')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
source ./.venv/bin/activate
pip install twine
twine upload --skip-existing wheelhouse/*.whl
- name: Upload wheels to TestPyPI
if: >
github.event_name == 'workflow_dispatch' &&
github.event.inputs.deploy_target == 'Test PyPI' ||
(github.event_name == 'push' && github.ref == 'refs/heads/setuptools')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: |
source ./.venv/bin/activate
pip install twine
twine upload --repository testpypi wheelhouse/*.whl