Repository navigation
ci: run the Scala unit tests on pull requests - #26616
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 4
Please check the settings in the CodeRabbit UI or the
|
…rops TestFixtures no longer matched the domain case classes (MeetingProp, BreakoutProps, DurationProps, WelcomeProp, UsersProp and DefaultProps gained or lost fields), so Test/compile failed and no test of the module ran. The fixture now builds every prop with the current constructors, and passes userInactivityThresholdInMinutes where it passed the inspect timer.
New workflow that runs the unit tests of bbb-common-message, akka-bbb-apps and bbb-common-web when a pull request changes one of them. It installs JDK 21 and the sbt 1.10.7 runner itself, publishes the bbb-common-message snapshot locally and then runs each module's tests; every module reports even when an earlier one fails. The package build scripts are unchanged, so a failing test marks the check red without blocking the package build. The ScalaTest 3.0.8 HTML reporter (-h) of bbb-common-message needs org.pegdown, which is not on the test classpath, so it aborted the run with NoClassDefFoundError. The module now reports to stdout (-oD), as akka-bbb-apps and bbb-common-web do. The developer guide says where these tests run and how to run them locally.
07723f5 to
f087f3d
Compare
✅ Automated tests have passed! |
|
A candidate for backporting to |
paultrudel
left a comment
There was a problem hiding this comment.
Thanks, this looks good to me. The run on the head (44460511506) passes 20, 80 and 75 tests. The rebuilt TestFixtures matches the current case classes in Meeting2x.scala, and the two values it drops are not used anywhere. The if: conditions on the last two steps do what the description says.
None of the points below blocks the merge:
- No run on the base branch. The workflow only triggers on
pull_request, so setup-java saves its sbt cache under each PR's own ref, and a new PR can't restore it: every new PR downloads sbt and the dependencies from Maven Central again, which is the 429 risk the description mentions. It also means nothing runs after a merge, so two PRs that each pass alone can breakTest/compileon the base branch together, and the next PR that touches these modules goes red for an unrelated reason. Apushtrigger for thev*.x-developbranches with the same paths would fix both (with the conditional checkout thatts-code-compilation.ymlalready has). - Formatting. These modules set
scalariformAutoformat := true, and the run log showsReformatted 2 Scala sources ... (test)inbbb-common-message, one of them theTestFixtures.scalathis PR rewrites. So following the new dev-guide section leaves unrelated changes in the working tree. Runningsbt Test/scalariformFormatand committing at leastTestFixtures.scalawould avoid that. akka-bbb-apps (5 files) and bbb-common-web (1) have the same drift, which is not from this PR. - Optional:
publishLocalalso builds the scaladoc and sources jars. If scaladoc fails, both later test steps are skipped and the run reports one failure instead of three. Turning offpackageDoc/packageSrcpublishing for that step would avoid it. - Optional, for the dev guide or a follow-up: "The unit tests ... run on every pull request" doesn't mention that akka-bbb-apps excludes 10 test sources from
Test/compile(BreakoutRoomsUtilSpec,GroupsChatTests,ReceivedJsonMsgHandlerTraitTests, ...) and bbb-common-web excludesRecMetaXmlHelperTests. A follow-up issue to repair them, as this PR does for bbb-common-message, would be worth having.
On the 4.0 backport: the two commits don't cherry-pick cleanly onto v4.0.x-develop. TestFixtures.scala conflicts because 4.0's UsersProp doesn't have allowModsToRequestCameraShare or hideUsersWithoutCamera, so the 4.0 PR needs its own fixture edit.
What does this PR do?
Adds a GitHub Actions workflow,
.github/workflows/scala-unit-tests.yml, that runs the unit tests of the three Scala server modules on every pull request that changes one of them:bbb-common-message,akka-bbb-appsandbbb-common-web. Until now no workflow ransbt test, so these tests only ran when someone remembered to run them by hand.The workflow installs JDK 21 (
actions/setup-java, Temurin, with its sbt cache) and the sbt 1.10.7 runner (sbt/setup-sbt, with its sbt 2.x disk cache turned off) instead of relying on the runner image. It publishes thebbb-common-messagesnapshot locally (the other two modules depend on it), and then runs the tests of each module. Each module reports even when an earlier one fails, so a single red run shows all three results. The job has a 20 minute timeout, and a new push to the same pull request cancels the run in progress, as inautomated-tests.yml. Otherwise it followsts-code-compilation.yml: same trigger types, runner variable, read-only permissions and merge-ref checkout.The package build scripts and the GitLab pipeline are unchanged. A failing test marks this check red; it does not block building packages. Like the
build-packagejobs, the check downloads sbt and the dependencies from Maven Central, so it can fail when Maven Central rate-limits the runner (HTTP 429); re-running the job is enough in that case.To make the workflow useful from the first run, two fixes in
bbb-common-message, which was the only one of the three modules whose tests could not run:TestFixturesno longer matched the domain case classes (MeetingProp,BreakoutProps,DurationProps,WelcomeProp,UsersPropandDefaultPropsgained or lost fields), soTest/compilefailed with 9 errors and no test of the module ran. The fixture now builds every prop with the current constructors. It also passesuserInactivityThresholdInMinuteswhere it used to pass the inspect timer value.-h) needsorg.pegdown, which is not on the test classpath. Once the tests compiled, the run aborted withNoClassDefFoundError: org/pegdown/PegDownProcessor. The module now reports to stdout with durations (-oD), asakka-bbb-appsandbbb-common-webalready do.akka-bbb-appsandbbb-common-webpass as they are; their test configuration is not touched. The developer guide gets a short section on where these tests run and how to run them locally. No product code changes.Closes Issue(s)
None.
Motivation
Server changes in these modules come with unit tests, but nothing checks them on pull requests, so a test can stay broken for a long time without anyone noticing. That is what happened to the
bbb-common-messagetests fixed here.How to test
bbb-common-message, 80 inakka-bbb-appsand 75 inbbb-common-web.Tests: succeeded 19, failed 1inbbb-common-message, whileakka-bbb-appsandbbb-common-webstill ran and passed 80 and 75 tests (https://github.com/imdt-claudiop/bigbluebutton/actions/runs/44460509800).Before this change,
sbt testinbbb-common-messageonv4.1.x-developends with[error] 9 errors foundand(Test / compileIncremental) Compilation failed.More
The tests of
bigbluebutton-web(Gradle) are not part of this workflow.