|
45 | 45 | required: false |
46 | 46 | type: string |
47 | 47 | default: '' |
| 48 | + secrets: |
| 49 | + HF_TOKEN: |
| 50 | + required: true |
48 | 51 |
|
49 | 52 | permissions: |
50 | 53 | contents: read |
|
62 | 65 | github.event.inputs.target_device == 'tpu' || |
63 | 66 | github.event.inputs.target_device == 'gpu' |
64 | 67 | ) |
| 68 | + outputs: |
| 69 | + should_run: ${{ steps.check.outputs.should_run }} # Map the step output to the job level |
65 | 70 | steps: |
66 | 71 | - name: Check if build should run |
67 | 72 | id: check |
|
80 | 85 | INPUTS_IMAGE_NAME: ${{ inputs.image_name }} |
81 | 86 | INPUTS_BUILD_MODE: ${{ inputs.build_mode }} |
82 | 87 |
|
| 88 | + - name: Matrix Debugger |
| 89 | + run: | |
| 90 | + echo "device: ${{ inputs.device }}" |
| 91 | + echo "workflow: ${{ inputs.workflow }}" |
| 92 | + echo "build_mode: ${{ inputs.build_mode }}" |
| 93 | + echo "image_name: ${{ inputs.image_name }}" |
| 94 | + echo "dockerfile: ${{ inputs.dockerfile }}" |
| 95 | +
|
83 | 96 | - name: Checkout MaxText |
84 | 97 | uses: actions/checkout@v5 |
85 | 98 | if: steps.check.outputs.should_run == 'true' |
@@ -121,29 +134,81 @@ jobs: |
121 | 134 | LIBTPU_VERSION=NONE |
122 | 135 | INCLUDE_TEST_ASSETS=true |
123 | 136 |
|
| 137 | + test: |
| 138 | + needs: build_and_push |
| 139 | + if: | |
| 140 | + needs.build_and_push.result == 'success' && |
| 141 | + needs.build_and_push.outputs.should_run == 'true' |
| 142 | + strategy: |
| 143 | + fail-fast: false |
| 144 | + matrix: |
| 145 | + flavor: >- |
| 146 | + ${{ fromJSON('{ |
| 147 | + "gpu-pre-training": ["gpu-unit", "gpu-integration"], |
| 148 | + "tpu-post-training": ["tpu-post-training-unit", "tpu-post-training-integration", "cpu-post-training-unit"], |
| 149 | + "tpu-pre-training": ["tpu-unit", "tpu-integration", "cpu-unit"] |
| 150 | + }')[format('{0}-{1}', inputs.device, inputs.workflow)] }} |
| 151 | + uses: ./.github/workflows/run_tests_coordinator.yml |
| 152 | + with: |
| 153 | + flavor: ${{ matrix.flavor }} |
| 154 | + base_image: ${{ inputs.image_name }}:${{ github.run_id }} |
| 155 | + is_scheduled_run: true |
| 156 | + maxtext_installed: true |
| 157 | + |
| 158 | + notebook-test: |
| 159 | + needs: build_and_push |
| 160 | + if: | |
| 161 | + inputs.device == 'tpu' && |
| 162 | + inputs.workflow == 'post-training' && |
| 163 | + needs.build_and_push.result == 'success' && |
| 164 | + needs.build_and_push.outputs.should_run == 'true' |
| 165 | + uses: ./.github/workflows/run_jupyter_notebooks.yml |
| 166 | + with: |
| 167 | + device_type: tpu |
| 168 | + device_name: v6e-4 |
| 169 | + base_image: ${{ inputs.image_name }}:${{ github.run_id }} |
| 170 | + cloud_runner: linux-x86-ct6e-180-4tpu |
| 171 | + maxtext_installed: true |
| 172 | + secrets: |
| 173 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 174 | + |
| 175 | + tagging: |
| 176 | + needs: [test, notebook-test] |
| 177 | + if: | |
| 178 | + always() && |
| 179 | + needs.test.result == 'success' && |
| 180 | + (needs.notebook-test.result == 'success' || needs.notebook-test.result == 'skipped') |
| 181 | + runs-on: linux-x86-n2-16-buildkit |
| 182 | + container: google/cloud-sdk:524.0.0 |
| 183 | + steps: |
| 184 | + - name: Configure Docker |
| 185 | + run: gcloud auth configure-docker us-docker.pkg.dev,gcr.io -q |
| 186 | + |
124 | 187 | - name: Add tags to Docker image |
125 | | - if: steps.check.outputs.should_run == 'true' |
126 | 188 | shell: bash |
127 | 189 | run: | |
128 | 190 | SOURCE_IMAGE="gcr.io/tpu-prod-env-multipod/${INPUTS_IMAGE_NAME}" |
| 191 | + TEMP_IMG="${SOURCE_IMAGE}:${{ github.run_id }}" |
129 | 192 |
|
130 | 193 | if [[ $INPUTS_VERSION_NAME ]]; then |
131 | 194 | echo "Tagging docker images corresponding to PyPI release..." |
132 | | - gcloud container images add-tag "$SOURCE_IMAGE:${{ github.run_id }}" "$SOURCE_IMAGE:${INPUTS_VERSION_NAME}" --quiet |
| 195 | + gcloud container images add-tag "${TEMP_IMG}" "${SOURCE_IMAGE}:${INPUTS_VERSION_NAME}" --quiet |
133 | 196 | else |
134 | 197 | echo "Tagging docker images corresponding to nightly release..." |
135 | 198 |
|
136 | 199 | # Add date tag |
137 | | - gcloud container images add-tag "$SOURCE_IMAGE:${{ github.run_id }}" "$SOURCE_IMAGE:${INPUTS_IMAGE_DATE}" --quiet |
| 200 | + gcloud container images add-tag "${TEMP_IMG}" "$SOURCE_IMAGE:${INPUTS_IMAGE_DATE}" --quiet |
138 | 201 |
|
139 | 202 | # Convert date to YYYYMMDD format |
140 | 203 | clean_date=$(echo "${INPUTS_IMAGE_DATE}" | sed 's/[-:]//g' | cut -c1-8) |
141 | 204 |
|
142 | 205 | # Add MaxText tag |
143 | | - maxtext_hash=$(git rev-parse --short HEAD) |
144 | | - gcloud container images add-tag "$SOURCE_IMAGE:${{ github.run_id }}" "$SOURCE_IMAGE:maxtext_${maxtext_hash}_${clean_date}" --quiet |
| 206 | + gcloud container images add-tag "${TEMP_IMG}" "${SOURCE_IMAGE}:maxtext_${MAXTEXT_SHA}_${clean_date}" --quiet |
145 | 207 | fi |
| 208 | + # Latest Tag |
| 209 | + gcloud container images add-tag "${TEMP_IMG}" "${SOURCE_IMAGE}:latest" --quiet |
146 | 210 | env: |
147 | 211 | INPUTS_IMAGE_NAME: ${{ inputs.image_name }} |
148 | 212 | INPUTS_IMAGE_DATE: ${{ inputs.image_date }} |
149 | 213 | INPUTS_VERSION_NAME: ${{ inputs.version_name }} |
| 214 | + MAXTEXT_SHA: ${{ inputs.maxtext_sha }} |
0 commit comments