Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 76 additions & 77 deletions .github/workflows/_build_torch_xla.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,79 @@
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
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
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."

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
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."
134 changes: 67 additions & 67 deletions .github/workflows/_docs.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
name: xla-docs-build
on:
workflow_call:
inputs:
dev-image:
required: true
type: string
description: Base image for builds
runner:
required: false
type: string
description: Runner type for the test
default: linux.4xlarge
secrets:
torchxla-bot-token:
required: true
workflow_call:
inputs:
dev-image:
required: true
type: string
description: Base image for builds
runner:
required: false
type: string
description: Runner type for the test
default: linux.4xlarge
secrets:
torchxla-bot-token:
required: true
jobs:
build-docs:
runs-on: ubuntu-24.04
timeout-minutes: 45
container:
image: ${{ inputs.dev-image }}
env:
BRANCH_NAME: ${{ github.ref_name }}
steps:
- name: Fetch wheels
uses: actions/download-artifact@v4
with:
name: torch-xla-wheels
path: /tmp/wheels/
- name: Install wheels
shell: bash
run: |
pip install /tmp/wheels/*.whl
- name: Checkout PyTorch/XLA Repo
uses: actions/checkout@v4
with:
path: pytorch/xla
- name: Build docs
shell: bash
run: |
cd pytorch/xla/docs
pip install -r requirements.txt
sphinx-build -b html source build
- name: Checkout GitHub Pages
uses: actions/checkout@v4
with:
path: gh-pages
ref: gh-pages
token: ${{ github.event_name == 'push' && secrets.torchxla-bot-token || github.token }}
- name: Merge changes
shell: bash
run: |
subdir=${{ env.BRANCH_NAME == 'master' && 'master' || format('{0}/{1}', 'release', env.BRANCH_NAME) }}
mkdir -p gh-pages/$subdir
cp -fR pytorch/xla/docs/build/* gh-pages/$subdir
- name: Upload preview as artifact
uses: actions/upload-artifact@v4
with:
name: github-pages
path: pytorch/xla/docs/build/
- name: Deploy
shell: bash
run: |
cd gh-pages
git config user.email "pytorchxla@gmail.com"
git config user.name "torchxlabot2"
git add . -v
git diff --cached --exit-code || git commit -m "Update doc from commit ${{ github.sha }}"
git push origin gh-pages
build-docs:
runs-on: ubuntu-24.04
timeout-minutes: 45
container:
image: ${{ inputs.dev-image }}
env:
BRANCH_NAME: ${{ github.ref_name }}
steps:
- name: Fetch wheels
uses: actions/download-artifact@v5
with:
name: torch-xla-wheels
path: /tmp/wheels/
- name: Install wheels
shell: bash
run: |
pip install /tmp/wheels/*.whl
- name: Checkout PyTorch/XLA Repo
uses: actions/checkout@v4
with:
path: pytorch/xla
- name: Build docs
shell: bash
run: |
cd pytorch/xla/docs
pip install -r requirements.txt
sphinx-build -b html source build
- name: Checkout GitHub Pages
uses: actions/checkout@v4
with:
path: gh-pages
ref: gh-pages
token: ${{ github.event_name == 'push' && secrets.torchxla-bot-token || github.token }}
- name: Merge changes
shell: bash
run: |
subdir=${{ env.BRANCH_NAME == 'master' && 'master' || format('{0}/{1}', 'release', env.BRANCH_NAME) }}
mkdir -p gh-pages/$subdir
cp -fR pytorch/xla/docs/build/* gh-pages/$subdir
- name: Upload preview as artifact
uses: actions/upload-artifact@v4
with:
name: github-pages
path: pytorch/xla/docs/build/
- name: Deploy
shell: bash
run: |
cd gh-pages
git config user.email "pytorchxla@gmail.com"
git config user.name "torchxlabot2"
git add . -v
git diff --cached --exit-code || git commit -m "Update doc from commit ${{ github.sha }}"
git push origin gh-pages
Loading