|
28 | 28 | COMPOSER_UPDATE_FLAGS: "" |
29 | 29 |
|
30 | 30 | jobs: |
| 31 | + # Generate matrix dynamically based on inputs |
| 32 | + matrix-generator: |
| 33 | + name: Generate Test Matrix |
| 34 | + runs-on: ubuntu-latest |
| 35 | + outputs: |
| 36 | + matrix: ${{ steps.generate.outputs.matrix }} |
| 37 | + steps: |
| 38 | + - name: Generate matrix |
| 39 | + id: generate |
| 40 | + uses: actions/github-script@v7 |
| 41 | + with: |
| 42 | + script: | |
| 43 | + const oldStable = ${{ inputs.old_stable }}; |
| 44 | + const currentStable = "${{ inputs.current_stable }}"; |
| 45 | + |
| 46 | + let matrix = { |
| 47 | + include: [] |
| 48 | + }; |
| 49 | + |
| 50 | + // Add old stable versions if provided |
| 51 | + if (oldStable.length > 0) { |
| 52 | + for (const version of oldStable) { |
| 53 | + matrix.include.push({ |
| 54 | + "php-version": version, |
| 55 | + "os": "ubuntu-latest", |
| 56 | + "dependencies": "highest", |
| 57 | + "experimental": false |
| 58 | + }); |
| 59 | + matrix.include.push({ |
| 60 | + "php-version": version, |
| 61 | + "os": "ubuntu-latest", |
| 62 | + "dependencies": "lowest", |
| 63 | + "experimental": false |
| 64 | + }); |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + // Always add current stable tests |
| 69 | + matrix.include.push({ |
| 70 | + "php-version": currentStable, |
| 71 | + "os": "windows-latest", |
| 72 | + "dependencies": "highest", |
| 73 | + "experimental": false |
| 74 | + }); |
| 75 | + matrix.include.push({ |
| 76 | + "php-version": currentStable, |
| 77 | + "os": "ubuntu-latest", |
| 78 | + "dependencies": "highest", |
| 79 | + "experimental": false |
| 80 | + }); |
| 81 | + matrix.include.push({ |
| 82 | + "php-version": currentStable, |
| 83 | + "os": "ubuntu-latest", |
| 84 | + "dependencies": "lowest", |
| 85 | + "experimental": false |
| 86 | + }); |
| 87 | + |
| 88 | + core.setOutput('matrix', JSON.stringify(matrix)); |
| 89 | +
|
31 | 90 | phpunit: |
32 | | - name: PHPUnit |
| 91 | + name: PHPUnit - PHP ${{ matrix.php-version }} (${{ matrix.os }}, ${{ matrix.dependencies }}) |
| 92 | + needs: matrix-generator |
33 | 93 | runs-on: ${{ matrix.os }} |
34 | 94 | strategy: |
35 | 95 | fail-fast: false |
36 | | - matrix: |
37 | | - # Only include old_stable versions if they are provided |
38 | | - php-version: ${{ fromJson(inputs.old_stable || '[]') }} |
39 | | - dependencies: [highest, lowest] |
40 | | - os: [ubuntu-latest] |
41 | | - experimental: [false] |
42 | | - # Exclude combinations when old_stable is empty |
43 | | - exclude: |
44 | | - - php-version: null |
45 | | - include: |
46 | | - # Always include current_stable tests |
47 | | - - php-version: ${{ inputs.current_stable }} |
48 | | - os: windows-latest |
49 | | - dependencies: highest |
50 | | - experimental: false |
51 | | - - php-version: ${{ inputs.current_stable }} |
52 | | - os: ubuntu-latest |
53 | | - dependencies: highest |
54 | | - experimental: false |
55 | | - - php-version: ${{ inputs.current_stable }} |
56 | | - os: ubuntu-latest |
57 | | - dependencies: lowest |
58 | | - experimental: false |
| 96 | + matrix: ${{ fromJson(needs.matrix-generator.outputs.matrix) }} |
59 | 97 |
|
60 | 98 | continue-on-error: ${{ matrix.experimental }} |
61 | 99 |
|
|
0 commit comments