Skip to content

Commit ff51936

Browse files
committed
Shard CI tests across 4 parallel jobs per backend to reduce wall-clock time
1 parent adb6d50 commit ff51936

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/actions.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,23 @@ concurrency:
1616

1717
jobs:
1818
run_tests:
19-
name: Test the code
19+
name: Test the code (${{ matrix.backend }}, ${{ matrix.version }}, shard ${{ matrix.shard }})
2020
strategy:
2121
fail-fast: false
2222
matrix:
2323
backend: [tensorflow, jax, torch]
2424
version: [keras-stable]
25+
shard: [0, 1, 2, 3]
2526
include:
2627
- backend: jax
2728
version: keras-3.15
29+
shard: 0
2830
- backend: jax
2931
version: keras-nightly
32+
shard: 0
3033
- backend: openvino
3134
version: keras-nightly
35+
shard: 0
3236

3337
container:
3438
image: python:3.11-slim
@@ -65,13 +69,14 @@ jobs:
6569
pip install keras-nightly --no-cache-dir --progress-bar off
6670
- name: Test with pytest
6771
run: |
68-
pytest keras_hub/ -n auto --dist loadfile --durations=50
72+
pytest keras_hub/ -n auto --dist loadfile --durations=50 --shard-id=${{ matrix.shard }} --num-shards=4
6973
- name: Run integration tests
74+
if: ${{ matrix.shard == 0 }}
7075
run: |
7176
python pip_build.py --install
7277
cd integration_tests && pytest . -k "not NoTensorflow"
7378
- name: Run no tensorflow integration test
74-
if: ${{ matrix.backend != 'tensorflow'}}
79+
if: ${{ matrix.backend != 'tensorflow' && matrix.shard == 0 }}
7580
run: |
7681
pip uninstall -y tensorflow-text tensorflow
7782
cd integration_tests && pytest . -k "NoTensorflow"

requirements-common.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ruff
1414
pytest
1515
pytest-cov
1616
pytest-xdist
17+
pytest-shard
1718
build
1819
namex
1920
# Optional deps.

0 commit comments

Comments
 (0)