Reduce installed Open3D wheel size #3571
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Ubuntu SYCL | |
| permissions: {} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| developer_build: | |
| description: 'Set to OFF for Release wheels' | |
| required: false | |
| default: 'ON' | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| GCE_CLI_GHA_VERSION: "416.0.0" | |
| DEVELOPER_BUILD: ${{ github.event.inputs.developer_build || 'ON' }} | |
| jobs: | |
| build-lib: | |
| name: Build Lib | |
| permissions: | |
| contents: write # Release upload | |
| id-token: write | |
| attestations: write | |
| artifact-metadata: write | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| BUILD_SHARED_LIBS: [ON, OFF] | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Maximize build space | |
| run: | | |
| source util/ci_utils.sh | |
| maximize_ubuntu_github_actions_build_space | |
| - name: Docker build lib | |
| run: | | |
| # Use py310 as dummy | |
| if [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ]; then | |
| docker/docker_build.sh sycl-shared build-lib | |
| docker tag open3d-ci:sycl-shared open3d-lib-sycl-shared:latest | |
| docker save open3d-lib-sycl-shared:latest | zstd -T0 --fast=1 \ | |
| -o open3d-lib-sycl-shared.tar.zst | |
| ls -lhs open3d-lib-sycl-shared.tar.zst | |
| else | |
| docker/docker_build.sh sycl-static build-lib | |
| # Static build usually doesn't produce wheels or shared libs for python | |
| # But we might need artifacts. For now keep simple. | |
| fi | |
| - name: Upload Lib Image | |
| if: ${{ matrix.BUILD_SHARED_LIBS == 'ON' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: open3d-lib-sycl-shared | |
| path: open3d-lib-sycl-shared.tar.zst | |
| retention-days: 1 | |
| compression-level: 0 | |
| - name: Upload C++ binary package to GitHub artifacts | |
| if: ${{ matrix.BUILD_SHARED_LIBS == 'ON' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: open3d-devel-sycl | |
| path: open3d-devel-*.tar.xz | |
| if-no-files-found: error | |
| - name: Remove lib image tarball from workspace | |
| # Multi-GB and no longer needed once uploaded; frees runner disk for the | |
| # C++ tests. The devel / wheel / ccache tarballs stay: the main-branch | |
| # release and ccache upload steps below still read them. | |
| if: ${{ matrix.BUILD_SHARED_LIBS == 'ON' }} | |
| run: rm -f open3d-lib-sycl-shared.tar.zst | |
| - name: Docker test (C++) | |
| # C++ only here; Python runs in build-wheel via docker_test.sh python | |
| # inside the per-Python-version image (see docker/docker_test.sh). | |
| run: | | |
| if [ "${{ matrix.BUILD_SHARED_LIBS }}" = "ON" ]; then | |
| docker/docker_test.sh sycl-shared cpp | |
| else | |
| docker/docker_test.sh sycl-static cpp | |
| fi | |
| - name: Update devel release | |
| if: ${{ github.ref == 'refs/heads/main' && matrix.BUILD_SHARED_LIBS == 'ON' }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| .github/workflows/update_release.sh open3d*.whl open3d-devel-*.tar.xz | |
| - name: GCloud CLI auth | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| project_id: ${{ secrets.GCE_PROJECT }} | |
| credentials_json: '${{ secrets.GCE_SA_KEY_GPU_CI }}' | |
| - name: GCloud CLI setup | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| uses: google-github-actions/setup-gcloud@v2 | |
| with: | |
| version: ${{ env.GCE_CLI_GHA_VERSION }} | |
| project_id: ${{ secrets.GCE_PROJECT }} | |
| - name: Upload ccache to GCS | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| run: | | |
| gsutil cp ${GITHUB_WORKSPACE}/open3d-ci-sycl.tar.xz gs://open3d-ci-cache/ || true | |
| build-wheel: | |
| name: Build Wheel | |
| permissions: | |
| contents: write # Release upload | |
| id-token: write | |
| attestations: write | |
| artifact-metadata: write | |
| runs-on: ubuntu-latest | |
| needs: build-lib | |
| # Run even when build-lib failed (e.g. flaky C++ tests) so wheel jobs still execute. | |
| if: ${{ always() && !cancelled() }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python_version: ['3.10', '3.11', '3.12', '3.13', '3.14'] | |
| is_main: | |
| - ${{ github.ref == 'refs/heads/main' }} | |
| exclude: | |
| - is_main: false | |
| python_version: '3.10' | |
| - is_main: false | |
| python_version: '3.11' | |
| - is_main: false | |
| python_version: '3.12' | |
| - is_main: false | |
| python_version: '3.13' | |
| env: | |
| PYTHON_VERSION: ${{ matrix.python_version }} | |
| # TensorFlow v2.20 only supports python 3.9-3.13 | |
| BUILD_TENSORFLOW_OPS: ${{ matrix.python_version >= '3.14' && 'OFF' || 'ON' }} | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Maximize build space | |
| run: | | |
| source util/ci_utils.sh | |
| maximize_ubuntu_github_actions_build_space | |
| - name: Download Lib Image | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: open3d-lib-sycl-shared | |
| path: . | |
| - name: Load Lib Image | |
| run: | | |
| zstd -d --stdout open3d-lib-sycl-shared.tar.zst | docker load | |
| rm -f open3d-lib-sycl-shared.tar.zst | |
| - name: Docker build | |
| run: | | |
| export BASE_IMAGE=open3d-lib-sycl-shared:latest | |
| # We execute docker buildscript with python version argument. | |
| docker/docker_build.sh sycl-shared py${{ matrix.python_version }} | |
| # Wheel produced by the Docker build matches the matrix Python version | |
| # via -DPython3_EXECUTABLE in Dockerfile.ci. Keep only that wheel. | |
| PYTHON_ABI="cp${PYTHON_VERSION/./}" | |
| find . -maxdepth 1 -name 'open3d*.whl' \ | |
| ! -name "*${PYTHON_ABI}-${PYTHON_ABI}-*.whl" -delete | |
| compgen -G "open3d*${PYTHON_ABI}-${PYTHON_ABI}-*.whl" > /dev/null | |
| - name: Docker test (Python) | |
| run: docker/docker_test.sh sycl-shared python | |
| - name: Generate artifact attestation | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| uses: actions/attest@v4 | |
| with: | |
| subject-path: | | |
| ${{ github.workspace }}/open3d*.whl | |
| - name: Upload wheel to GitHub artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: open3d-sycl-wheel-py${{ matrix.python_version }} | |
| path: open3d*.whl | |
| if-no-files-found: error | |
| - name: Update devel release | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| .github/workflows/update_release.sh open3d*.whl | |