forked from apache/datafusion-python
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (123 loc) · 5.18 KB
/
test.yml
File metadata and controls
138 lines (123 loc) · 5.18 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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Reusable workflow for running tests.
# Single matrix covers both GIL (abi3 wheel) and free-threaded
# (per-interpreter wheels) builds.
name: Test
on:
workflow_call:
env:
UV_LOCKED: true
jobs:
test-matrix:
runs-on: ubuntu-latest
# Backstop: a hung multiprocessing worker (e.g. during a pickle regression)
# should not block CI longer than this.
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
# GIL builds — all share the same abi3 wheel.
- { python-version: "3.10", wheel-tag: "abi3", freethreaded: false }
- { python-version: "3.11", wheel-tag: "abi3", freethreaded: false }
- { python-version: "3.12", wheel-tag: "abi3", freethreaded: false }
- { python-version: "3.13", wheel-tag: "abi3", freethreaded: false }
- { python-version: "3.14", wheel-tag: "abi3", freethreaded: false }
# Free-threaded builds — one wheel per interpreter.
- { python-version: "3.13t", wheel-tag: "3.13t", freethreaded: true }
- { python-version: "3.14t", wheel-tag: "3.14t", freethreaded: true }
steps:
- uses: actions/checkout@v6
- name: Setup Python
id: setup-python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
freethreaded: ${{ matrix.freethreaded }}
- name: Cache Cargo
uses: actions/cache@v5
with:
path: ~/.cargo
key: cargo-cache-stable-${{ hashFiles('Cargo.lock') }}
- name: Install dependencies
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
with:
enable-cache: true
- name: Download pre-built Linux wheel
uses: actions/download-artifact@v8
with:
name: dist-manylinux-x86_64-${{ matrix.wheel-tag }}
path: wheels/
# FFI test wheel only built once (under the abi3 matrix entry in build.yml).
- name: Download pre-built FFI test wheel
if: matrix.wheel-tag == 'abi3'
uses: actions/download-artifact@v8
with:
name: test-ffi-manylinux-x86_64
path: wheels/
- name: Install from pre-built wheels
run: |
set -x
# Create the venv with the setup-python interpreter, then point
# every uv command explicitly at the venv's own interpreter.
# uv's interpreter discovery skips free-threaded builds unless
# asked by exact path, so plain `uv sync` (even with an activated
# venv or --active) re-picks the system 3.12 and recreates .venv.
# Targeting .venv/bin/python keeps sync and pip install in the
# same 3.13t/3.14t environment as the cp313t/cp314t wheel.
uv venv --python "${{ steps.setup-python.outputs.python-path }}"
VENV_PY="$PWD/.venv/bin/python"
uv sync --python "$VENV_PY" --dev --no-install-package datafusion
WHEELS=$(find wheels/ -name "*.whl")
if [ -n "$WHEELS" ]; then
echo "Installing wheels:"
echo "$WHEELS"
uv pip install --python "$VENV_PY" wheels/*.whl
else
echo "ERROR: No wheels found!"
exit 1
fi
- name: Run tests
env:
RUST_BACKTRACE: 1
# On free-threaded interpreters, fail loud if any C extension
# re-enables the GIL implicitly.
PYTHON_GIL: ${{ matrix.freethreaded && '0' || '' }}
run: |
git submodule update --init
# Use the .venv interpreter directly; uv discovery would skip the
# free-threaded build and re-pick the system 3.12 (see install step).
uv run --python "$PWD/.venv/bin/python" --no-project pytest -v --import-mode=importlib
# FFI + TPC-H examples only need to run once; gate to abi3 entries.
- name: FFI unit tests
if: matrix.wheel-tag == 'abi3'
run: |
cd examples/datafusion-ffi-example
uv run --no-project pytest python/tests/_test*.py
- name: Run tpchgen-cli to create 1 Gb dataset
if: matrix.wheel-tag == 'abi3'
run: |
mkdir examples/tpch/data
cd examples/tpch/data
uv pip install tpchgen-cli
uv run --no-project tpchgen-cli -s 1 --format=parquet
- name: Run TPC-H examples
if: matrix.wheel-tag == 'abi3'
run: |
cd examples/tpch
uv run --no-project pytest _tests.py