Add ALLOW_BROKEN_CONDITIONALS variable before calling ansible-playbook. #2
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: build-torch-xla | ||
on: | ||
workflow_call: | ||
inputs: | ||
dev-image: | ||
required: true | ||
type: string | ||
description: Base image for builds | ||
torch-commit: | ||
required: true | ||
type: string | ||
description: torch-commit | ||
runner: | ||
required: false | ||
type: string | ||
description: Runner type for the test | ||
default: linux.12xlarge | ||
timeout-minutes: | ||
required: false | ||
type: number | ||
description: Timeout in minutes for the build job | ||
default: 45 # Takes ~20m as of 2025/5/30. | ||
has_code_changes: | ||
required: false | ||
type: string | ||
description: Whether to run full workflow or not | ||
default: 'true' | ||
secrets: | ||
gcloud-service-key: | ||
required: true | ||
description: Secret to access Bazel build cache | ||
jobs: | ||
build: | ||
runs-on: ${{ inputs.runner }} | ||
timeout-minutes: ${{ inputs.timeout-minutes }} | ||
container: | ||
image: ${{ inputs.dev-image }} | ||
env: | ||
GCLOUD_SERVICE_KEY: ${{ secrets.gcloud-service-key }} | ||
BAZEL_REMOTE_CACHE: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} | ||
BAZEL_JOBS: '' # Let bazel decide the parallelism based on the number of CPUs. | ||
BUILD_CPP_TESTS: 1 | ||
steps: | ||
# Need to check out local composite actions before using them | ||
# https://github.com/orgs/community/discussions/11771 | ||
- name: Checkout actions | ||
if: inputs.has_code_changes == 'true' | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
.github/workflows/setup | ||
path: .actions | ||
- name: Setup | ||
if: inputs.has_code_changes == 'true' | ||
uses: ./.actions/.github/workflows/setup | ||
with: | ||
torch-commit: ${{ inputs.torch-commit }} | ||
- name: Build | ||
if: inputs.has_code_changes == 'true' | ||
shell: bash | ||
env: | ||
- ALLOW_BROKEN_CONDITIONALS: 1 | ||
run: | | ||
cd pytorch/xla/infra/ansible | ||
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 | ||
- name: Upload wheel | ||
if: inputs.has_code_changes == 'true' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: torch-xla-wheels | ||
path: /dist/*.whl | ||
- name: Upload CPP test binaries | ||
if: inputs.has_code_changes == 'true' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cpp-test-bin | ||
path: /tmp/test/bin | ||
- name: Report no code changes | ||
if: inputs.has_code_changes == 'false' | ||
run: | | ||
echo "No code changes were detected that require running the full test suite." | ||