|
11 | 11 | description: extra flags to add to go test |
12 | 12 | type: string |
13 | 13 | required: false |
| 14 | + matrix: |
| 15 | + description: | |
| 16 | + Optional JSON string to define the test matrix, using keys: "os" and "go". |
| 17 | +
|
| 18 | + By default tests run a 6-way matrix running on os (linux,windows,macos) |
| 19 | + for the 2 latest go releases (stable, oldstable). |
| 20 | +
|
| 21 | + The default matrix used is: |
| 22 | + {"os":["ubuntu-latest","macos-latest","windows-latest"],"go": ["oldstable","stable"]} |
| 23 | +
|
| 24 | + type: string |
| 25 | + required: false |
14 | 26 |
|
15 | 27 | defaults: |
16 | 28 | run: |
|
27 | 39 | module-names: ${{ steps.detect-monorepo.outputs.names }} |
28 | 40 | coverpkg: ${{ steps.prepare-tests.outputs.coverpkg }} |
29 | 41 | all-modules: ${{ steps.prepare-tests.outputs.all-modules }} |
| 42 | + test-matrix: ${{ steps.test-matrix.outputs.test-matrix }} |
30 | 43 | steps: |
31 | 44 | - |
32 | 45 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
@@ -88,15 +101,23 @@ jobs: |
88 | 101 | # golangci-lint run --new-from-rev origin/master |
89 | 102 | # popd |
90 | 103 | # done < <(echo ${{ steps.detect-monorepo.outputs.bash-paths }}) |
| 104 | + - |
| 105 | + name: Test matrix |
| 106 | + id: test-matrix |
| 107 | + env: |
| 108 | + MATRIX: | |
| 109 | + ${{ inputs.test-matrix || '{"os":["ubuntu-latest","macos-latest","windows-latest"],"go": ["oldstable","stable"]}' }} |
| 110 | + run: | |
| 111 | + echo "test-matrix<<EOF" >> "${GITHUB_OUTPUT}" |
| 112 | + printenv MATRIX >> "${GITHUB_OUTPUT}" |
| 113 | + echo "EOF" >> "${GITHUB_OUTPUT}" |
91 | 114 |
|
92 | 115 | test: |
93 | 116 | name: Unit tests mono-repo |
94 | 117 | needs: [ lint ] |
95 | 118 | runs-on: ${{ matrix.os }} |
96 | 119 | strategy: |
97 | | - matrix: |
98 | | - os: [ ubuntu-latest, macos-latest, windows-latest ] |
99 | | - go: ['oldstable', 'stable' ] |
| 120 | + matrix: ${{ fromJSON(needs.lint.outputs.test-matrix) }} |
100 | 121 | steps: |
101 | 122 | - |
102 | 123 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
|
0 commit comments