Skip to content

Commit d8f1261

Browse files
Use Docker images with pre-installed Python.
PiperOrigin-RevId: 747629854
1 parent 3b359ba commit d8f1261

File tree

1 file changed

+52
-38
lines changed

1 file changed

+52
-38
lines changed

Diff for: .github/workflows/ci-build.yaml

+52-38
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ on:
1515
pull_request:
1616
branches:
1717
- main
18+
workflow_dispatch:
19+
inputs:
20+
halt-for-connection:
21+
description: 'Should this workflow run wait for a remote connection?'
22+
type: choice
23+
required: true
24+
default: 'no'
25+
options:
26+
- 'yes'
27+
- 'no'
1828

1929
permissions:
2030
contents: read # to fetch code
@@ -27,18 +37,17 @@ concurrency:
2737
jobs:
2838
lint_and_typecheck:
2939
runs-on: ubuntu-latest
40+
container:
41+
image: index.docker.io/library/python@sha256:f1b2d06ef5b302a63c5e49d7c4842f1e32ce0c94b7d69acece00e31c4a736c53 # ratchet:python:3.12-bookworm
3042
timeout-minutes: 5
3143
steps:
3244
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33-
- name: Set up Python 3.11
34-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
35-
with:
36-
python-version: 3.11
3745
- run: python -m pip install pre-commit
38-
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
46+
- run: git config --global --add safe.directory '*'
47+
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
3948
with:
4049
path: ~/.cache/pre-commit
41-
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml', 'setup.py') }}
50+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml', 'setup.py') }}
4251
- run: pre-commit run --show-diff-on-failure --color=always --all-files
4352

4453
build:
@@ -47,7 +56,7 @@ jobs:
4756
name: "build ${{ matrix.name-prefix }} (py ${{ matrix.python-version }} on ubuntu-20.04, x64=${{ matrix.enable-x64}})"
4857
runs-on: linux-x86-n2-32
4958
container:
50-
image: index.docker.io/library/ubuntu@sha256:6d8d9799fe6ab3221965efac00b4c34a2bcc102c086a58dff9e19a08b913c7ef # ratchet:ubuntu:20.04
59+
image: python:${{ matrix.python-version }}-bookworm
5160
timeout-minutes: 60
5261
strategy:
5362
matrix:
@@ -58,26 +67,48 @@ jobs:
5867
enable-x64: 1
5968
prng-upgrade: 1
6069
num_generated_cases: 1
70+
# DO_NOT_SUBMIT - running this a lot to try and catch a failure.
71+
inc: 0
6172
- name-prefix: "with 3.13"
6273
python-version: "3.13"
6374
enable-x64: 0
6475
prng-upgrade: 0
6576
num_generated_cases: 1
77+
# DO_NOT_SUBMIT - running this a lot to try and catch a failure.
78+
- name-prefix: "with 3.10"
79+
python-version: "3.10"
80+
enable-x64: 1
81+
prng-upgrade: 1
82+
num_generated_cases: 1
83+
inc: 1
84+
- name-prefix: "with 3.10"
85+
python-version: "3.10"
86+
enable-x64: 1
87+
prng-upgrade: 1
88+
num_generated_cases: 1
89+
inc: 2
90+
- name-prefix: "with 3.10"
91+
python-version: "3.10"
92+
enable-x64: 1
93+
prng-upgrade: 1
94+
num_generated_cases: 1
95+
inc: 3
96+
- name-prefix: "with 3.10"
97+
python-version: "3.10"
98+
enable-x64: 1
99+
prng-upgrade: 1
100+
num_generated_cases: 1
101+
inc: 4
66102
steps:
67103
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
68-
- name: Image Setup
69-
run: |
70-
apt update
71-
apt install -y libssl-dev
72-
- name: Set up Python ${{ matrix.python-version }}
73-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
74-
with:
75-
python-version: ${{ matrix.python-version }}
76104
- name: Install dependencies
77105
run: |
78106
pip install uv~=0.5.30
79107
uv pip install --system .[minimum-jaxlib] -r build/test-requirements.txt
80-
108+
- name: Wait For Connection
109+
uses: google-ml-infra/actions/ci_connection@main
110+
with:
111+
halt-dispatch-input: ${{ inputs.halt-for-connection }}
81112
- name: Run tests
82113
env:
83114
JAX_NUM_GENERATED_CASES: ${{ matrix.num_generated_cases }}
@@ -102,15 +133,13 @@ jobs:
102133
name: Documentation - test code snippets
103134
runs-on: ubuntu-latest
104135
timeout-minutes: 10
136+
container:
137+
image: python:${{ matrix.python-version }}-bookworm
105138
strategy:
106139
matrix:
107140
python-version: ['3.10']
108141
steps:
109142
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
110-
- name: Set up Python ${{ matrix.python-version }}
111-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
112-
with:
113-
python-version: ${{ matrix.python-version }}
114143
- name: Install dependencies
115144
run: |
116145
pip install uv~=0.5.30
@@ -130,21 +159,12 @@ jobs:
130159
name: Documentation - render documentation
131160
runs-on: linux-x86-n2-16
132161
container:
133-
image: index.docker.io/library/ubuntu@sha256:6d8d9799fe6ab3221965efac00b4c34a2bcc102c086a58dff9e19a08b913c7ef # ratchet:ubuntu:20.04
134-
timeout-minutes: 10
162+
image: python:${{ matrix.python-version }}-bookworm
135163
strategy:
136164
matrix:
137165
python-version: ['3.10']
138166
steps:
139167
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
140-
- name: Image Setup
141-
run: |
142-
apt update
143-
apt install -y libssl-dev libsqlite3-dev build-essential
144-
- name: Set up Python ${{ matrix.python-version }}
145-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
146-
with:
147-
python-version: ${{ matrix.python-version }}
148168
- name: Install dependencies
149169
run: |
150170
pip install uv~=0.5.30
@@ -156,6 +176,8 @@ jobs:
156176
jax2tf_test:
157177
name: "jax2tf_test (py ${{ matrix.python-version }} on ${{ matrix.os }}, x64=${{ matrix.enable-x64}})"
158178
runs-on: ${{ matrix.os }}
179+
container:
180+
image: python:${{ matrix.python-version }}-bookworm
159181
timeout-minutes: 30
160182
strategy:
161183
matrix:
@@ -167,10 +189,6 @@ jobs:
167189
num_generated_cases: 10
168190
steps:
169191
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
170-
- name: Set up Python ${{ matrix.python-version }}
171-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
172-
with:
173-
python-version: ${{ matrix.python-version }}
174192
- name: Install dependencies
175193
run: |
176194
pip install uv~=0.5.30
@@ -200,10 +218,6 @@ jobs:
200218
timeout-minutes: 30
201219
steps:
202220
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
203-
- name: Set up Python
204-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
205-
with:
206-
python-version: 3.12
207221
- name: Install JAX
208222
run: |
209223
pip install uv~=0.5.30

0 commit comments

Comments
 (0)