Skip to content

Commit f850b2a

Browse files
committed
MINOR: Reduce test workflow waste
1 parent cb24576 commit f850b2a

2 files changed

Lines changed: 71 additions & 19 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ name: Test
1919

2020
on:
2121
push:
22-
branches:
23-
- '**'
24-
- '!dependabot/**'
25-
tags:
26-
- '**'
22+
branches: [main]
23+
tags: ['**']
2724
pull_request:
2825

2926
concurrency:
@@ -32,6 +29,7 @@ concurrency:
3229

3330
permissions:
3431
contents: read
32+
pull-requests: read
3533

3634
env:
3735
DOCKER_VOLUME_PREFIX: ".docker/"
@@ -66,7 +64,7 @@ jobs:
6664
uses: actions/cache@v5
6765
with:
6866
path: .docker
69-
key: maven-${{ matrix.jdk }}-${{ matrix.maven }}-${{ hashFiles('compose.yaml', '**/pom.xml', '**/*.java') }}
67+
key: maven-${{ matrix.jdk }}-${{ matrix.maven }}-${{ hashFiles('compose.yaml', '**/pom.xml') }}
7068
restore-keys: maven-${{ matrix.jdk }}-${{ matrix.maven }}-
7169
- name: Execute Docker Build
7270
env:
@@ -94,16 +92,17 @@ jobs:
9492
jdk: 17
9593
macos: latest
9694
steps:
97-
- name: Set up Java
98-
uses: actions/setup-java@v5
99-
with:
100-
distribution: 'temurin'
101-
java-version: ${{ matrix.jdk }}
10295
- name: Checkout Arrow
10396
uses: actions/checkout@v6
10497
with:
10598
fetch-depth: 0
10699
submodules: recursive
100+
- name: Set up Java
101+
uses: actions/setup-java@v5
102+
with:
103+
distribution: 'temurin'
104+
java-version: ${{ matrix.jdk }}
105+
cache: 'maven'
107106
- name: Build
108107
shell: bash
109108
env:
@@ -125,16 +124,17 @@ jobs:
125124
matrix:
126125
jdk: [17]
127126
steps:
128-
- name: Set up Java
129-
uses: actions/setup-java@v5
130-
with:
131-
java-version: ${{ matrix.jdk }}
132-
distribution: 'temurin'
133127
- name: Checkout Arrow
134128
uses: actions/checkout@v6
135129
with:
136130
fetch-depth: 0
137131
submodules: recursive
132+
- name: Set up Java
133+
uses: actions/setup-java@v5
134+
with:
135+
java-version: ${{ matrix.jdk }}
136+
distribution: 'temurin'
137+
cache: 'maven'
138138
- name: Build
139139
shell: bash
140140
env:
@@ -149,59 +149,111 @@ jobs:
149149
integration:
150150
name: AMD64 integration
151151
runs-on: ubuntu-latest
152+
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
152153
timeout-minutes: 60
153154
steps:
155+
- name: Check integration relevance
156+
id: integration-changes
157+
uses: actions/github-script@v8
158+
with:
159+
script: |
160+
if (context.eventName !== 'pull_request') {
161+
core.setOutput('should_run', 'true');
162+
return;
163+
}
164+
165+
const files = await github.paginate(
166+
github.rest.pulls.listFiles,
167+
{
168+
owner: context.repo.owner,
169+
repo: context.repo.repo,
170+
pull_number: context.payload.pull_request.number,
171+
per_page: 100,
172+
}
173+
);
174+
175+
const relevant = files.some(({ filename }) =>
176+
filename === 'compose.yaml' ||
177+
filename === 'pom.xml' ||
178+
filename === '.github/workflows/test.yml' ||
179+
filename.startsWith('c/') ||
180+
filename.startsWith('flight/') ||
181+
filename.startsWith('format/') ||
182+
filename.startsWith('vector/') ||
183+
filename.startsWith('ci/scripts/') ||
184+
filename.startsWith('testing/data/') ||
185+
filename.endsWith('/pom.xml')
186+
);
187+
188+
core.setOutput('should_run', relevant ? 'true' : 'false');
189+
core.notice(
190+
relevant
191+
? 'Integration-relevant changes detected; running integration tests.'
192+
: 'No integration-relevant changes detected; skipping integration tests.'
193+
);
154194
- name: Checkout Arrow
195+
if: steps.integration-changes.outputs.should_run == 'true'
155196
uses: actions/checkout@v6
156197
with:
157198
fetch-depth: 0
158199
repository: apache/arrow
159200
submodules: recursive
160201
- name: Checkout Arrow Rust
202+
if: steps.integration-changes.outputs.should_run == 'true'
161203
uses: actions/checkout@v6
162204
with:
163205
repository: apache/arrow-rs
164206
path: rust
165207
- name: Checkout Arrow nanoarrow
208+
if: steps.integration-changes.outputs.should_run == 'true'
166209
uses: actions/checkout@v6
167210
with:
168211
repository: apache/arrow-nanoarrow
169212
path: nanoarrow
170213
- name: Checkout Arrow .NET
214+
if: steps.integration-changes.outputs.should_run == 'true'
171215
uses: actions/checkout@v6
172216
with:
173217
repository: apache/arrow-dotnet
174218
path: dotnet
175219
- name: Checkout Arrow Go
220+
if: steps.integration-changes.outputs.should_run == 'true'
176221
uses: actions/checkout@v6
177222
with:
178223
repository: apache/arrow-go
179224
path: go
180225
- name: Checkout Arrow Java
226+
if: steps.integration-changes.outputs.should_run == 'true'
181227
uses: actions/checkout@v6
182228
with:
183229
path: java
184230
- name: Checkout Arrow JavaScript
231+
if: steps.integration-changes.outputs.should_run == 'true'
185232
uses: actions/checkout@v6
186233
with:
187234
repository: apache/arrow-js
188235
path: js
189236
- name: Free up disk space
237+
if: steps.integration-changes.outputs.should_run == 'true'
190238
run: |
191239
ci/scripts/util_free_space.sh
192240
- name: Cache Docker Volumes
241+
if: steps.integration-changes.outputs.should_run == 'true'
193242
uses: actions/cache@v5
194243
with:
195244
path: .docker
196245
key: integration-conda-${{ hashFiles('cpp/**') }}
197246
restore-keys: integration-conda-
198247
- name: Setup Python
248+
if: steps.integration-changes.outputs.should_run == 'true'
199249
uses: actions/setup-python@v6
200250
with:
201251
python-version: 3.12
202252
- name: Setup Archery
253+
if: steps.integration-changes.outputs.should_run == 'true'
203254
run: pip install -e dev/archery[docker]
204255
- name: Execute Docker Build
256+
if: steps.integration-changes.outputs.should_run == 'true'
205257
run: |
206258
source ci/scripts/util_enable_core_dumps.sh
207259
archery docker run \

‎ci/scripts/test.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ mvn="${mvn} -T 2C"
3737

3838
pushd "${build_dir}"
3939

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

4242
projects=()
4343
if [ "${ARROW_JAVA_JNI}" = "ON" ]; then
@@ -46,7 +46,7 @@ if [ "${ARROW_JAVA_JNI}" = "ON" ]; then
4646
projects+=(gandiva)
4747
fi
4848
if [ "${#projects[@]}" -gt 0 ]; then
49-
${mvn} clean test \
49+
${mvn} test \
5050
-Parrow-jni \
5151
-pl "$(
5252
IFS=,
@@ -56,7 +56,7 @@ if [ "${#projects[@]}" -gt 0 ]; then
5656
fi
5757

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

6262
popd

0 commit comments

Comments
 (0)