|
1 | 1 | name: build-torch-xla
|
2 | 2 | on:
|
3 |
| - workflow_call: |
4 |
| - inputs: |
5 |
| - dev-image: |
6 |
| - required: true |
7 |
| - type: string |
8 |
| - description: Base image for builds |
9 |
| - torch-commit: |
10 |
| - required: true |
11 |
| - type: string |
12 |
| - description: torch-commit |
13 |
| - runner: |
14 |
| - required: false |
15 |
| - type: string |
16 |
| - description: Runner type for the test |
17 |
| - default: linux.12xlarge |
18 |
| - timeout-minutes: |
19 |
| - required: false |
20 |
| - type: number |
21 |
| - description: Timeout in minutes for the build job |
22 |
| - default: 45 # Takes ~20m as of 2025/5/30. |
23 |
| - has_code_changes: |
24 |
| - required: false |
25 |
| - type: string |
26 |
| - description: Whether to run full workflow or not |
27 |
| - default: 'true' |
28 |
| - secrets: |
29 |
| - gcloud-service-key: |
30 |
| - required: true |
31 |
| - description: Secret to access Bazel build cache |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + dev-image: |
| 6 | + required: true |
| 7 | + type: string |
| 8 | + description: Base image for builds |
| 9 | + torch-commit: |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + description: torch-commit |
| 13 | + runner: |
| 14 | + required: false |
| 15 | + type: string |
| 16 | + description: Runner type for the test |
| 17 | + default: linux.12xlarge |
| 18 | + timeout-minutes: |
| 19 | + required: false |
| 20 | + type: number |
| 21 | + description: Timeout in minutes for the build job |
| 22 | + default: 45 # Takes ~20m as of 2025/5/30. |
| 23 | + has_code_changes: |
| 24 | + required: false |
| 25 | + type: string |
| 26 | + description: Whether to run full workflow or not |
| 27 | + default: "true" |
| 28 | + secrets: |
| 29 | + gcloud-service-key: |
| 30 | + required: true |
| 31 | + description: Secret to access Bazel build cache |
32 | 32 | jobs:
|
33 |
| - build: |
34 |
| - runs-on: ${{ inputs.runner }} |
35 |
| - timeout-minutes: ${{ inputs.timeout-minutes }} |
36 |
| - container: |
37 |
| - image: ${{ inputs.dev-image }} |
38 |
| - env: |
39 |
| - GCLOUD_SERVICE_KEY: ${{ secrets.gcloud-service-key }} |
40 |
| - BAZEL_REMOTE_CACHE: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} |
41 |
| - BAZEL_JOBS: '' # Let bazel decide the parallelism based on the number of CPUs. |
42 |
| - BUILD_CPP_TESTS: 1 |
43 |
| - steps: |
44 |
| - # Need to check out local composite actions before using them |
45 |
| - # https://github.com/orgs/community/discussions/11771 |
46 |
| - - name: Checkout actions |
47 |
| - if: inputs.has_code_changes == 'true' |
48 |
| - uses: actions/checkout@v4 |
49 |
| - with: |
50 |
| - sparse-checkout: | |
51 |
| - .github/workflows/setup |
52 |
| - path: .actions |
53 |
| - - name: Setup |
54 |
| - if: inputs.has_code_changes == 'true' |
55 |
| - uses: ./.actions/.github/workflows/setup |
56 |
| - with: |
57 |
| - torch-commit: ${{ inputs.torch-commit }} |
58 |
| - - name: Build |
59 |
| - if: inputs.has_code_changes == 'true' |
60 |
| - shell: bash |
61 |
| - run: | |
62 |
| - cd pytorch/xla/infra/ansible |
63 |
| - 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 |
64 |
| - - name: Upload wheel |
65 |
| - if: inputs.has_code_changes == 'true' |
66 |
| - uses: actions/upload-artifact@v4 |
67 |
| - with: |
68 |
| - name: torch-xla-wheels |
69 |
| - path: /dist/*.whl |
70 |
| - - name: Upload CPP test binaries |
71 |
| - if: inputs.has_code_changes == 'true' |
72 |
| - uses: actions/upload-artifact@v4 |
73 |
| - with: |
74 |
| - name: cpp-test-bin |
75 |
| - path: /tmp/test/bin |
76 |
| - - name: Report no code changes |
77 |
| - if: inputs.has_code_changes == 'false' |
78 |
| - run: | |
79 |
| - echo "No code changes were detected that require running the full test suite." |
80 |
| -
|
| 33 | + build: |
| 34 | + runs-on: ${{ inputs.runner }} |
| 35 | + timeout-minutes: ${{ inputs.timeout-minutes }} |
| 36 | + container: |
| 37 | + image: ${{ inputs.dev-image }} |
| 38 | + env: |
| 39 | + GCLOUD_SERVICE_KEY: ${{ secrets.gcloud-service-key }} |
| 40 | + BAZEL_REMOTE_CACHE: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} |
| 41 | + BAZEL_JOBS: "" # Let bazel decide the parallelism based on the number of CPUs. |
| 42 | + BUILD_CPP_TESTS: 1 |
| 43 | + steps: |
| 44 | + # Need to check out local composite actions before using them |
| 45 | + # https://github.com/orgs/community/discussions/11771 |
| 46 | + - name: Checkout actions |
| 47 | + if: inputs.has_code_changes == 'true' |
| 48 | + uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + sparse-checkout: | |
| 51 | + .github/workflows/setup |
| 52 | + path: .actions |
| 53 | + - name: Setup |
| 54 | + if: inputs.has_code_changes == 'true' |
| 55 | + uses: ./.actions/.github/workflows/setup |
| 56 | + with: |
| 57 | + torch-commit: ${{ inputs.torch-commit }} |
| 58 | + - name: Build |
| 59 | + if: inputs.has_code_changes == 'true' |
| 60 | + shell: bash |
| 61 | + run: | |
| 62 | + cd pytorch/xla/infra/ansible |
| 63 | + 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 |
| 64 | + - name: Upload wheel |
| 65 | + if: inputs.has_code_changes == 'true' |
| 66 | + uses: actions/upload-artifact@v4 |
| 67 | + with: |
| 68 | + name: torch-xla-wheels |
| 69 | + path: /dist/*.whl |
| 70 | + - name: Upload CPP test binaries |
| 71 | + if: inputs.has_code_changes == 'true' |
| 72 | + uses: actions/upload-artifact@v4 |
| 73 | + with: |
| 74 | + name: cpp-test-bin |
| 75 | + path: /tmp/test/bin |
| 76 | + - name: Report no code changes |
| 77 | + if: inputs.has_code_changes == 'false' |
| 78 | + run: | |
| 79 | + echo "No code changes were detected that require running the full test suite." |
0 commit comments