Skip to content

Commit 7f1f9f5

Browse files
authored
GH-1188: Reduce test workflow waste (#1189)
## Summary This PR reduces wasted GitHub Actions time in the `Test` workflow by removing redundant rebuilds, improving caching, and skipping integration work when it is not relevant. ## What changed - Removed `clean` from `ci/scripts/test.sh` so the test phase reuses the classes compiled earlier in the job instead of deleting and recompiling them. - Narrowed the Maven/Docker cache key to POM changes, so source-only edits do not invalidate the dependency cache. - Enabled Maven dependency caching on the macOS and Windows test jobs. - Added `pull-requests: read` so the integration job can inspect changed files. Closes #1188 Note: The changes on this PR were highlighted and addressed with AI assistance
1 parent a9f0086 commit 7f1f9f5

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

.github/workflows/test.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
uses: actions/cache@v6
6767
with:
6868
path: .docker
69-
key: maven-${{ matrix.jdk }}-${{ matrix.maven }}-${{ hashFiles('compose.yaml', '**/pom.xml', '**/*.java') }}
69+
key: maven-${{ matrix.jdk }}-${{ matrix.maven }}-${{ hashFiles('compose.yaml', '**/pom.xml') }}
7070
restore-keys: maven-${{ matrix.jdk }}-${{ matrix.maven }}-
7171
- name: Execute Docker Build
7272
env:
@@ -94,16 +94,17 @@ jobs:
9494
jdk: 17
9595
macos: latest
9696
steps:
97-
- name: Set up Java
98-
uses: actions/setup-java@v5
99-
with:
100-
distribution: 'temurin'
101-
java-version: ${{ matrix.jdk }}
10297
- name: Checkout Arrow
10398
uses: actions/checkout@v7
10499
with:
105100
fetch-depth: 0
106101
submodules: recursive
102+
- name: Set up Java
103+
uses: actions/setup-java@v5
104+
with:
105+
distribution: 'temurin'
106+
java-version: ${{ matrix.jdk }}
107+
cache: 'maven'
107108
- name: Build
108109
shell: bash
109110
env:
@@ -125,16 +126,17 @@ jobs:
125126
matrix:
126127
jdk: [17]
127128
steps:
128-
- name: Set up Java
129-
uses: actions/setup-java@v5
130-
with:
131-
java-version: ${{ matrix.jdk }}
132-
distribution: 'temurin'
133129
- name: Checkout Arrow
134130
uses: actions/checkout@v7
135131
with:
136132
fetch-depth: 0
137133
submodules: recursive
134+
- name: Set up Java
135+
uses: actions/setup-java@v5
136+
with:
137+
java-version: ${{ matrix.jdk }}
138+
distribution: 'temurin'
139+
cache: 'maven'
138140
- name: Build
139141
shell: bash
140142
env:

ci/scripts/test.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ fi
3434
mvn="mvn -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
3535
# Use `2 * ncores` threads
3636
mvn="${mvn} -T 2C"
37+
mvn="${mvn} -Denforcer.skip=true"
3738

3839
pushd "${build_dir}"
3940

40-
${mvn} -Darrow.test.dataRoot="${source_dir}/testing/data" clean test
41+
${mvn} -Darrow.test.dataRoot="${source_dir}/testing/data" test
4142

4243
projects=()
4344
if [ "${ARROW_JAVA_JNI}" = "ON" ]; then
@@ -46,7 +47,7 @@ if [ "${ARROW_JAVA_JNI}" = "ON" ]; then
4647
projects+=(gandiva)
4748
fi
4849
if [ "${#projects[@]}" -gt 0 ]; then
49-
${mvn} clean test \
50+
${mvn} test \
5051
-Parrow-jni \
5152
-pl "$(
5253
IFS=,
@@ -56,7 +57,7 @@ if [ "${#projects[@]}" -gt 0 ]; then
5657
fi
5758

5859
if [ "${ARROW_JAVA_CDATA}" = "ON" ]; then
59-
${mvn} clean test -Parrow-c-data -pl c -Darrow.c.jni.dist.dir="${java_jni_dist_dir}"
60+
${mvn} test -Parrow-c-data -pl c -Darrow.c.jni.dist.dir="${java_jni_dist_dir}"
6061
fi
6162

6263
popd

0 commit comments

Comments
 (0)