|
28 | 28 | default: 'true' |
29 | 29 |
|
30 | 30 | jobs: |
| 31 | + generate-matrix: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + outputs: |
| 34 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 35 | + steps: |
| 36 | + - name: Generate build matrix |
| 37 | + id: set-matrix |
| 38 | + run: | |
| 39 | + # Get input parameters or use defaults |
| 40 | + python_versions="${{ github.event.inputs.python_versions || '3.8,3.9,3.10,3.11,3.12' }}" |
| 41 | + cuda_versions="${{ github.event.inputs.cuda_versions || '11.8,12.1,12.4,12.6,12.8' }}" |
| 42 | + platforms="${{ github.event.inputs.platforms || 'windows,linux' }}" |
| 43 | +
|
| 44 | + # Convert comma-separated strings to arrays |
| 45 | + IFS=',' read -ra PYTHON_ARRAY <<< "$python_versions" |
| 46 | + IFS=',' read -ra CUDA_ARRAY <<< "$cuda_versions" |
| 47 | + IFS=',' read -ra PLATFORM_ARRAY <<< "$platforms" |
| 48 | +
|
| 49 | + # Map platforms to OS |
| 50 | + os_array=() |
| 51 | + for platform in "${PLATFORM_ARRAY[@]}"; do |
| 52 | + case "$platform" in |
| 53 | + "windows") os_array+=("windows-2022") ;; |
| 54 | + "linux") os_array+=("ubuntu-22.04") ;; |
| 55 | + esac |
| 56 | + done |
| 57 | +
|
| 58 | + # Build matrix JSON |
| 59 | + matrix_json="{\"include\":[" |
| 60 | + first=true |
| 61 | +
|
| 62 | + for os in "${os_array[@]}"; do |
| 63 | + for python in "${PYTHON_ARRAY[@]}"; do |
| 64 | + for cuda in "${CUDA_ARRAY[@]}"; do |
| 65 | + # Skip Python 3.12 with CUDA 11.8 for compatibility |
| 66 | + if [[ "$python" == "3.12" && "$cuda" == "11.8" ]]; then |
| 67 | + continue |
| 68 | + fi |
| 69 | +
|
| 70 | + if [ "$first" = true ]; then |
| 71 | + first=false |
| 72 | + else |
| 73 | + matrix_json+="," |
| 74 | + fi |
| 75 | +
|
| 76 | + matrix_json+="{\"os\":\"$os\",\"python-version\":\"$python\",\"cuda-version\":\"$cuda\"}" |
| 77 | + done |
| 78 | + done |
| 79 | + done |
| 80 | +
|
| 81 | + matrix_json+="]}" |
| 82 | +
|
| 83 | + echo "Generated matrix: $matrix_json" |
| 84 | + echo "matrix=$matrix_json" >> $GITHUB_OUTPUT |
| 85 | +
|
31 | 86 | build-wheels: |
| 87 | + needs: generate-matrix |
32 | 88 | strategy: |
33 | | - matrix: |
34 | | - os: [windows-2022, ubuntu-22.04] |
35 | | - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
36 | | - cuda-version: ['11.8', '12.1', '12.4', '12.6', '12.8'] |
37 | | - exclude: |
38 | | - # Exclude Python 3.12 with older CUDA versions for compatibility |
39 | | - - python-version: '3.12' |
40 | | - cuda-version: '11.8' |
| 89 | + matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} |
41 | 90 | fail-fast: false |
42 | 91 |
|
43 | 92 | runs-on: ${{ matrix.os }} |
@@ -402,7 +451,7 @@ jobs: |
402 | 451 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
403 | 452 |
|
404 | 453 | test-wheels: |
405 | | - needs: build-wheels |
| 454 | + needs: [build-wheels, generate-matrix] |
406 | 455 | strategy: |
407 | 456 | matrix: |
408 | 457 | os: [windows-2022, ubuntu-22.04] |
|
0 commit comments