Skip to content

Commit 81cab40

Browse files
authored
Shard Windows IT jobs to speed up 1C1D and Table 1C1D CI (#17692)
1 parent 2f57fd6 commit 81cab40

2 files changed

Lines changed: 130 additions & 30 deletions

File tree

.github/workflows/cluster-it-1c1d.yml

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,52 @@ env:
3030
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
3131

3232
jobs:
33-
Simple:
33+
# Ubuntu runs all ITs in a single job (already fast at ~49 min)
34+
Ubuntu:
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- uses: actions/checkout@v5
39+
- name: Set up JDK
40+
uses: actions/setup-java@v5
41+
with:
42+
distribution: corretto
43+
java-version: 17
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
- name: Cache Maven packages
47+
uses: actions/cache@v5
48+
with:
49+
path: ~/.m2
50+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
51+
restore-keys: ${{ runner.os }}-m2-
52+
- name: Adjust Linux kernel somaxconn
53+
shell: bash
54+
run: sudo sysctl -w net.core.somaxconn=65535
55+
- name: IT/UT Test
56+
shell: bash
57+
run: |
58+
mvn clean verify \
59+
-P with-integration-tests \
60+
-DskipUTs \
61+
-DintegrationTest.forkCount=2 \
62+
-pl integration-test \
63+
-am
64+
- name: Upload Artifact
65+
if: failure()
66+
uses: actions/upload-artifact@v6
67+
with:
68+
name: standalone-log-Linux
69+
path: integration-test/target/cluster-logs
70+
retention-days: 1
71+
72+
# Windows is ~77% slower than Ubuntu, so split into 3 shards to parallelize
73+
Windows:
3474
strategy:
3575
fail-fast: false
36-
max-parallel: 15
3776
matrix:
38-
os: [ubuntu-latest, windows-latest]
39-
runs-on: ${{ matrix.os }}
77+
shard: [0, 1, 2]
78+
runs-on: windows-latest
4079

4180
steps:
4281
- uses: actions/checkout@v5
@@ -54,36 +93,47 @@ jobs:
5493
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
5594
restore-keys: ${{ runner.os }}-m2-
5695
- name: Adjust network dynamic TCP ports range
57-
if: ${{ runner.os == 'Windows' }}
5896
shell: pwsh
5997
run: |
6098
netsh int ipv4 set dynamicport tcp start=32768 num=32768
6199
netsh int ipv4 set dynamicport udp start=32768 num=32768
62100
netsh int ipv6 set dynamicport tcp start=32768 num=32768
63101
netsh int ipv6 set dynamicport udp start=32768 num=32768
64-
- name: Adjust Linux kernel somaxconn
65-
if: ${{ runner.os == 'Linux' }}
102+
- name: Build IT shard list
66103
shell: bash
67-
run: sudo sysctl -w net.core.somaxconn=65535
68-
# - name: Adjust Mac kernel somaxconn
69-
# if: ${{ runner.os == 'macOS' }}
70-
# shell: bash
71-
# run: sudo sysctl -w kern.ipc.somaxconn=65535
104+
# Distribute LocalStandaloneIT test classes across 3 shards using hash-mod assignment.
105+
# The list is written to a file so failsafe.includesFile can read it without command-line length limits.
106+
run: |
107+
set -euo pipefail
108+
SHARD=${{ matrix.shard }}
109+
TOTAL=3
110+
# Write outside the repo so Apache RAT (license check) doesn't flag the file.
111+
# Using a single grep -rl call instead of `find | xargs grep`: on Windows Git Bash,
112+
# ARG_MAX is small so xargs batches the file list, and any batch with no matches
113+
# makes grep exit 1, which makes xargs exit 123 and trips `set -o pipefail`.
114+
grep -rlE --include='*IT.java' '\bLocalStandaloneIT\b' integration-test/src/test/java \
115+
| awk -F'/' '{print $NF}' | sed 's/\.java$//' \
116+
| sort \
117+
| awk -v s=$SHARD -v t=$TOTAL 'NR%t==s' \
118+
> "$RUNNER_TEMP/it-shard.txt"
119+
echo "Shard $SHARD/$TOTAL contains $(wc -l < "$RUNNER_TEMP/it-shard.txt") test classes"
120+
head -5 "$RUNNER_TEMP/it-shard.txt"
72121
- name: IT/UT Test
73122
shell: bash
74-
# we do not compile client-cpp for saving time, it is tested in client.yml
75-
# we can skip influxdb-protocol because it has been tested separately in influxdb-protocol.yml
76123
run: |
77124
mvn clean verify \
78125
-P with-integration-tests \
79126
-DskipUTs \
80127
-DintegrationTest.forkCount=2 \
128+
-Dfailsafe.includesFile="$RUNNER_TEMP/it-shard.txt" \
129+
-DfailIfNoTests=false \
130+
-Dfailsafe.failIfNoSpecifiedTests=false \
81131
-pl integration-test \
82132
-am
83133
- name: Upload Artifact
84134
if: failure()
85135
uses: actions/upload-artifact@v6
86136
with:
87-
name: standalone-log-java${{ matrix.java }}-${{ runner.os }}
137+
name: standalone-log-Windows-shard${{ matrix.shard }}
88138
path: integration-test/target/cluster-logs
89139
retention-days: 1

.github/workflows/table-cluster-it-1c1d.yml

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,52 @@ env:
3131
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
3232

3333
jobs:
34-
Simple:
34+
# Ubuntu runs all ITs in a single job (already fast at ~39 min)
35+
Ubuntu:
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- uses: actions/checkout@v5
40+
- name: Set up JDK
41+
uses: actions/setup-java@v5
42+
with:
43+
distribution: corretto
44+
java-version: 17
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
- name: Cache Maven packages
48+
uses: actions/cache@v5
49+
with:
50+
path: ~/.m2
51+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
52+
restore-keys: ${{ runner.os }}-m2-
53+
- name: Adjust Linux kernel somaxconn
54+
shell: bash
55+
run: sudo sysctl -w net.core.somaxconn=65535
56+
- name: IT/UT Test
57+
shell: bash
58+
run: |
59+
mvn clean verify \
60+
-P with-integration-tests \
61+
-DskipUTs \
62+
-DintegrationTest.forkCount=2 -DDataNodeMaxHeapSize=1024 \
63+
-pl integration-test \
64+
-am -PTableSimpleIT
65+
- name: Upload Artifact
66+
if: failure()
67+
uses: actions/upload-artifact@v6
68+
with:
69+
name: table-standalone-log-Linux
70+
path: integration-test/target/cluster-logs
71+
retention-days: 1
72+
73+
# Windows is ~67% slower than Ubuntu, so split into 3 shards to parallelize
74+
Windows:
3575
strategy:
3676
fail-fast: false
37-
max-parallel: 15
3877
matrix:
39-
os: [ubuntu-latest, windows-latest]
40-
runs-on: ${{ matrix.os }}
78+
shard: [0, 1, 2]
79+
runs-on: windows-latest
4180

4281
steps:
4382
- uses: actions/checkout@v5
@@ -55,36 +94,47 @@ jobs:
5594
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
5695
restore-keys: ${{ runner.os }}-m2-
5796
- name: Adjust network dynamic TCP ports range
58-
if: ${{ runner.os == 'Windows' }}
5997
shell: pwsh
6098
run: |
6199
netsh int ipv4 set dynamicport tcp start=32768 num=32768
62100
netsh int ipv4 set dynamicport udp start=32768 num=32768
63101
netsh int ipv6 set dynamicport tcp start=32768 num=32768
64102
netsh int ipv6 set dynamicport udp start=32768 num=32768
65-
- name: Adjust Linux kernel somaxconn
66-
if: ${{ runner.os == 'Linux' }}
103+
- name: Build IT shard list
67104
shell: bash
68-
run: sudo sysctl -w net.core.somaxconn=65535
69-
# - name: Adjust Mac kernel somaxconn
70-
# if: ${{ runner.os == 'macOS' }}
71-
# shell: bash
72-
# run: sudo sysctl -w kern.ipc.somaxconn=65535
105+
# Distribute TableLocalStandaloneIT test classes across 3 shards using hash-mod assignment.
106+
# The list is written to a file so failsafe.includesFile can read it without command-line length limits.
107+
run: |
108+
set -euo pipefail
109+
SHARD=${{ matrix.shard }}
110+
TOTAL=3
111+
# Write outside the repo so Apache RAT (license check) doesn't flag the file.
112+
# Using a single grep -rl call instead of `find | xargs grep`: on Windows Git Bash,
113+
# ARG_MAX is small so xargs batches the file list, and any batch with no matches
114+
# makes grep exit 1, which makes xargs exit 123 and trips `set -o pipefail`.
115+
grep -rl --include='*IT.java' 'TableLocalStandaloneIT' integration-test/src/test/java \
116+
| awk -F'/' '{print $NF}' | sed 's/\.java$//' \
117+
| sort \
118+
| awk -v s=$SHARD -v t=$TOTAL 'NR%t==s' \
119+
> "$RUNNER_TEMP/it-shard.txt"
120+
echo "Shard $SHARD/$TOTAL contains $(wc -l < "$RUNNER_TEMP/it-shard.txt") test classes"
121+
head -5 "$RUNNER_TEMP/it-shard.txt"
73122
- name: IT/UT Test
74123
shell: bash
75-
# we do not compile client-cpp for saving time, it is tested in client.yml
76-
# we can skip influxdb-protocol because it has been tested separately in influxdb-protocol.yml
77124
run: |
78125
mvn clean verify \
79126
-P with-integration-tests \
80127
-DskipUTs \
81128
-DintegrationTest.forkCount=2 -DDataNodeMaxHeapSize=1024 \
129+
-Dfailsafe.includesFile="$RUNNER_TEMP/it-shard.txt" \
130+
-DfailIfNoTests=false \
131+
-Dfailsafe.failIfNoSpecifiedTests=false \
82132
-pl integration-test \
83133
-am -PTableSimpleIT
84134
- name: Upload Artifact
85135
if: failure()
86136
uses: actions/upload-artifact@v6
87137
with:
88-
name: table-standalone-log-java${{ matrix.java }}-${{ runner.os }}
138+
name: table-standalone-log-Windows-shard${{ matrix.shard }}
89139
path: integration-test/target/cluster-logs
90140
retention-days: 1

0 commit comments

Comments
 (0)