Skip to content

Commit eaec7b8

Browse files
committed
add targeted test workflow
1 parent ab5c5af commit eaec7b8

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Targeted Platform Testing
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
platform:
7+
description: 'Platform to test on'
8+
required: true
9+
type: choice
10+
options:
11+
- 'windows-2025'
12+
- 'ubuntu-24.04'
13+
- 'ubuntu-24.04-arm'
14+
- 'macos-15'
15+
- 'macos-15-intel'
16+
python_version:
17+
description: 'Python version to test'
18+
required: true
19+
type: choice
20+
options:
21+
- '3.9'
22+
- '3.10'
23+
- '3.11'
24+
- '3.12'
25+
- '3.13'
26+
- '3.14'
27+
testsuite:
28+
description: 'Test suite to run (ignored if custom_test_path is provided)'
29+
required: false
30+
type: choice
31+
options:
32+
- 'fast'
33+
- 'all'
34+
default: 'fast'
35+
custom_test_path:
36+
description: 'Custom test path (must be in tests/ directory, overrides testsuite)'
37+
required: false
38+
type: string
39+
40+
jobs:
41+
test:
42+
name: 'Test with Python ${{ inputs.python_version }} on ${{ inputs.platform }}'
43+
runs-on: ${{ inputs.platform }}
44+
45+
steps:
46+
- name: Checkout DuckDB Python
47+
uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 0
50+
submodules: true
51+
52+
- name: Install uv
53+
uses: astral-sh/setup-uv@v7
54+
with:
55+
version: "0.9.0"
56+
enable-cache: false
57+
python-version: ${{ inputs.python_version }}
58+
59+
- name: Set and validate test path
60+
id: test_path
61+
shell: bash
62+
run: |
63+
if [[ -n "${{ inputs.custom_test_path }}" ]]; then
64+
# test path was passed in
65+
tests_base="$GITHUB_WORKSPACE/tests"
66+
test_path="${{ inputs.custom_test_path }}"
67+
68+
# Ensure path exists
69+
[[ -e "$test_path" ]] || { echo "${test_path} does not exist"; exit 1; }
70+
71+
# Resolve custom test path to absolute path
72+
test_path_abs=$(cd "$test_path" 2>/dev/null && pwd -P || ( cd "$(dirname "$test_path")" && printf '%s/%s' "$(pwd -P)" "$(basename "$test_path")" ) )
73+
74+
# Make sure test_path_abs is inside tests_base
75+
[[ "$test_path_abs" == "$tests_base" || "$test_path_abs" == "$tests_base"/* ]] || { echo "${test_path_abs} is not part of ${tests_base}?"; exit 1; }
76+
77+
echo "test_path=$test_path_abs" >> $GITHUB_OUTPUT
78+
else
79+
# use a testsuite
80+
echo "test_path=$GITHUB_WORKSPACE/${{ inputs.testsuite == 'fast' && 'tests/fast' || 'tests' }}" >> $GITHUB_OUTPUT
81+
fi
82+
83+
- name: Run tests
84+
shell: bash
85+
run: |
86+
uv run pytest -vv ${{ steps.test_path.outputs.path }}

0 commit comments

Comments
 (0)