-
Notifications
You must be signed in to change notification settings - Fork 68
343 lines (307 loc) · 12.4 KB
/
python-upstream.yaml
File metadata and controls
343 lines (307 loc) · 12.4 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
name: Python Check - Upstream
on:
push:
branches:
- main
- "support/**"
pull_request:
types: [opened, reopened, synchronize, labeled]
merge_group:
schedule:
- cron: "0 0 * * *" # Daily “At 00:00” UTC
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
issues: write
env:
PYTHON_VERSION: "3.14"
defaults:
run:
working-directory: ./icechunk-python
jobs:
build:
name: upstream-dev
runs-on: runs-on=${{ github.run_id }}/runner=8cpu-linux-x64/extras=s3-cache
continue-on-error: true
if: ${{
(contains(github.event.pull_request.labels.*.name, 'test-upstream') && github.event_name == 'pull_request')
|| github.event_name == 'workflow_dispatch'
|| github.event_name == 'schedule'
}}
steps:
- uses: runs-on/action@742bf56072eb4845a0f94b3394673e4903c90ff0 # v2
with:
sccache: s3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Install Just
uses: taiki-e/install-action@98ec31d284eb962f41c14065e9391a955aa810cf # v2
with:
tool: just
- name: Stand up RustFS
run: |
docker compose up -d rustfs_init
- name: Wait for RustFS to be ready
run: |
for _ in {1..10}; do
if docker compose ps --status exited --filter status==0 | grep rustfs ; then
break
fi
sleep 3
done
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build wheels
uses: PyO3/maturin-action@db323e2cf5679b7feb8bcb561a36b27a0bc19e79 # v1
with:
working-directory: icechunk-python
# target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: true
# manylinux: ${{ matrix.platform.manylinux }} # https://github.com/PyO3/maturin-action/issues/245
- name: setup
id: setup
shell: bash
working-directory: icechunk-python
run: |
set -e
python3 -m venv .venv
source .venv/bin/activate
python --version
PY_TAG="cp${PYTHON_VERSION//./}"
WHEEL=$(ls dist/*-${PY_TAG}-*.whl)
# Install upstream dependencies from nightly wheels
export UV_INDEX="https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/"
export UV_PRERELEASE=allow
uv pip install "$WHEEL" --group dev \
--resolution highest \
--index-strategy unsafe-best-match 2>&1 | tee setup-output.log
uv pip install "hypothesis @ git+https://github.com/ianhi/hypothesis.git@flaky-feedback#subdirectory=hypothesis-python"
uv pip list
- name: Create or update setup failure issue
if: |
always()
&& steps.setup.outcome == 'failure'
&& github.event_name == 'schedule'
&& github.repository_owner == 'earth-mover'
shell: bash
working-directory: .
run: |
# Read the template and setup output
template=$(cat .github/setup-failure-template.md)
setup_output="No setup output captured"
if [ -f "icechunk-python/setup-output.log" ]; then
setup_output=$(cat icechunk-python/setup-output.log)
fi
# Replace placeholders
issue_body="${template//\{\{WORKFLOW\}\}/${{ github.workflow }}}"
issue_body="${issue_body//\{\{RUN_ID\}\}/${{ github.run_id }}}"
issue_body="${issue_body//\{\{RUN_URL\}\}/${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}}"
issue_body="${issue_body//\{\{DATE\}\}/$(date -u)}"
issue_body="${issue_body//\{\{SETUP_OUTPUT\}\}/$setup_output}"
# Check for existing open issue with same title
issue_title="Nightly upstream dependency installation failed"
existing_issue=$(gh issue list --state open --label "CI" --search "\"$issue_title\" in:title" --json number --jq '.[0].number // empty')
if [ -n "$existing_issue" ]; then
echo "Found existing open issue #$existing_issue, updating it..."
echo "$issue_body" | gh issue edit "$existing_issue" --body-file -
echo "Updated existing issue #$existing_issue"
else
echo "No existing open issue found, creating new one..."
echo "$issue_body" | gh issue create \
--title "$issue_title" \
--body-file - \
--label "CI"
echo "Created new issue"
fi
env:
GH_TOKEN: ${{ github.token }}
- name: mypy
id: mypy
shell: bash
working-directory: icechunk-python
run: |
set -e
python3 -m venv .venv
source .venv/bin/activate
mypy --python-version ${{ env.PYTHON_VERSION }} python 2>&1 | tee mypy-output.log
- name: Create or update mypy failure issue
if: |
always()
&& steps.mypy.outcome == 'failure'
&& github.event_name == 'schedule'
&& github.repository_owner == 'earth-mover'
shell: bash
working-directory: .
run: |
# Read the template and mypy output
template=$(cat .github/mypy-failure-template.md)
mypy_output="No mypy output captured"
if [ -f "icechunk-python/mypy-output.log" ]; then
mypy_output=$(cat icechunk-python/mypy-output.log)
fi
# Replace placeholders
issue_body="${template//\{\{WORKFLOW\}\}/${{ github.workflow }}}"
issue_body="${issue_body//\{\{RUN_ID\}\}/${{ github.run_id }}}"
issue_body="${issue_body//\{\{RUN_URL\}\}/${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}}"
issue_body="${issue_body//\{\{DATE\}\}/$(date -u)}"
issue_body="${issue_body//\{\{MYPY_OUTPUT\}\}/$mypy_output}"
# Check for existing open issue with same title
issue_title="Nightly MyPy type checking failed with upstream dependencies"
existing_issue=$(gh issue list --state open --label "CI" --search "\"$issue_title\" in:title" --json number --jq '.[0].number // empty')
if [ -n "$existing_issue" ]; then
echo "Found existing open issue #$existing_issue, updating it..."
echo "$issue_body" | gh issue edit "$existing_issue" --body-file -
echo "Updated existing issue #$existing_issue with latest mypy output"
else
echo "No existing open issue found, creating new one..."
echo "$issue_body" | gh issue create \
--title "$issue_title" \
--body-file - \
--label "CI"
echo "Created new issue"
fi
env:
GH_TOKEN: ${{ github.token }}
- name: Restore cached hypothesis directory
id: restore-hypothesis-cache
if: always()
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: icechunk-python/.hypothesis/
key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
restore-keys: |
cache-hypothesis-
- name: describe environment
if: steps.setup.outcome == 'success'
shell: bash
working-directory: icechunk-python
run: |
set -e
python3 -m venv .venv
source .venv/bin/activate
pip list
- name: Install flatc
if: steps.setup.outcome == 'success'
run: |
sudo apt-get update && sudo apt-get install -y flatbuffers-compiler
- name: pytest
id: pytest-icechunk
if: steps.setup.outcome == 'success'
shell: bash
working-directory: icechunk-python
env:
HYPOTHESIS_EXPERIMENTAL_OBSERVABILITY: "1"
run: |
set -e
python3 -m venv .venv
source .venv/bin/activate
pytest -n 4 --hypothesis-profile=nightly --report-log output-pytest-log.jsonl
# explicitly save the cache so it gets updated, also do this even if it fails.
- name: Save cached hypothesis directory
id: save-hypothesis-cache
if: always()
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: icechunk-python/.hypothesis/
key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
- name: Generate and publish the pytest report
if: |
always()
&& steps.pytest-icechunk.outcome == 'failure'
&& github.event_name == 'schedule'
&& github.repository_owner == 'earth-mover'
uses: xarray-contrib/issue-from-pytest-log@f94477e45ef40e4403d7585ba639a9a3bcc53d43 # v1
with:
log-path: icechunk-python/output-pytest-log.jsonl
xarray-backends:
name: xarray-tests-upstream
runs-on: runs-on=${{ github.run_id }}/runner=8cpu-linux-x64/extras=s3-cache
if: ${{
(contains(github.event.pull_request.labels.*.name, 'test-upstream') && github.event_name == 'pull_request')
|| github.event_name == 'workflow_dispatch'
|| github.event_name == 'schedule'
}}
steps:
- uses: runs-on/action@742bf56072eb4845a0f94b3394673e4903c90ff0 # v2
with:
sccache: s3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
path: "icechunk"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
repository: "pydata/xarray"
path: "xarray"
fetch-depth: 0 # Fetch all history for all branches and tags.
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build wheels
uses: PyO3/maturin-action@db323e2cf5679b7feb8bcb561a36b27a0bc19e79 # v1
with:
working-directory: icechunk/icechunk-python
args: --release --out dist --find-interpreter
- name: setup
shell: bash
working-directory: icechunk/icechunk-python
run: |
set -e
python3 -m venv .venv
source .venv/bin/activate
python --version
PY_TAG="cp${PYTHON_VERSION//./}"
WHEEL=$(ls dist/*-${PY_TAG}-*.whl)
# Install upstream dependencies from nightly wheels
export UV_INDEX="https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/"
export UV_PRERELEASE=allow
uv pip install "$WHEEL" --group test pytest-mypy-plugins \
--resolution highest \
--index-strategy unsafe-best-match
uv pip list
- name: Stand up RustFS
working-directory: icechunk
run: |
docker compose up -d rustfs_init
- name: Wait for RustFS to be ready
working-directory: icechunk
run: |
for _ in {1..10}; do
if docker compose ps --status exited --filter status==0 | grep rustfs ; then
break
fi
sleep 3
done
- name: pytest
id: pytest-xarray-backends
shell: bash
working-directory: icechunk/icechunk-python
env:
ICECHUNK_XARRAY_BACKENDS_TESTS: 1
run: |
set -e
python3 -m venv .venv
source .venv/bin/activate
# pass xarray's pyproject.toml so that pytest can find the `flaky` fixture
pytest -c=../../xarray/pyproject.toml -W ignore tests/run_xarray_backends_tests.py --report-log output-pytest-log.jsonl
- name: Generate and publish the xarray backends report
if: |
failure()
&& steps.pytest-xarray-backends.outcome == 'failure'
&& github.event_name == 'schedule'
&& github.repository_owner == 'earth-mover'
uses: xarray-contrib/issue-from-pytest-log@f94477e45ef40e4403d7585ba639a9a3bcc53d43 # v1
with:
log-path: icechunk/icechunk-python/output-pytest-log.jsonl
issue-title: "Nightly Xarray backends tests failed"