1313# limitations under the License.
1414
1515steps :
16- # 1. Build the distribution (sdist and wheel).
17- # This uses scikit-build-core as defined in pyproject.toml to compile C++ extensions.
18- # We set BUILD_TESTING=OFF to ignore tests during the artifact build.
16+ # 1. Build the source distribution (sdist).
1917 - name : ' python:3.10'
20- id : ' build'
18+ id : ' build-sdist '
2119 entrypoint : ' bash'
2220 args :
2321 - ' -c'
@@ -27,27 +25,47 @@ steps:
2725 exit 1
2826 fi
2927 pip install build
30-
31- echo "Building C++ extensions with editable install..."
32- # Note: pip install -e . will also respect the build-system requirements
28+ python -m build --sdist
29+
30+ # 2. Build the manylinux wheels using cibuildwheel.
31+ # This step builds for the native architecture of the GCB worker (x86_64 or ARM64).
32+ # Multiple parallel builds on different architectures can safely upload to the same AR repository.
33+ - name : ' python:3.10'
34+ id : ' build-wheels'
35+ entrypoint : ' bash'
36+ args :
37+ - ' -c'
38+ - |
39+ # Install cibuildwheel and the docker client
40+ pip install cibuildwheel
41+ apt-get update && apt-get install -y docker.io
42+
43+ echo "Detected architecture: $(uname -m)"
44+
45+ echo "Building C++ extensions with editable install (local check)..."
3346 SKBUILD_CMAKE_ARGS="-DBUILD_TESTING=OFF" pip install -e .
34-
35- echo "Building sdist and wheel..."
36- SKBUILD_CMAKE_ARGS="-DBUILD_TESTING=OFF" python -m build
3747
38- # 2. Upload to internal Artifact Registry (AR) for OSS Exit Gate.
39- # OSS Exit Gate fetches artifacts from this repository.
48+ echo "Running cibuildwheel..."
49+ # cibuildwheel will build for the native architecture by default
50+ # using the Python version filters defined in pyproject.toml.
51+ cibuildwheel --output-dir dist
52+ volumes :
53+ - name : ' docker-socket'
54+ path : ' /var/run/docker.sock'
55+ waitFor : ['build-sdist']
56+
57+ # 3. Upload to internal Artifact Registry (AR) for OSS Exit Gate.
4058 - name : ' python:3.10'
4159 id : ' upload-to-ar'
4260 entrypoint : ' bash'
4361 args :
4462 - ' -c'
4563 - |
46- pip install -U twine keyring keyrings.google-artifactregistry-auth
64+ pip install twine keyring keyrings.google-artifactregistry-auth
4765 twine upload --repository-url https://us-python.pkg.dev/oss-exit-gate-prod/${_PROJECT_NAME}--pypi dist/*
48- waitFor : ['build']
66+ waitFor : ['build-wheels ']
4967
50- # 3 . Create and upload the manifest to GCS to trigger the Exit Gate publication.
68+ # 4 . Create and upload the manifest to GCS to trigger the Exit Gate publication.
5169 # The presence of this file in the specific GCS bucket triggers the verification and publishing process.
5270 - name : ' gcr.io/cloud-builders/gcloud'
5371 id : ' trigger-exit-gate'
0 commit comments