Skip to content

Commit 9cc075a

Browse files
committed
ci: run one UI test class ten times per OS on request
Reading a flake takes repeats, and until now each one cost a whole matrix: ten throwaway branches, ten dispatches, and the unit tests, the plugin verifier and the other shard run along with it, for one class. The Escape investigation did that twice. `workflow_dispatch` now takes the class to repeat, as a `--tests` filter. Given one, the run is twenty UI jobs -- ten per OS -- and nothing else, and it keeps every run's IDE logs, the passing ones too, so a failure can be read against the runs either side of it. Given nothing, which is every push and pull request, the workflow is what it was. The filter reaches the script through the environment rather than an expression in it: it is text whoever dispatched the run chose. Taken from the two investigations that each grew their own copy with the class written into it (#146, #147), so neither has to.
1 parent 673486b commit 9cc075a

1 file changed

Lines changed: 28 additions & 7 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ on:
55
branches: [master]
66
pull_request:
77
workflow_dispatch:
8+
inputs:
9+
repeat_ui_test:
10+
description: >-
11+
One UI test class to run ten times per OS, as a `--tests` filter, e.g.
12+
`*SplitModeNotebookTest`. Empty runs the suite as a push does. A repeat keeps every
13+
run's IDE logs, the passing ones too, so a flake can be read against its neighbours.
14+
type: string
15+
default: ''
816

917
# A newer push to the same branch makes the older run's result moot.
1018
concurrency:
@@ -27,6 +35,7 @@ env:
2735

2836
jobs:
2937
test:
38+
if: ${{ !inputs.repeat_ui_test }}
3039
name: Tests (${{ matrix.os }})
3140
strategy:
3241
fail-fast: false
@@ -124,6 +133,7 @@ jobs:
124133
# What the tests never look at: the descriptors only fail when an IDE loads them, and the
125134
# distributions are only assembled here.
126135
plugin:
136+
if: ${{ !inputs.repeat_ui_test }}
127137
name: Build and verify plugins
128138
runs-on: ubuntu-24.04
129139
timeout-minutes: 60
@@ -193,14 +203,16 @@ jobs:
193203
retention-days: 14
194204

195205
ui-test:
196-
name: Split-mode UI tests (${{ matrix.os }}, ${{ matrix.shard }}/2)
206+
name: ${{ inputs.repeat_ui_test && format('Repeat {0} ({1}, {2}/10)', inputs.repeat_ui_test, matrix.os, matrix.repeat) || format('Split-mode UI tests ({0}, {1}/2)', matrix.os, matrix.shard) }}
197207
strategy:
198208
fail-fast: false
199209
matrix:
200210
os: [ubuntu-24.04, windows-2025]
201211
# Half the test classes each, by test count (see `uiTestShard` in src/ui-test): all of them
202212
# on one Windows runner outgrew the step's 100 minutes.
203-
shard: [1, 2]
213+
# One shard in a repeat: the filter picks the class, so sharding it would only halve it.
214+
shard: ${{ fromJSON(inputs.repeat_ui_test && '[1]' || '[1,2]') }}
215+
repeat: ${{ fromJSON(inputs.repeat_ui_test && '[1,2,3,4,5,6,7,8,9,10]' || '[1]') }}
204216
runs-on: ${{ matrix.os }}
205217
# Each test starts a backend and a client, a few minutes apiece on a two-core runner.
206218
timeout-minutes: 120
@@ -309,18 +321,27 @@ jobs:
309321
# anything behind that said which ran out.
310322
- name: Run UI tests
311323
timeout-minutes: 100
324+
env:
325+
REPEAT_UI_TEST: ${{ inputs.repeat_ui_test }}
312326
run: |
313327
mkdir -p out
328+
# Through the environment rather than an expression in the script: a filter is text
329+
# whoever dispatched the run chose.
330+
if [ -n "$REPEAT_UI_TEST" ]; then
331+
test_args=(--tests "$REPEAT_UI_TEST")
332+
else
333+
test_args=(-PuiTestShard=${{ matrix.shard }}/2)
334+
fi
314335
while true; do
315336
{ date -u +%T; df -h . | tail -n 1; [ "$RUNNER_OS" = Linux ] && free -m | sed -n 2p; } >> out/resource-usage.log 2>&1
316337
sleep 60
317338
done > /dev/null 2>&1 &
318339
trap "kill $!" EXIT
319340
if [ "$RUNNER_OS" = Linux ]; then
320341
xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" \
321-
./gradlew :ui-test:test -PsearchableOptions=false -PuiTestShard=${{ matrix.shard }}/2 --console=plain
342+
./gradlew :ui-test:test -PsearchableOptions=false "${test_args[@]}" --console=plain
322343
else
323-
./gradlew :ui-test:test -PsearchableOptions=false -PuiTestShard=${{ matrix.shard }}/2 --console=plain
344+
./gradlew :ui-test:test -PsearchableOptions=false "${test_args[@]}" --console=plain
324345
fi
325346
326347
# A test stopped by a timeout leaves its IDEs running, and on Windows their locked files make
@@ -350,7 +371,7 @@ jobs:
350371
if: always()
351372
uses: actions/upload-artifact@v5
352373
with:
353-
name: ui-test-reports-${{ matrix.os }}-${{ matrix.shard }}
374+
name: ui-test-reports-${{ matrix.os }}-${{ matrix.shard }}${{ inputs.repeat_ui_test && format('-repeat-{0}', matrix.repeat) || '' }}
354375
path: |
355376
src/ui-test/build/reports/tests/
356377
src/ui-test/build/test-results/
@@ -362,10 +383,10 @@ jobs:
362383
# the run directories, which would make the upload walk into those -- an exclusion only applies
363384
# after the walk, and stat on a held `.port` failed the whole upload.
364385
- name: Upload IDE logs
365-
if: failure() || cancelled()
386+
if: failure() || cancelled() || inputs.repeat_ui_test
366387
uses: actions/upload-artifact@v5
367388
with:
368-
name: ui-test-ide-logs-${{ matrix.os }}-${{ matrix.shard }}
389+
name: ui-test-ide-logs-${{ matrix.os }}-${{ matrix.shard }}${{ inputs.repeat_ui_test && format('-repeat-{0}', matrix.repeat) || '' }}
369390
# The test JVM's timeout dumps live under the hidden .intellijPlatform directory.
370391
include-hidden-files: true
371392
path: |

0 commit comments

Comments
 (0)