3535 GCLOUD_SERVICE_KEY : ${{ secrets.gcloud-service-key }}
3636 BAZEL_REMOTE_CACHE : ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
3737 BAZEL_JOBS : " " # Let bazel decide the parallelism based on the number of CPUs.
38+ BAZEL_REPOSITORY_CACHE_RELATIVE_DIR : " .cache/repository-cache"
3839 BUILD_CPP_TESTS : 1
3940 steps :
4041 # Need to check out local composite actions before using them
@@ -43,30 +44,46 @@ jobs:
4344 if : inputs.has_code_changes == 'true'
4445 uses : actions/checkout@v4
4546 with :
46- sparse-checkout : |
47- .github/workflows/setup
47+ sparse-checkout : .github/workflows/setup
4848 path : .actions
49+
4950 - name : Setup
5051 if : inputs.has_code_changes == 'true'
5152 uses : ./.actions/.github/workflows/setup
53+
54+ - name : " Cache: Bazel Repository Cache"
55+ uses : actions/cache@v4
56+ with :
57+ key : bazel-repository-cache-${{ hashFiles("WORKSPACE") }}
58+ path : ${{ env.BAZEL_REPOSITORY_CACHE_RELATIVE_DIR }}
59+ enableCrossOsArchive : true
60+
5261 - name : Build
5362 if : inputs.has_code_changes == 'true'
63+ env :
64+ # Actual environment variable that is read by our build_utils.py for setting
65+ # the repository cache. Since we will be changing directories, we need to
66+ # provide the absolute path.
67+ BAZEL_REPOSITORY_CACHE_DIR : " ${{ github.workspace }}/${{ env.BAZEL_REPOSITORY_CACHE_RELATIVE_DIR }}"
5468 shell : bash
5569 run : |
5670 cd pytorch/xla/infra/ansible
5771 ansible-playbook playbook.yaml -vvv -e "stage=build arch=amd64 accelerator=tpu src_root=${GITHUB_WORKSPACE} bundle_libtpu=0 build_cpp_tests=1 git_versioned_xla_build=1 cache_suffix=-ci" --skip-tags=fetch_srcs,install_deps
72+
5873 - name : Upload wheel
5974 if : inputs.has_code_changes == 'true'
6075 uses : actions/upload-artifact@v4
6176 with :
6277 name : torch-xla-wheels
6378 path : /dist/*.whl
79+
6480 - name : Upload CPP test binaries
6581 if : inputs.has_code_changes == 'true'
6682 uses : actions/upload-artifact@v4
6783 with :
6884 name : cpp-test-bin
6985 path : /tmp/test/bin
86+
7087 - name : Report no code changes
7188 if : inputs.has_code_changes == 'false'
7289 run : |
0 commit comments