Skip to content

Commit 29e90a3

Browse files
nitins17Google-ML-Automation
authored andcommitted
Add a presubmit check to test against oldest supported numpy
PiperOrigin-RevId: 738525650
1 parent 362fb7a commit 29e90a3

File tree

3 files changed

+81
-19
lines changed

3 files changed

+81
-19
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# CI - Oldest Supported NumPy (presubmit)
2+
# This workflow tests the oldest supported NumPy and jaxlib versions.
3+
4+
name: CI - Oldest Supported NumPy (presubmit)
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- main
10+
push:
11+
branches:
12+
- main
13+
- 'release/**'
14+
15+
# This should also be set to read-only in the project settings, but it's nice to
16+
# document and enforce the permissions here.
17+
permissions:
18+
contents: read
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
22+
# Don't cancel in-progress jobs for main/release branches.
23+
cancel-in-progress: ${{ !contains(github.ref, 'release/') && github.ref != 'main' }}
24+
25+
jobs:
26+
test-oldest-supported-numpy:
27+
if: github.event.repository.fork == false
28+
defaults:
29+
run:
30+
shell: bash
31+
runs-on: "linux-x86-n2-64"
32+
container: "us-central1-docker.pkg.dev/tensorflow-sigs/tensorflow/ml-build:latest"
33+
# Begin Presubmit Naming Check - name modification requires internal check to be updated
34+
name: "CI - Oldest Supported NumPy (Python 3.10, x64=0)"
35+
# End Presubmit Naming Check github-oldest-supported-numpy-presubmit
36+
37+
env:
38+
JAXCI_PYTHON: "python3.10"
39+
JAXCI_ENABLE_X64: 0
40+
JAX_NUM_GENERATED_CASES: 5
41+
42+
steps:
43+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
44+
- name: Install Python dependencies
45+
run: |
46+
$JAXCI_PYTHON -m uv pip install -r build/test-requirements.txt
47+
48+
# Install NumPy and SciPy with the oldest supported versions
49+
$JAXCI_PYTHON -m uv pip install numpy==1.25.2 scipy==1.11.1
50+
51+
# Install JAX using the changes in the PR
52+
$JAXCI_PYTHON -m uv pip install -e .[minimum-jaxlib]
53+
# Halt for testing
54+
- name: Wait For Connection
55+
uses: google-ml-infra/actions/ci_connection@main
56+
with:
57+
halt-dispatch-input: ${{ inputs.halt-for-connection }}
58+
- name: Run Pytest CPU tests
59+
timeout-minutes: 30
60+
run: ./ci/run_pytest_cpu.sh

ci/run_pytest_cpu.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ set -exu -o history -o allexport
2626
# Source default JAXCI environment variables.
2727
source ci/envs/default.env
2828

29+
# Set up the build environment.
30+
source "ci/utilities/setup_build_environment.sh"
31+
2932
# Install jaxlib wheel inside the $JAXCI_OUTPUT_DIR directory on the system.
3033
echo "Installing wheels locally..."
3134
source ./ci/utilities/install_wheels_locally.sh
3235

33-
# Set up the build environment.
34-
source "ci/utilities/setup_build_environment.sh"
35-
3636
# Print all the installed packages
3737
echo "Installed packages:"
3838
"$JAXCI_PYTHON" -m uv pip list

ci/utilities/install_wheels_locally.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,25 @@ for i in "${!WHEELS[@]}"; do
3030
fi
3131
done
3232

33-
if [[ -z "${WHEELS[@]}" ]]; then
34-
echo "ERROR: No wheels found under $JAXCI_OUTPUT_DIR"
35-
exit 1
36-
fi
33+
if [[ -n "${WHEELS[@]}" ]]; then
34+
echo "Installing the following wheels:"
35+
echo "${WHEELS[@]}"
3736

38-
echo "Installing the following wheels:"
39-
echo "${WHEELS[@]}"
40-
41-
# Install `uv` if it's not already installed. `uv` is much faster than pip for
42-
# installing Python packages.
43-
if ! command -v uv >/dev/null 2>&1; then
44-
pip install uv~=0.5.30
45-
fi
37+
# Install `uv` if it's not already installed. `uv` is much faster than pip for
38+
# installing Python packages.
39+
if ! command -v uv >/dev/null 2>&1; then
40+
pip install uv~=0.5.30
41+
fi
4642

47-
# On Windows, convert MSYS Linux-like paths to Windows paths.
48-
if [[ $(uname -s) =~ "MSYS_NT" ]]; then
49-
"$JAXCI_PYTHON" -m uv pip install $(cygpath -w "${WHEELS[@]}")
43+
# On Windows, convert MSYS Linux-like paths to Windows paths.
44+
if [[ $(uname -s) =~ "MSYS_NT" ]]; then
45+
"$JAXCI_PYTHON" -m uv pip install $(cygpath -w "${WHEELS[@]}")
46+
else
47+
"$JAXCI_PYTHON" -m uv pip install "${WHEELS[@]}"
48+
fi
5049
else
51-
"$JAXCI_PYTHON" -m uv pip install "${WHEELS[@]}"
50+
# Note that we don't exit here because the wheels may have been installed
51+
# earlier in a different step in the CI job.
52+
echo "INFO: No wheels found under $JAXCI_OUTPUT_DIR"
53+
echo "INFO: Skipping local wheel installation."
5254
fi

0 commit comments

Comments
 (0)