Repository navigation
208 lines (186 loc) · 7.48 KB
/
Copy pathci-python.yml
File metadata and controls
208 lines (186 loc) · 7.48 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Python CI
on:
workflow_call:
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- os: linux-ubuntu-latest
runner: { group: databricks-protected-runner-group, labels: linux-ubuntu-latest }
pyVersion: '3.9'
- os: linux-ubuntu-latest
runner: { group: databricks-protected-runner-group, labels: linux-ubuntu-latest }
pyVersion: '3.10'
- os: linux-ubuntu-latest
runner: { group: databricks-protected-runner-group, labels: linux-ubuntu-latest }
pyVersion: '3.11'
- os: linux-ubuntu-latest
runner: { group: databricks-protected-runner-group, labels: linux-ubuntu-latest }
pyVersion: '3.12'
- os: linux-ubuntu-latest
runner: { group: databricks-protected-runner-group, labels: linux-ubuntu-latest }
pyVersion: '3.13'
- os: linux-ubuntu-latest
runner: { group: databricks-protected-runner-group, labels: linux-ubuntu-latest }
pyVersion: '3.14'
- os: windows-server-latest
runner: { group: databricks-protected-runner-group, labels: windows-server-latest }
pyVersion: '3.12'
- os: windows-server-latest
runner: { group: databricks-protected-runner-group, labels: windows-server-latest }
pyVersion: '3.13'
- os: windows-server-latest
runner: { group: databricks-protected-runner-group, labels: windows-server-latest }
pyVersion: '3.14'
runs-on: ${{ matrix.runner }}
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Get JFrog OIDC token
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/jfrog-oidc-token.sh"
- name: Configure Cargo registry
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/configure-cargo.sh"
- name: Configure pip registry
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/configure-pip.sh"
- name: Unshallow
run: git fetch --prune --unshallow || true
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: ${{ matrix.pyVersion }}
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- name: Copy root LICENSE for maturin
shell: bash
run: cp ../LICENSE LICENSE
- name: Run tests (Linux)
if: runner.os != 'Windows'
run: make dev test
- name: Run tests (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
python -m venv .venv
.venv/Scripts/python -m pip install --upgrade pip
test -f LICENSE || cp ../LICENSE LICENSE
.venv/Scripts/python -m pip install -r requirements-dev.lock
.venv/Scripts/python -m maturin develop
.venv/Scripts/python -m pytest --cov=zerobus --cov-report html --cov-report xml tests
# Builds one abi3 wheel on the oldest supported Python and imports it on every
# newer one. The `test` job rebuilds per version, so it cannot catch this.
abi3-compat:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Get JFrog OIDC token
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/jfrog-oidc-token.sh"
- name: Configure Cargo registry
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/configure-cargo.sh"
- name: Configure pip registry
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/configure-pip.sh"
# Install every supported version; the last one is the default `python`.
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: |
3.10
3.11
3.12
3.13
3.14
3.9
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- name: Copy root LICENSE for maturin
run: cp ../LICENSE LICENSE
- name: Build abi3 wheel on Python 3.9
run: |
python -c 'import sys; assert sys.version_info[:2] == (3, 9), sys.version'
python -m pip install --upgrade pip
python -m pip install maturin==1.8.3
python -m maturin build --release --manifest-path rust/Cargo.toml --out dist
- name: Install and import the 3.9 wheel on every supported version
run: |
for v in 3.9 3.10 3.11 3.12 3.13 3.14; do
echo "::group::Python $v"
"python$v" -m venv "/tmp/abi3-$v"
"/tmp/abi3-$v/bin/python" -m pip install --quiet --no-deps dist/*.whl
# -I keeps the working directory off sys.path, so this imports the
# installed wheel rather than the source tree next to it.
"/tmp/abi3-$v/bin/python" -I - <<'PY'
import sys
import zerobus
from zerobus._zerobus_core import aio, arrow, sync
assert "site-packages" in zerobus.__file__, zerobus.__file__
sync.ZerobusSdk("grpc.example.com:443", "https://example.com")
aio.ZerobusSdk("grpc.example.com:443", "https://example.com")
print(f"OK on {sys.version.split()[0]}")
PY
echo "::endgroup::"
done
fmt:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Get JFrog OIDC token
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/jfrog-oidc-token.sh"
- name: Configure Cargo registry
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/configure-cargo.sh"
- name: Configure pip registry
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/configure-pip.sh"
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.12'
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: rustfmt
- name: Copy root LICENSE for maturin
run: cp ../LICENSE LICENSE
- name: Format all files
run: make dev fmt
- name: Fail on differences
run: git diff --exit-code
lint:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Get JFrog OIDC token
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/jfrog-oidc-token.sh"
- name: Configure Cargo registry
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/configure-cargo.sh"
- name: Configure pip registry
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/configure-pip.sh"
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.12'
- name: Copy root LICENSE for maturin
run: cp ../LICENSE LICENSE
- name: Lint code
run: make dev lint