@@ -25,12 +25,28 @@ jobs:
2525 name : dist
2626 path : dist
2727
28+ matrix_config :
29+ name : Matrix Runner Config
30+ runs-on : ubuntu-22.04
31+ outputs :
32+ matrix_os : ${{ steps.step.outputs.matrix_os }}
33+ steps :
34+ - run : echo "$GITHUB_EVENT_NAME"
35+ - id : step
36+ run : |
37+ if [ "$GITHUB_EVENT_NAME" = "release" ]; then
38+ echo 'matrix_os=["macos-13-xlarge", "ubuntu-22.04", "windows-2022"]' >> $GITHUB_OUTPUT
39+ else
40+ echo 'matrix_os=["macos-13", "ubuntu-22.04", "windows-2022"]' >> $GITHUB_OUTPUT
41+ fi
42+
2843 whl_3_8 :
2944 name : Build / ${{ matrix.os }} / Python 3.${{ matrix.minor }}
45+ needs : matrix_config
3046 strategy :
3147 fail-fast : false
3248 matrix :
33- os : [macos-13, ubuntu-22.04, windows-2022]
49+ os : ${{ fromJson(needs.matrix_config.outputs.matrix_os) }}
3450 minor : [8]
3551 runs-on : ${{ matrix.os }}
3652 steps :
@@ -41,28 +57,29 @@ jobs:
4157 - run : echo '::add-matcher::.github/problem-matchers/msvc.json'
4258 if : matrix.os == 'windows-2022'
4359
60+ - run : pip install pipx # only for macos amd64
4461 - uses : pypa/cibuildwheel@v2.16.2
4562 with :
4663 output-dir : dist
4764 env :
4865 CIBW_BUILD : cp3${{ matrix.minor }}-*
4966 CIBW_ARCHS_WINDOWS : x86 AMD64
50- CIBW_ARCHS_MACOS : x86_64 universal2 arm64
67+ CIBW_ARCHS_MACOS : x86_64 arm64
5168 CIBW_BEFORE_BUILD : pip install -r {project}/requirements-build-3_08.txt
5269 CIBW_BEFORE_TEST : pip install -r {project}/requirements-dev-3_08.txt
5370 CIBW_TEST_COMMAND : pytest {project}
54-
5571 - uses : actions/upload-artifact@v3
5672 with :
5773 name : dist
5874 path : dist
5975
6076 whl_gte_3_9_to_3_11 :
6177 name : Build / ${{ matrix.os }} / Python 3.${{ matrix.minor }}
78+ needs : matrix_config
6279 strategy :
6380 fail-fast : false
6481 matrix :
65- os : [macos-13, ubuntu-22.04, windows-2022]
82+ os : ${{fromJson(needs.matrix_config.outputs.matrix_os)}}
6683 minor : [9, 10, 11]
6784 runs-on : ${{ matrix.os }}
6885 steps :
@@ -73,28 +90,29 @@ jobs:
7390 - run : echo '::add-matcher::.github/problem-matchers/msvc.json'
7491 if : matrix.os == 'windows-2022'
7592
93+ - run : pip install pipx
7694 - uses : pypa/cibuildwheel@v2.16.2
7795 with :
7896 output-dir : dist
7997 env :
8098 CIBW_BUILD : cp3${{ matrix.minor }}-*
8199 CIBW_ARCHS_WINDOWS : x86 AMD64
82- CIBW_ARCHS_MACOS : x86_64 universal2 arm64
100+ CIBW_ARCHS_MACOS : x86_64 arm64
83101 CIBW_BEFORE_BUILD : pip install -r {project}/requirements-build-3_11.txt
84102 CIBW_BEFORE_TEST : pip install -r {project}/requirements-dev-3_11.txt
85103 CIBW_TEST_COMMAND : pytest {project}
86-
87104 - uses : actions/upload-artifact@v3
88105 with :
89106 name : dist
90107 path : dist
91108
92109 whl_3_12 :
93110 name : Build / ${{ matrix.os }} / Python 3.${{ matrix.minor }}
111+ needs : matrix_config
94112 strategy :
95113 fail-fast : false
96114 matrix :
97- os : [macos-13, ubuntu-22.04, windows-2022]
115+ os : ${{fromJson(needs.matrix_config.outputs.matrix_os)}}
98116 minor : [12]
99117 runs-on : ${{ matrix.os }}
100118 steps :
@@ -105,25 +123,25 @@ jobs:
105123 - run : echo '::add-matcher::.github/problem-matchers/msvc.json'
106124 if : matrix.os == 'windows-2022'
107125
126+ - run : pip install pipx
108127 - uses : pypa/cibuildwheel@v2.16.2
109128 with :
110129 output-dir : dist
111130 env :
112131 CIBW_BUILD : cp3${{ matrix.minor }}-*
113132 CIBW_ARCHS_WINDOWS : x86 AMD64
114- CIBW_ARCHS_MACOS : x86_64 universal2 arm64
133+ CIBW_ARCHS_MACOS : x86_64 arm64
115134 CIBW_BEFORE_BUILD : pip install -r {project}/requirements-build-3_12.txt
116135 CIBW_BEFORE_TEST : pip install -r {project}/requirements-dev-3_12.txt
117136 CIBW_TEST_COMMAND : pytest {project}
118-
119137 - uses : actions/upload-artifact@v3
120138 with :
121139 name : dist
122140 path : dist
123141
124142 upload :
125143 name : Publish
126- if : github.event_name == 'release' && github.event.action == 'published'
144+ if : github.event_name == 'release'
127145 needs : [tar_gz, whl_3_8, whl_gte_3_9_to_3_11, whl_3_12]
128146 runs-on : ubuntu-latest
129147 steps :
0 commit comments