11name : CI
22on :
33 pull_request :
4+ push :
5+ branches :
6+ - main
7+ - 3.*
48 workflow_call :
59 inputs :
610 build-number :
8993 strategy :
9094 fail-fast : false
9195 matrix :
92- target : ['macOS', 'iOS', 'tvOS', 'watchOS']
96+ platform : ['macOS', 'iOS', 'tvOS', 'watchOS']
9397
9498 steps :
9599@@ -104,29 +108,29 @@ jobs:
104108 # It's an edge case, but when a new alpha is released, we need to use it ASAP.
105109 check-latest : true
106110
107- - name : Build ${{ matrix.target }}
111+ - name : Build ${{ matrix.platform }}
108112 run : |
109- # Do the build for the requested target .
110- make ${{ matrix.target }} BUILD_NUMBER=${{ needs.config.outputs.BUILD_NUMBER }}
113+ # Do the build for the requested platform .
114+ make ${{ matrix.platform }} BUILD_NUMBER=${{ needs.config.outputs.BUILD_NUMBER }}
111115
112116 - name : Upload build artefacts
113117114118 with :
115- name : Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.target }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
116- path : dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.target }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
119+ name : Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
120+ path : dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
117121
118122 briefcase-testbed :
119- name : Briefcase testbed (${{ matrix.target }})
123+ name : Briefcase testbed (${{ matrix.platform }})
120124 runs-on : macOS-latest
121125 needs : [ config, build ]
122126 strategy :
123127 fail-fast : false
124128 matrix :
125- target : ["macOS", "iOS"]
129+ platform : ["macOS", "iOS"]
126130 include :
127131 - briefcase-run-args :
128132
129- - target : iOS
133+ - platform : iOS
130134 briefcase-run-args : ' -d "iPhone SE (3rd generation)"'
131135
132136 steps :
@@ -135,12 +139,12 @@ jobs:
135139 - name : Get build artifact
136140137141 with :
138- pattern : Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.target }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
142+ pattern : Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
139143 path : dist
140144 merge-multiple : true
141145
142146 - name : Set up Python
143- 147+ 144148 with :
145149 # Appending -dev ensures that we can always build the dev release.
146150 # It's a no-op for versions that have been published.
@@ -162,24 +166,24 @@ jobs:
162166 - name : Run support testbed check
163167 timeout-minutes : 10
164168 working-directory : Python-support-testbed
165- run : briefcase run ${{ matrix.target }} Xcode --test ${{ matrix.briefcase-run-args }} -C support_package=\'../dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.target }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz\'
169+ run : briefcase run ${{ matrix.platform }} Xcode --test ${{ matrix.briefcase-run-args }} -C support_package=\'../dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz\'
166170
167171 cpython-testbed :
168- name : CPython testbed (${{ matrix.target }})
172+ name : CPython testbed (${{ matrix.platform }})
169173 runs-on : macOS-latest
170174 needs : [ config, build ]
171175 strategy :
172176 fail-fast : false
173177 matrix :
174- target : ["iOS"]
178+ platform : ["iOS"]
175179
176180 steps :
177181178182
179183 - name : Get build artifact
180184181185 with :
182- pattern : Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.target }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
186+ pattern : Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
183187 path : dist
184188 merge-multiple : true
185189
@@ -195,13 +199,13 @@ jobs:
195199
196200 - name : Unpack support package
197201 run : |
198- mkdir support
199- cd support
200- tar zxvf ../dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.target }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
202+ mkdir -p support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}
203+ cd support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}
204+ tar zxvf ../../../ dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
201205
202206 - name : Run CPython testbed
203207 timeout-minutes : 10
204- working-directory : support
208+ working-directory : support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}
205209 run : |
206210 # Run a representative subset of CPython core tests:
207211 # - test_builtin as a test of core language tools
@@ -210,3 +214,66 @@ jobs:
210214 # - test_bz2 as a simple test of third party libraries
211215 # - test_ctypes as a test of FFI
212216 python -m testbed run -- test --single-process --rerun -W test_builtin test_grammar test_os test_bz2 test_ctypes
217+
218+ crossenv-test :
219+ name : Cross-platform env test (${{ matrix.platform }})
220+ runs-on : macOS-latest
221+ needs : [ config, build ]
222+ strategy :
223+ fail-fast : false
224+ matrix :
225+ include :
226+ - platform : iOS
227+ slice : ios-arm64_x86_64-simulator
228+ multiarch : arm64-iphonesimulator
229+ - platform : iOS
230+ slice : ios-arm64_x86_64-simulator
231+ multiarch : x86_64-iphonesimulator
232+ - platform : iOS
233+ slice : ios-arm64
234+ multiarch : arm64-iphoneos
235+
236+ steps :
237+ 238+
239+ - name : Get build artifact
240+ 241+ with :
242+ pattern : Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
243+ path : dist
244+ merge-multiple : true
245+
246+ - name : Set up Python
247+ 248+ with :
249+ # Appending -dev ensures that we can always build the dev release.
250+ # It's a no-op for versions that have been published.
251+ python-version : ${{ needs.config.outputs.PYTHON_VER }}-dev
252+ # Ensure that we *always* use the latest build, not a cached version.
253+ # It's an edge case, but when a new alpha is released, we need to use it ASAP.
254+ check-latest : true
255+
256+ - name : Unpack support package
257+ run : |
258+ mkdir -p support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}
259+ cd support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}
260+ tar zxvf ../../../dist/Python-${{ needs.config.outputs.PYTHON_VER }}-${{ matrix.platform }}-support.${{ needs.config.outputs.BUILD_NUMBER }}.tar.gz
261+
262+ - name : Run cross-platform environment test
263+ env :
264+ PYTHON_CROSS_PLATFORM : ${{ matrix.platform }}
265+ PYTHON_CROSS_SLICE : ${{ matrix.slice }}
266+ PYTHON_CROSS_MULTIARCH : ${{ matrix.multiarch }}
267+ run : |
268+ # Create and activate a native virtual environment
269+ python${{ needs.config.outputs.PYTHON_VER }} -m venv cross-venv
270+ source cross-venv/bin/activate
271+
272+ # Install pytest
273+ python -m pip install pytest
274+
275+ # Convert venv into cross-venv
276+ python support/${{ needs.config.outputs.PYTHON_VER }}/${{ matrix.platform }}/Python.xcframework/${{ matrix.slice }}/platform-config/${{ matrix.multiarch }}/make_cross_venv.py cross-venv
277+
278+ # Run the test suite
279+ python -m pytest tests
0 commit comments