From ec3264b789a696d0b4de86f1a8570a12f4abae89 Mon Sep 17 00:00:00 2001 From: Evert Lammerts Date: Thu, 30 Oct 2025 11:12:35 +0100 Subject: [PATCH] add targeted test workflow --- .github/workflows/targeted_test.yml | 86 +++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/targeted_test.yml diff --git a/.github/workflows/targeted_test.yml b/.github/workflows/targeted_test.yml new file mode 100644 index 00000000..812bb9c5 --- /dev/null +++ b/.github/workflows/targeted_test.yml @@ -0,0 +1,86 @@ +name: Targeted Platform Testing + +on: + workflow_dispatch: + inputs: + platform: + description: 'Platform to test on' + required: true + type: choice + options: + - 'windows-2025' + - 'ubuntu-24.04' + - 'ubuntu-24.04-arm' + - 'macos-15' + - 'macos-15-intel' + python_version: + description: 'Python version to test' + required: true + type: choice + options: + - '3.9' + - '3.10' + - '3.11' + - '3.12' + - '3.13' + - '3.14' + testsuite: + description: 'Test suite to run (ignored if custom_test_path is provided)' + required: false + type: choice + options: + - 'fast' + - 'all' + default: 'fast' + custom_test_path: + description: 'Custom test path (must be in tests/ directory, overrides testsuite)' + required: false + type: string + +jobs: + test: + name: 'Test with Python ${{ inputs.python_version }} on ${{ inputs.platform }}' + runs-on: ${{ inputs.platform }} + + steps: + - name: Checkout DuckDB Python + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + version: "0.9.0" + enable-cache: false + python-version: ${{ inputs.python_version }} + + - name: Set and validate test path + id: test_path + shell: bash + run: | + if [[ -n "${{ inputs.custom_test_path }}" ]]; then + # test path was passed in + tests_base="$( pwd -P )/tests" + test_path="${{ inputs.custom_test_path }}" + + # Ensure the given test path exists + [[ -e "$test_path" ]] || { echo "${test_path} does not exist"; exit 1; } + + # Resolve custom test path to absolute path + test_path_abs=$(cd "$test_path" 2>/dev/null && pwd -P || ( cd "$(dirname "$test_path")" && printf '%s/%s' "$(pwd -P)" "$(basename "$test_path")" ) ) + + # Make sure test_path_abs is inside tests_base + [[ "$test_path_abs" == "$tests_base" || "$test_path_abs" == "$tests_base"/* ]] || { echo "${test_path_abs} is not part of ${tests_base}?"; exit 1; } + + echo "test_path=$test_path_abs" >> $GITHUB_OUTPUT + else + # use a testsuite + echo "test_path=$GITHUB_WORKSPACE/${{ inputs.testsuite == 'fast' && 'tests/fast' || 'tests' }}" >> $GITHUB_OUTPUT + fi + + - name: Run tests + shell: bash + run: | + uv run pytest -vv ${{ steps.test_path.outputs.test_path }}