Skip to content

Commit 6e7fd78

Browse files
authored
bug_fix: Run unit tests on main for at least one go version (#39638)
#### Description While working on #38270, I accidently disabled all tests for the go version 1.24. Here I'm fixing the problem and also updating comments to make the conditionals easier to understand. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #39618 Signed-off-by: Arthur Silva Sens <[email protected]>
1 parent 1ff442c commit 6e7fd78

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/build-and-test.yml

+14-4
Original file line numberDiff line numberDiff line change
@@ -293,22 +293,32 @@ jobs:
293293
with:
294294
path: ~/.cache/go-build
295295
key: go-test-build-${{ runner.os }}-${{ matrix.go-version }}-${{ matrix.runner }}-${{ hashFiles('**/go.sum') }}
296+
297+
# Unit tests without JUnit output are much faster, so it's fine to run on every PR and every go version.
298+
# The only time we don't run them is when we already ran them with JUnit output.
299+
# Which means:
300+
# - On PRs.
301+
# - On main, with the go version that we didn't run the JUnit tests with.
296302
- name: Run Unit Tests
297303
id: tests
298-
if: github.ref != 'refs/heads/main' # Runs on every PR and both go versions
304+
if: github.ref != 'refs/heads/main' || !startsWith( matrix.go-version, '~1.23' )
299305
run: make gotest GROUP=${{ matrix.group }}
306+
307+
# JUnit tests are super long, so we only run them for one go version.
308+
# This is used for automation that automatically creates issues for flaky tests that are
309+
# merged to main, so we don't run them on every PR.
300310
- name: Run Unit Tests With JUnit and Coverage
301311
id: tests-with-junit
302-
if: startsWith( matrix.go-version, '~1.23' ) && github.ref == 'refs/heads/main' && github.event_name == 'push' # only run junit/coverage on one version and only on main
312+
if: startsWith( matrix.go-version, '~1.23' ) && github.ref == 'refs/heads/main' && github.event_name == 'push'
303313
continue-on-error: true # Allow uploading artifacts even if the test fails
304314
run: make gotest-with-junit-and-cover GROUP=${{ matrix.group }}
305315
- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
306-
if: startsWith( matrix.go-version, '~1.23' ) && github.ref == 'refs/heads/main' && github.event_name == 'push' # only upload artifact for one version and only on main
316+
if: startsWith( matrix.go-version, '~1.23' ) && github.ref == 'refs/heads/main' && github.event_name == 'push'
307317
with:
308318
name: coverage-artifacts-${{ matrix.go-version }}-${{ matrix.runner }}-${{ matrix.group }}
309319
path: ${{ matrix.group }}-coverage.txt
310320
- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
311-
if: startsWith( matrix.go-version, '~1.23' ) && github.ref == 'refs/heads/main' && github.event_name == 'push' # only upload artifact for one version and only on main
321+
if: startsWith( matrix.go-version, '~1.23' ) && github.ref == 'refs/heads/main' && github.event_name == 'push'
312322
with:
313323
name: test-results-${{ matrix.go-version }}-${{ matrix.runner }}-${{ matrix.group }}
314324
path: internal/tools/testresults/

0 commit comments

Comments
 (0)