|
| 1 | +# CI - Bazel build wheels (RBE) |
| 2 | +# |
| 3 | +# This workflow builds all jax wheels using Bazel. |
| 4 | +# |
| 5 | +# It consists of the following jobs: |
| 6 | +# build-jax-artifact: |
| 7 | +# - Builds the jax artifact from source via build.py invocation. Uses build_artifacts.yml. |
| 8 | +# build-jaxlib-artifact: |
| 9 | +# - Builds the jaxlib artifact from source via build.py invocation. Uses build_artifacts.yml. |
| 10 | +# build-cuda-artifacts: |
| 11 | +# - Builds the cuda artifacts from source via build.py invocation. Uses build_artifacts.yml. |
| 12 | + |
| 13 | +name: CI - Bazel build wheels (RBE) |
| 14 | + |
| 15 | +on: |
| 16 | + workflow_dispatch: # allows triggering the workflow run manually |
| 17 | + inputs: |
| 18 | + runners: |
| 19 | + description: "Which runners should the workflow run on? Format example: '[\"linux-x86-n4-16\", \"linux-arm64-c4a-16\"]'" |
| 20 | + type: string |
| 21 | + default: '["linux-x86-n4-16"]' |
| 22 | + artifacts: |
| 23 | + description: "Which JAX artifacts to build? Format example: '[\"jaxlib\", \"jax\"]'" |
| 24 | + type: string |
| 25 | + default: '["jaxlib"]' |
| 26 | + python-versions: |
| 27 | + description: "Which python versions should the artifact be built for? Format example: '[\"3.12\", \"3.13\"]'" |
| 28 | + type: string |
| 29 | + default: '["3.12"]' |
| 30 | + cuda-versions: |
| 31 | + description: "Which cuda versions should the artifact be built for? Format example: '[\"12\", \"13\"]'" |
| 32 | + type: string |
| 33 | + default: '["12"]' |
| 34 | + clone_main_xla: |
| 35 | + description: "Should latest XLA be used?" |
| 36 | + type: choice |
| 37 | + default: "0" |
| 38 | + options: |
| 39 | + - "1" |
| 40 | + - "0" |
| 41 | + halt-for-connection: |
| 42 | + description: 'Should this workflow run wait for a remote connection?' |
| 43 | + type: choice |
| 44 | + default: 'no' |
| 45 | + options: |
| 46 | + - 'yes' |
| 47 | + - 'no' |
| 48 | + workflow_call: |
| 49 | + inputs: |
| 50 | + runners: |
| 51 | + description: "Which runners should the workflow run on?" |
| 52 | + type: string |
| 53 | + default: '["linux-x86-n2-16"]' |
| 54 | + artifacts: |
| 55 | + description: "Which JAX artifacts to build?" |
| 56 | + type: string |
| 57 | + default: '["jaxlib"]' |
| 58 | + python-versions: |
| 59 | + description: "Which python versions should the artifact be built for?" |
| 60 | + type: string |
| 61 | + default: '["3.12"]' |
| 62 | + cuda-versions: |
| 63 | + description: "Which cuda versions should the artifact be built for?" |
| 64 | + type: string |
| 65 | + default: '["12"]' |
| 66 | + upload_artifacts_to_gcs: |
| 67 | + description: "Should the artifacts be uploaded to a GCS bucket?" |
| 68 | + default: true |
| 69 | + type: boolean |
| 70 | + gcs_upload_uri: |
| 71 | + description: "GCS location prefix to where the artifacts should be uploaded" |
| 72 | + default: 'gs://general-ml-ci-transient/jax-github-actions/jax/${{ github.workflow }}/${{ github.run_number }}/${{ github.run_attempt }}' |
| 73 | + type: string |
| 74 | + clone_main_xla: |
| 75 | + description: "Should latest XLA be used?" |
| 76 | + type: string |
| 77 | + default: "0" |
| 78 | + outputs: |
| 79 | + gcs_upload_uri: |
| 80 | + description: "GCS location prefix to where the artifacts were uploaded" |
| 81 | + value: ${{ jobs.build-jax-artifact.outputs.gcs_upload_uri }} |
| 82 | + |
| 83 | +permissions: {} |
| 84 | + |
| 85 | +jobs: |
| 86 | + build-jax-artifact: |
| 87 | + if: ${{ contains(fromJSON(inputs.artifacts), 'jax') && contains(fromJSON(inputs.runners), 'linux-x86-n4-16') }} |
| 88 | + uses: ./.github/workflows/build_artifacts.yml |
| 89 | + name: "Build jax artifact" |
| 90 | + strategy: |
| 91 | + fail-fast: false # don't cancel all jobs on failure |
| 92 | + with: |
| 93 | + # Note that since jax is a pure python package, the runner OS and Python values do not |
| 94 | + # matter. In addition, cloning main XLA also has no effect. |
| 95 | + runner: "linux-x86-n4-16" |
| 96 | + python: "3.12" |
| 97 | + artifact: "jax" |
| 98 | + clone_main_xla: 0 |
| 99 | + upload_artifacts_to_gcs: ${{ inputs.upload_artifacts_to_gcs }} |
| 100 | + gcs_upload_uri: ${{ inputs.gcs_upload_uri }} |
| 101 | + |
| 102 | + build-jaxlib-artifact: |
| 103 | + if: ${{ contains(fromJSON(inputs.artifacts), 'jaxlib') }} |
| 104 | + uses: ./.github/workflows/build_artifacts.yml |
| 105 | + # Note: For reasons unknown, Github actions groups jobs with the same top-level name in the |
| 106 | + # dashboard only if we use an expression in the "name" field. Otherwise, it appends the matrix |
| 107 | + # values to the name and creates a separate entry for each matrix combination. |
| 108 | + name: "Build ${{ format('{0}', 'jaxlib') }} artifacts" |
| 109 | + strategy: |
| 110 | + fail-fast: false # don't cancel all jobs on failure |
| 111 | + matrix: |
| 112 | + runner: ${{ fromJSON(inputs.runners) }} |
| 113 | + python: ${{ fromJSON(inputs.python-versions) }} |
| 114 | + exclude: |
| 115 | + - runner: "windows-x86-n2-16" |
| 116 | + python: "3.14-nogil" |
| 117 | + - runner: "windows-x86-n2-16" |
| 118 | + python: "3.13-nogil" |
| 119 | + with: |
| 120 | + runner: ${{ matrix.runner }} |
| 121 | + artifact: "jaxlib" |
| 122 | + python: ${{ matrix.python }} |
| 123 | + clone_main_xla: ${{ inputs.clone_main_xla }} |
| 124 | + upload_artifacts_to_gcs: ${{ inputs.upload_artifacts_to_gcs }} |
| 125 | + gcs_upload_uri: ${{ inputs.gcs_upload_uri }} |
| 126 | + |
| 127 | + build-cuda-artifacts: |
| 128 | + if: ${{ (contains(fromJSON(inputs.artifacts), 'jax-cuda-plugin') || contains(fromJSON(inputs.artifacts), 'jax-cuda-pjrt')) }} |
| 129 | + uses: ./.github/workflows/build_artifacts.yml |
| 130 | + strategy: |
| 131 | + fail-fast: false # don't cancel all jobs on failure |
| 132 | + matrix: |
| 133 | + runner: ${{ fromJSON(inputs.runners) }} |
| 134 | + python: ${{ fromJSON(inputs.python-versions) }} |
| 135 | + artifact: ${{ fromJSON(inputs.artifacts) }} |
| 136 | + cuda-version: ${{ fromJSON(inputs.cuda-versions) }} |
| 137 | + exclude: |
| 138 | + - runner: "windows-x86-n2-16" |
| 139 | + name: "Build ${{ format('{0}', 'CUDA') }} artifacts" |
| 140 | + with: |
| 141 | + runner: ${{ matrix.runner }} |
| 142 | + artifact: ${{ matrix.artifact }} |
| 143 | + python: ${{ matrix.python }} |
| 144 | + cuda-version: ${{ matrix.cuda-version }} |
| 145 | + clone_main_xla: ${{ inputs.clone_main_xla }} |
| 146 | + upload_artifacts_to_gcs: ${{ inputs.upload_artifacts_to_gcs }} |
| 147 | + gcs_upload_uri: ${{ inputs.gcs_upload_uri }} |
0 commit comments