Skip to content

Commit 37f88bf

Browse files
committed
Add CI workflows that repeats bazel tests
This adds workflows that can run tests repeatedly in bazel to gain information about flaky tests. Since bazel targets can be annotated as flaky, distinct workflows are created to execute flaky and non-flaky tests separately. Any failures of tests annotated as non-flaky are a signal that the offending test should be annotated as flaky. The results from repeated executions of flaky tests will generate flakiness statistics and may aid in diagnosing the root cause of flakiness. Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
1 parent 4ed1c4c commit 37f88bf

3 files changed

Lines changed: 79 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Bazel repeat flaky tests
2+
on:
3+
push:
4+
branches:
5+
- 'scpeters/bazel_repeat_tests'
6+
workflow_dispatch:
7+
inputs:
8+
runs_per_test:
9+
default: 10
10+
required: false
11+
type: string
12+
13+
jobs:
14+
call-repeat-tests:
15+
uses: ./.github/workflows/bazel_repeat_tests.yml
16+
with:
17+
flaky: 1
18+
runs_per_test: 10
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Bazel repeat non-flaky tests
2+
on:
3+
push:
4+
branches:
5+
- 'scpeters/bazel_repeat_tests'
6+
workflow_dispatch:
7+
inputs:
8+
runs_per_test:
9+
default: 10
10+
required: false
11+
type: string
12+
13+
jobs:
14+
call-repeat-tests:
15+
uses: ./.github/workflows/bazel_repeat_tests.yml
16+
with:
17+
flaky: 0
18+
runs_per_test: 10
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Bazel repeat tests
2+
on:
3+
workflow_call:
4+
inputs:
5+
flaky:
6+
default: 0
7+
required: false
8+
type: string
9+
runs_per_test:
10+
default: 10
11+
required: false
12+
type: string
13+
workflow_dispatch:
14+
inputs:
15+
flaky:
16+
default: 0
17+
required: false
18+
type: string
19+
runs_per_test:
20+
default: 10
21+
required: false
22+
type: string
23+
24+
jobs:
25+
repeat-tests:
26+
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v7.7.0
27+
with:
28+
folders: |
29+
[
30+
"."
31+
]
32+
exclude: |
33+
[
34+
{"folder": ".", "bzlmodEnabled": false}
35+
]
36+
exclude_windows: true
37+
bazel_test_command: |
38+
# Exit with success code 0 if no targets match the query
39+
# `grep -q '^' fails if the query output is empty
40+
bazel query "attr(flaky, ${{ inputs.flaky }}, tests(//...))" \
41+
| grep -q '^' || exit 0
42+
bazel test --runs_per_test=${{ inputs.runs_per_test }} \
43+
$(bazel query "attr(flaky, ${{ inputs.flaky }}, tests(//...))")

0 commit comments

Comments
 (0)