| 
 | 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 | +          - 'linux-x86_64'  | 
 | 12 | +          - 'linux-aarch64'  | 
 | 13 | +          - 'windows-amd64'  | 
 | 14 | +          - 'osx-x86_64'  | 
 | 15 | +          - 'osx-arm64'  | 
 | 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: ${{ inputs.python_version }}-${{ matrix.platform.id }}'  | 
 | 43 | +    strategy:  | 
 | 44 | +      matrix:  | 
 | 45 | +        platform:  | 
 | 46 | +          - { os: windows-2025,     arch: amd64,      id: windows-amd64 }  | 
 | 47 | +          - { os: ubuntu-24.04,     arch: x86_64,     id: linux-x86_64 }  | 
 | 48 | +          - { os: ubuntu-24.04-arm, arch: aarch64,    id: linux-aarch64 }  | 
 | 49 | +          - { os: macos-15,         arch: arm64,      id: osx-arm64 }  | 
 | 50 | +          - { os: macos-15-intel,   arch: x86_64,     id: osx-x86_64 }  | 
 | 51 | +        exclude:  | 
 | 52 | +          - platform: { id: windows-amd64 }  | 
 | 53 | +          - platform: { id: linux-x86_64 }  | 
 | 54 | +          - platform: { id: linux-aarch64 }  | 
 | 55 | +          - platform: { id: osx-arm64 }  | 
 | 56 | +          - platform: { id: osx-x86_64 }  | 
 | 57 | +        include:  | 
 | 58 | +          - platform: { id: "${{ inputs.platform }}" }  | 
 | 59 | +    runs-on: ${{ matrix.platform.os }}  | 
 | 60 | + | 
 | 61 | +    steps:  | 
 | 62 | +      - name: Checkout DuckDB Python  | 
 | 63 | +        uses: actions/checkout@v4  | 
 | 64 | +        with:  | 
 | 65 | +          fetch-depth: 0  | 
 | 66 | +          submodules: true  | 
 | 67 | + | 
 | 68 | +      - name: Install uv  | 
 | 69 | +        uses: astral-sh/setup-uv@v7  | 
 | 70 | +        with:  | 
 | 71 | +          version: "0.9.0"  | 
 | 72 | +          enable-cache: false  | 
 | 73 | +          python-version: ${{ inputs.python_version }}  | 
 | 74 | + | 
 | 75 | +      - name: Set and validate test path  | 
 | 76 | +        id: test_path  | 
 | 77 | +        shell: bash  | 
 | 78 | +        run: |  | 
 | 79 | +          if [[ -n "${{ inputs.custom_test_path }}" ]]; then  | 
 | 80 | +            test_path="${{ inputs.custom_test_path }}"  | 
 | 81 | +
  | 
 | 82 | +            # Check if path exists and is within tests/ directory  | 
 | 83 | +            if ! cd "$test_path" 2>/dev/null; then  | 
 | 84 | +              echo "::error::Test path does not exist: $test_path"  | 
 | 85 | +              exit 1  | 
 | 86 | +            fi  | 
 | 87 | +
  | 
 | 88 | +            # Check if current directory is within tests/  | 
 | 89 | +            current_dir="$(pwd)"  | 
 | 90 | +            expected_prefix="$GITHUB_WORKSPACE/tests"  | 
 | 91 | +
  | 
 | 92 | +            if [[ "$current_dir" != "$expected_prefix"* ]]; then  | 
 | 93 | +              echo "::error::Test path must be within the tests/ directory"  | 
 | 94 | +              exit 1  | 
 | 95 | +            fi  | 
 | 96 | +
  | 
 | 97 | +            echo "path=$test_path" >> $GITHUB_OUTPUT  | 
 | 98 | +          else  | 
 | 99 | +            # Use testsuite parameter  | 
 | 100 | +            case "${{ inputs.testsuite }}" in  | 
 | 101 | +              "fast")  | 
 | 102 | +                echo "path=tests/fast" >> $GITHUB_OUTPUT  | 
 | 103 | +                ;;  | 
 | 104 | +              "all")  | 
 | 105 | +                echo "path=tests" >> $GITHUB_OUTPUT  | 
 | 106 | +                ;;  | 
 | 107 | +            esac  | 
 | 108 | +          fi  | 
 | 109 | +
  | 
 | 110 | +      - name: Run tests  | 
 | 111 | +        shell: bash  | 
 | 112 | +        run: |  | 
 | 113 | +          uv run pytest -vv ${{ steps.test_path.outputs.path }}  | 
0 commit comments