Skip to content

Commit 0bf28b2

Browse files
Parallelize Valgrind tests to reduce Daily Runtime (valkey-io#4256)
The Valgrind jobs currently take over four hours and are the longest part of the Daily workflow. Split the server tests into three parallel shards: - unit - cluster - integration and type Each shard still uses `--clients 1`. Targeted manual runs can use the new `valgrind_test` input. A test run on the fork completed successfully, with the slowest shard taking about `1h35m` instead of roughly `4h30m`: Reduced runtime: https://github.com/sarthakaggarwal97/valkey/actions/runs/29949790077 Yesterday's Daiy Run: https://github.com/valkey-io/valkey/actions/runs/29880236491/job/88799264488 Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
1 parent 74249be commit 0bf28b2

1 file changed

Lines changed: 44 additions & 6 deletions

File tree

.github/workflows/daily.yml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ on:
2121
description: "tests to skip (delete the ones you wanna keep, do not leave empty)"
2222
default: "valkey,modules,sentinel,cluster,unittest,large-memory"
2323
test_args:
24-
description: "extra test arguments"
24+
description: "extra test arguments; use valgrind_test instead of --single for targeted valgrind runs"
25+
default: ""
26+
valgrind_test:
27+
description: "single test file or directory to run in valgrind jobs instead of the full shards"
2528
default: ""
2629
cluster_test_args:
2730
description: "extra cluster / sentinel test arguments"
@@ -45,7 +48,12 @@ on:
4548
type: string
4649
default: ""
4750
test_args:
48-
description: "extra test arguments"
51+
description: "extra test arguments; use valgrind_test instead of --single for targeted valgrind runs"
52+
required: false
53+
type: string
54+
default: ""
55+
valgrind_test:
56+
description: "single test file or directory to run in valgrind jobs instead of the full shards"
4957
required: false
5058
type: string
5159
default: ""
@@ -822,13 +830,18 @@ jobs:
822830
echo "$CACHE"
823831
if [ "$(( $CACHE-$CACHE0 ))" -gt "8000000" ]; then exit 1; fi
824832
test-valgrind-test:
833+
name: test-valgrind-test (${{ matrix.shard }})
825834
runs-on: ubuntu-latest
826835
if: |
827836
(github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' ||
828837
(github.event_name == 'schedule' && github.repository == 'valkey-io/valkey') ||
829838
(github.event_name == 'pull_request' && github.event.pull_request.base.ref != 'unstable' && github.event.action != 'labeled')) &&
830839
!contains(github.event.inputs.skipjobs, 'valgrind') && !contains(github.event.inputs.skiptests, 'valkey')
831840
timeout-minutes: 1440
841+
strategy:
842+
fail-fast: false
843+
matrix:
844+
shard: ${{ fromJSON(inputs.valgrind_test && '["targeted"]' || '["unit", "cluster", "integration-type"]') }}
832845
steps:
833846
- name: prep
834847
if: github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call'
@@ -858,12 +871,22 @@ jobs:
858871
sudo apt-get install tcl8.6 tclx valgrind -y
859872
- name: test
860873
if: true && !contains(github.event.inputs.skiptests, 'valkey')
861-
run: ./runtest --valgrind --no-latency --failures-output test-failures/valkey.json --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}}
874+
env:
875+
VALGRIND_TEST: ${{ inputs.valgrind_test }}
876+
run: |
877+
shard_args=()
878+
case "${{ matrix.shard }}" in
879+
unit) shard_args=(--single tests/unit) ;;
880+
cluster) shard_args=(--single tests/unit/cluster) ;;
881+
integration-type) shard_args=(--single tests/integration --single tests/unit/type) ;;
882+
targeted) shard_args=(--single "$VALGRIND_TEST") ;;
883+
esac
884+
./runtest --valgrind --no-latency --failures-output test-failures/valkey.json --verbose --clients 1 --timeout 2400 --dump-logs "${shard_args[@]}" ${{github.event.inputs.test_args}}
862885
- name: Upload test failures
863886
if: always()
864887
uses: ./.github/actions/upload-test-failures
865888
with:
866-
job-name: ${{ github.job }}
889+
job-name: ${{ github.job }}-${{ matrix.shard }}
867890
test-valgrind-misc:
868891
runs-on: ubuntu-latest
869892
if: |
@@ -920,13 +943,18 @@ jobs:
920943
with:
921944
job-name: ${{ github.job }}
922945
test-valgrind-no-malloc-usable-size-test:
946+
name: test-valgrind-no-malloc-usable-size-test (${{ matrix.shard }})
923947
runs-on: ubuntu-latest
924948
if: |
925949
(github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' ||
926950
(github.event_name == 'schedule' && github.repository == 'valkey-io/valkey') ||
927951
(github.event_name == 'pull_request' && github.event.pull_request.base.ref != 'unstable' && github.event.action != 'labeled')) &&
928952
!contains(github.event.inputs.skipjobs, 'valgrind') && !contains(github.event.inputs.skiptests, 'valkey')
929953
timeout-minutes: 1440
954+
strategy:
955+
fail-fast: false
956+
matrix:
957+
shard: ${{ fromJSON(inputs.valgrind_test && '["targeted"]' || '["unit", "cluster", "integration-type"]') }}
930958
steps:
931959
- name: prep
932960
if: github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call'
@@ -956,12 +984,22 @@ jobs:
956984
sudo apt-get install tcl8.6 tclx valgrind -y
957985
- name: test
958986
if: true && !contains(github.event.inputs.skiptests, 'valkey')
959-
run: ./runtest --valgrind --no-latency --failures-output test-failures/valkey.json --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}}
987+
env:
988+
VALGRIND_TEST: ${{ inputs.valgrind_test }}
989+
run: |
990+
shard_args=()
991+
case "${{ matrix.shard }}" in
992+
unit) shard_args=(--single tests/unit) ;;
993+
cluster) shard_args=(--single tests/unit/cluster) ;;
994+
integration-type) shard_args=(--single tests/integration --single tests/unit/type) ;;
995+
targeted) shard_args=(--single "$VALGRIND_TEST") ;;
996+
esac
997+
./runtest --valgrind --no-latency --failures-output test-failures/valkey.json --verbose --clients 1 --timeout 2400 --dump-logs "${shard_args[@]}" ${{github.event.inputs.test_args}}
960998
- name: Upload test failures
961999
if: always()
9621000
uses: ./.github/actions/upload-test-failures
9631001
with:
964-
job-name: ${{ github.job }}
1002+
job-name: ${{ github.job }}-${{ matrix.shard }}
9651003
test-valgrind-no-malloc-usable-size-misc:
9661004
runs-on: ubuntu-latest
9671005
if: |

0 commit comments

Comments
 (0)