Skip to content

Add unit-test CI for PRs and main, with flaky-test hardening#91

Merged
flemming-n-larsen merged 5 commits into
robo-code:mainfrom
pavelsavara:ci_tests
Jun 3, 2026
Merged

Add unit-test CI for PRs and main, with flaky-test hardening#91
flemming-n-larsen merged 5 commits into
robo-code:mainfrom
pavelsavara:ci_tests

Conversation

@pavelsavara

@pavelsavara pavelsavara commented Jun 2, 2026

Copy link
Copy Markdown
Member

Summary

Adds a CI workflow that builds and runs the unit tests on every push and on pull requests targeting main, and hardens the test suite against a timing-sensitive flaky failure so CI stays reliably green/red for the right reasons.

Changes

CI workflow (.github/workflows/assembly.yml)

  • Run on push (all branches) and pull_request targeting main, so PRs get validated before merge.
  • Add least-privilege permissions: contents: read.
  • Add a concurrency group keyed on github.ref with cancel-in-progress: true so superseded runs on a branch/PR are cancelled.
  • Enable Gradle caching in setup-java and build with ./gradlew build --stacktrace for clearer failure diagnostics.
  • Publish a JUnit test-results summary via dorny/test-reporter@v3 (native Node.js 24 runtime). fail-on-error: true so the published check turns red when any test fails instead of masking failures.

Flaky test mitigation

The robot battle tests are timing-sensitive and can intermittently report transient engine errors (e.g. Unable to stop thread) on slow/loaded CI machines. Addressed on two complementary fronts:

  1. Engine resilience (RobotThreadManager): make robot thread shutdown tolerant of CPU starvation rather than assuming a stuck thread. Extract the magic timeouts into named constants, give the shutdown path a larger overall budget, re-assert the interrupt periodically (a single early interrupt can be missed before the thread reaches an interruptible point), and Thread.yield() while polling so a contended target thread gets scheduled.
  2. Gradle test-retry plugin (CI safety net): retry failed tests a couple of times via a shared convention so genuine flakiness does not fail the build, while real failures (all retries exhausted) still fail. Wired through gradle/libs.versions.toml, buildSrc, and the java-conventions convention plugin (gradlePluginPortal() added for plugin resolution).

Notes

  • test-retry only masks eventually-passing flakes; a test that fails all retries still fails the build and the test-reporter check.

@pavelsavara pavelsavara self-assigned this Jun 2, 2026
@pavelsavara pavelsavara marked this pull request as ready for review June 2, 2026 12:35
@pavelsavara pavelsavara changed the title Add CI workflow for pull requests and main Add CI workflow with unit tests for pull requests and main Jun 2, 2026
@pavelsavara pavelsavara changed the title Add CI workflow with unit tests for pull requests and main Add unit-test CI for PRs and main, with flaky-test hardening Jun 2, 2026
@flemming-n-larsen flemming-n-larsen merged commit 16964d8 into robo-code:main Jun 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants