forked from apache/cassandra-python-driver
-
Notifications
You must be signed in to change notification settings - Fork 55
172 lines (149 loc) · 5.8 KB
/
lib-build.yml
File metadata and controls
172 lines (149 loc) · 5.8 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Build wheels
on:
workflow_call:
inputs:
python-version:
description: 'Python version to run on'
type: string
required: false
default: "3.13"
target:
description: "Target os to build for: linux,macos,windows"
type: string
required: false
default: "linux,macos-x86,macos-arm,windows,linux-aarch64"
target_tag:
description: "Publish particular tag"
type: string
required: false
default: ""
ignore_tests:
description: "Don't run tests"
type: boolean
required: false
default: false
jobs:
prepare-matrix:
name: "Prepare matrix to run for ${{ inputs.python-version }} on `${{ inputs.target }}`"
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.prepare.outputs.matrix }}
steps:
- name: Prepare matrix json from input matrix list
id: prepare
run: |
echo -n "[" > /tmp/matrix.json
was_added=""
for target in $(echo "${{ inputs.target }}" | tr -d " " | tr "," "\n")
do
if [[ "${target}" == "linux" ]]; then
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
echo -n '{"os":"ubuntu-24.04", "target": "linux"}' >> /tmp/matrix.json
was_added=1
elif [[ "${target}" == "linux-aarch64" ]]; then
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
echo -n '{"os":"ubuntu-24.04-arm", "target": "linux-aarch64"}' >> /tmp/matrix.json
was_added=1
elif [[ "${target}" == "windows" ]]; then
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
echo -n '{"os":"windows-2022", "target": "windows"}' >> /tmp/matrix.json
was_added=1
elif [[ "${target}" == "macos-x86" ]]; then
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
echo -n '{"os":"macos-15-intel", "target": "macos-x86"}' >> /tmp/matrix.json
was_added=1
elif [[ "${target}" == "macos-arm" ]]; then
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
echo -n '{"os":"macos-14", "target": "macos-arm"}' >> /tmp/matrix.json
was_added=1
fi
done
echo -n "]" >> /tmp/matrix.json
echo -e "Resulted matrix json:\n$(cat /tmp/matrix.json)"
echo "matrix=$(cat /tmp/matrix.json)" >> $GITHUB_OUTPUT
build-wheels:
name: Build wheels for ${{ matrix.target }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: prepare-matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Checkout tag ${{ inputs.target_tag }}
if: inputs.target_tag != ''
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ inputs.target_tag }}
- name: Disable tests
if: inputs.ignore_tests
shell: bash
run: |
echo "CIBW_TEST_COMMAND=true" >> $GITHUB_ENV;
echo "CIBW_TEST_COMMAND_WINDOWS=(exit 0)" >> $GITHUB_ENV;
echo "CIBW_TEST_SKIP=*" >> $GITHUB_ENV;
echo "CIBW_BEFORE_TEST=true" >> $GITHUB_ENV;
echo "CIBW_BEFORE_TEST_WINDOWS=(exit 0)" >> $GITHUB_ENV;
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: ${{ inputs.python-version }}
- name: Install cibuildwheel
run: |
uv tool install 'cibuildwheel==3.2.1'
- name: Install OpenSSL for Windows
if: runner.os == 'Windows'
run: |
choco install openssl.light --no-progress -y
- name: Install Conan
if: runner.os == 'Windows'
uses: turtlebrowser/get-conan@c171f295f3f507360ee018736a6608731aa2109d # v1.2
- name: Configure libev for Windows
if: runner.os == 'Windows'
run: |
conan profile detect
conan install conanfile.py
- name: Install libev for MacOS
if: runner.os == 'MacOs'
run: |
brew install libev
- name: Overwrite for MacOS
if: runner.os == 'MacOS'
run: |
##### Set MACOSX_DEPLOYMENT_TARGET
if [ "${{ matrix.os }}" == "macos-15-intel" ]; then
echo "MACOSX_DEPLOYMENT_TARGET=15.0" >> $GITHUB_ENV;
echo "Enforcing target deployment for 15.0"
elif [ "${{ matrix.os }}" == "macos-14" ]; then
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV;
echo "Enforcing target deployment for 14.0"
fi
- name: Build wheels
if: matrix.target != 'linux-aarch64'
shell: bash
run: |
cibuildwheel --output-dir wheelhouse
- name: Build wheels for linux aarch64
if: matrix.target == 'linux-aarch64'
run: |
CIBW_BUILD="cp3*" cibuildwheel --archs aarch64 --output-dir wheelhouse
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-${{ matrix.target }}-${{ matrix.os }}
path: ./wheelhouse/*.whl
build-sdist:
name: Build source distribution
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: ${{ inputs.python-version }}
- name: Build sdist
run: uv build --sdist
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: source-dist
path: dist/*.tar.gz