Skip to content

Commit 1d54eb6

Browse files
Merge pull request AI-Hypercomputer#3994 from AI-Hypercomputer:pypi_release
PiperOrigin-RevId: 937694295
2 parents dc59ef9 + 0adbeb6 commit 1d54eb6

8 files changed

Lines changed: 242 additions & 116 deletions

.github/workflows/build_and_push_docker_image.yml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ on:
3838
required: false
3939
type: string
4040
default: 'pre-training'
41-
version_name:
42-
required: false
43-
type: string
44-
default: ''
4541
include_test_assets:
4642
required: false
4743
type: boolean
4844
default: false
45+
outputs:
46+
build_result:
47+
description: 'The result of build_and_push job.'
48+
value: ${{ jobs.build_and_push.result }}
4949
secrets:
5050
HF_TOKEN:
5151
required: true
@@ -65,7 +65,8 @@ jobs:
6565
shell: bash
6666
run: |
6767
EVENT_NAME="${{ github.event_name }}"
68-
TARGET_DEVICE="${{ github.event.inputs.target_device }}"
68+
# Default to 'all' if the input is null/empty
69+
TARGET_DEVICE="${{ github.event.inputs.target_device || 'all' }}"
6970
INPUT_DEVICE="${{ inputs.device }}"
7071
7172
SHOULD_RUN="false"
@@ -121,6 +122,7 @@ jobs:
121122
uses: actions/download-artifact@v4
122123
with:
123124
name: maxtext-wheel
125+
path: .
124126

125127
- name: Install uv and set Python version
126128
uses: astral-sh/setup-uv@v7
@@ -166,26 +168,18 @@ jobs:
166168
SOURCE_IMAGE="gcr.io/${{ vars.PROJECT_NAME }}/${INPUTS_IMAGE_NAME}"
167169
TEMP_IMG="${SOURCE_IMAGE}:${{ github.run_id }}"
168170
169-
if [[ $INPUTS_VERSION_NAME ]]; then
170-
echo "Tagging docker images corresponding to PyPI release..."
171-
gcloud container images add-tag "${TEMP_IMG}" "${SOURCE_IMAGE}:${INPUTS_VERSION_NAME}" --quiet
172-
else
173-
echo "Tagging docker images corresponding to nightly release..."
174-
175-
# Add date tag
176-
IMAGE_DATE="$(date +%Y-%m-%d)"
177-
gcloud container images add-tag "${TEMP_IMG}" "$SOURCE_IMAGE:$IMAGE_DATE" --quiet
171+
# Add date tag
172+
IMAGE_DATE="$(date +%Y-%m-%d)"
173+
gcloud container images add-tag "${TEMP_IMG}" "$SOURCE_IMAGE:$IMAGE_DATE" --quiet
178174
179-
# Convert date to YYYYMMDD format
180-
clean_date=$(echo "$IMAGE_DATE" | sed 's/[-:]//g' | cut -c1-8)
175+
# Convert date to YYYYMMDD format
176+
clean_date=$(echo "$IMAGE_DATE" | sed 's/[-:]//g' | cut -c1-8)
181177
182-
# Add MaxText tag
183-
MAXTEXT_SHA=$(git rev-parse --short HEAD)
184-
gcloud container images add-tag "${TEMP_IMG}" "${SOURCE_IMAGE}:maxtext_${MAXTEXT_SHA}_${clean_date}" --quiet
185-
fi
178+
# Add MaxText tag
179+
MAXTEXT_SHA=$(git rev-parse --short HEAD)
180+
gcloud container images add-tag "${TEMP_IMG}" "${SOURCE_IMAGE}:maxtext_${MAXTEXT_SHA}_${clean_date}" --quiet
186181
env:
187182
INPUTS_IMAGE_NAME: ${{ inputs.image_name }}
188-
INPUTS_VERSION_NAME: ${{ inputs.version_name }}
189183

190184
run_ci_tests:
191185
name: Run Unit and Integration Tests

.github/workflows/build_package.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ on:
2929
cloud_runner:
3030
required: false
3131
type: string
32+
maxtext_sha:
33+
required: false
34+
type: string
3235
outputs:
3336
maxtext_sha:
3437
description: "MaxText short SHA used for the build"
@@ -45,12 +48,15 @@ jobs:
4548
steps:
4649
- name: Checkout MaxText
4750
uses: actions/checkout@v5
51+
with:
52+
ref: ${{ inputs.maxtext_sha || github.sha }}
4853
- name: Get metadata
4954
id: vars
5055
shell: bash
5156
run: |
5257
# MaxText SHA used to build the package
53-
echo "maxtext_sha=${GITHUB_SHA}" >> $GITHUB_OUTPUT
58+
MAXTEXT_SHA="${{ inputs.maxtext_sha || github.sha }}"
59+
echo "maxtext_sha=${MAXTEXT_SHA}" >> $GITHUB_OUTPUT
5460
- name: Install build tools
5561
run: |
5662
python -m pip install --upgrade pip build uv

.github/workflows/check_docs_build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
pull_request:
2121
types: [opened, synchronize]
2222
workflow_call:
23+
inputs:
24+
maxtext_sha:
25+
required: true
26+
type: string
2327
workflow_dispatch:
2428

2529
permissions:
@@ -34,10 +38,18 @@ jobs:
3438
with:
3539
persist-credentials: false
3640
fetch-depth: 0
41+
ref: ${{ inputs.maxtext_sha }}
3742

3843
- name: Check if only documentation changed
3944
id: check
4045
run: |
46+
# Force build_docs=true for non-pull-request events
47+
if [ "${{ github.event_name }}" != "pull_request" ]; then
48+
echo "Not a pull request, enabling docs build."
49+
echo "build_docs=true" >> $GITHUB_OUTPUT
50+
exit 0
51+
fi
52+
4153
git fetch origin ${GITHUB_BASE_REF}
4254
CHANGED_FILES=$(git diff --name-only origin/${GITHUB_BASE_REF}...HEAD)
4355

.github/workflows/ci_pipeline.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ name: MaxText Package Tests
2020
on:
2121
pull_request:
2222
workflow_call:
23+
inputs:
24+
maxtext_sha:
25+
description: 'The specific MaxText commit SHA.'
26+
required: true
27+
type: string
28+
outputs:
29+
tests_result:
30+
description: 'The result of all_tests_passed and all_notebooks_passed jobs.'
31+
value: ${{ (jobs.all_tests_passed.result == 'success' && jobs.all_notebooks_passed.result == 'success') && 'success' || 'failure' }}
2332
workflow_dispatch:
2433
schedule:
2534
# Run the job every 4 hours
@@ -48,6 +57,7 @@ jobs:
4857
- uses: actions/checkout@v4
4958
with:
5059
fetch-depth: 0
60+
ref: ${{ inputs.maxtext_sha || github.sha }}
5161
- name: Check for Code Changes
5262
id: check
5363
run: |
@@ -127,6 +137,7 @@ jobs:
127137
device_type: tpu
128138
device_name: v4-8
129139
cloud_runner: linux-x86-n2-16-buildkit
140+
maxtext_sha: ${{ inputs.maxtext_sha || github.sha }}
130141

131142
maxtext_jupyter_notebooks:
132143
needs: build_and_upload_maxtext_package

.github/workflows/docs_link_check.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ on:
2121
# Run every Monday at 9:00 AM UTC
2222
- cron: '0 9 * * 1'
2323
workflow_call:
24+
inputs:
25+
maxtext_sha:
26+
required: true
27+
type: string
2428
workflow_dispatch: # Allow manual triggering
2529

2630
permissions:
@@ -37,6 +41,7 @@ jobs:
3741
with:
3842
persist-credentials: false
3943
fetch-depth: 0
44+
ref: ${{ inputs.maxtext_sha }}
4045

4146
- name: Install uv and set the Python version
4247
uses: astral-sh/setup-uv@eb1897b8dc4b5d5bfe39a428a8f2304605e0983c # v7.0.0

0 commit comments

Comments
 (0)