11
11
description : ' Whether to publish releases'
12
12
required : true
13
13
default : ' false'
14
+ PLATFORMS :
15
+ description : ' Platforms for execution in "os" or "os_arch" format (arch is "x64" by default)'
16
+ required : true
17
+ default : ' ubuntu-18.04,ubuntu-20.04,macos-10.15,windows-2019_x64,windows-2019_x86'
14
18
pull_request :
15
19
paths-ignore :
16
20
- ' versions-manifest.json'
@@ -26,26 +30,40 @@ defaults:
26
30
shell : pwsh
27
31
28
32
jobs :
33
+ generate_matrix :
34
+ runs-on : ubuntu-latest
35
+ outputs :
36
+ matrix : ${{ steps.generate-matrix.outputs.matrix }}
37
+ steps :
38
+ - name : Generate execution matrix
39
+ id : generate-matrix
40
+ run : |
41
+ $configurations = "${{ github.event.inputs.platforms }}".Split(",").Trim()
42
+ $matrix = @()
43
+
44
+ foreach ($configuration in $configurations) {
45
+ $parts = $configuration.Split("_")
46
+ $os = $parts[0]
47
+ $arch = $(if ($parts[1]) {$parts[1]} else {"x64"})
48
+ switch -wildcard ($os) {
49
+ "*ubuntu*" { $platform = $os.Replace("ubuntu","linux")}
50
+ "*macos*" { $platform = 'darwin' }
51
+ "*windows*" { $platform = 'win32' }
52
+ }
53
+ $matrix += @{
54
+ 'platform' = $platform
55
+ 'os' = $os
56
+ 'arch' = $arch
57
+ }
58
+ }
59
+ echo "::set-output name=matrix::$($matrix | ConvertTo-Json -Compress)"
60
+
29
61
build_python :
62
+ needs : generate_matrix
30
63
strategy :
31
64
fail-fast : false
32
65
matrix :
33
- include :
34
- - platform : ' linux-18.04'
35
- os : ' ubuntu-18.04'
36
- arch : ' x64'
37
- - platform : ' linux-20.04'
38
- os : ' ubuntu-20.04'
39
- arch : ' x64'
40
- - platform : ' darwin'
41
- os : ' macos-10.15'
42
- arch : ' x64'
43
- - platform : ' win32'
44
- os : ' windows-2019'
45
- arch : ' x64'
46
- - platform : ' win32'
47
- os : ' windows-2019'
48
- arch : ' x86'
66
+ include : ${{ fromJson(needs.generate_matrix.outputs.matrix) }}
49
67
runs-on : ${{ matrix.os }}
50
68
env :
51
69
ARTIFACT_NAME : python-${{ github.event.inputs.VERSION || '3.9.9' }}-${{ matrix.platform }}-${{ matrix.arch }}
@@ -68,26 +86,11 @@ jobs:
68
86
path : ${{ runner.temp }}/artifact
69
87
70
88
test_python :
71
- needs : build_python
89
+ needs : [generate_matrix, build_python]
72
90
strategy :
73
91
fail-fast : false
74
92
matrix :
75
- include :
76
- - platform : ' linux-18.04'
77
- os : ' ubuntu-18.04'
78
- arch : ' x64'
79
- - platform : ' linux-20.04'
80
- os : ' ubuntu-20.04'
81
- arch : ' x64'
82
- - platform : ' darwin'
83
- os : ' macos-10.15'
84
- arch : ' x64'
85
- - platform : ' win32'
86
- os : ' windows-2019'
87
- arch : ' x64'
88
- - platform : ' win32'
89
- os : ' windows-2019'
90
- arch : ' x86'
93
+ include : ${{ fromJson(needs.generate_matrix.outputs.matrix) }}
91
94
runs-on : ${{ matrix.os }}
92
95
env :
93
96
ARTIFACT_NAME : python-${{ github.event.inputs.VERSION || '3.9.9' }}-${{ matrix.platform }}-${{ matrix.arch }}
0 commit comments