use GH Actions to compile and tests with Scala 3 (#30427)
* use GH Actions to compile and tests with Scala 3 * Update .github/workflows/scala3-build.yml Co-authored-by: Andrea Peruffo <andrea.peruffo1982@gmail.com> * rename .jvmopts-travis to .jvmopts-ci * Restore the whitesource stage * Small updates to gh action workflow * Mark BoundedBlockingQueueSpec timing-sensitive and exclude * Avoid race condition stopping/starting test actors Co-authored-by: Andrea Peruffo <andrea.peruffo1982@gmail.com> Co-authored-by: Ignasi Marimon-Clos <ignasi@lightbend.com> Co-authored-by: Arnout Engelen <arnout@bzzt.net>
This commit is contained in:
parent
d7df61823f
commit
8e965565a1
6 changed files with 60 additions and 18 deletions
47
.github/workflows/scala3-build.yml
vendored
Normal file
47
.github/workflows/scala3-build.yml
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
name: Build Akka with Scala 3
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags-ignore: [ v.* ]
|
||||
|
||||
jobs:
|
||||
compile-and-test-with-scala3:
|
||||
name: Compile and test with Scala 3
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 11
|
||||
uses: olafurpg/setup-scala@v10
|
||||
with:
|
||||
java-version: adopt@1.11.0-9
|
||||
|
||||
- name: Cache Coursier cache
|
||||
uses: coursier/cache-action@v6.2
|
||||
|
||||
- name: Compile and test selected modules on Scala 3
|
||||
run: |
|
||||
sbt -jvm-opts .jvmopts-ci \
|
||||
-Dakka.build.scalaVersion=3.0 \
|
||||
-Dakka.test.tags.exclude=performance,timing,long-running \
|
||||
akka-actor-tests/test \
|
||||
akka-actor-testkit-typed/test \
|
||||
akka-actor-typed/compile \
|
||||
akka-actor-typed-tests/test \
|
||||
akka-discovery/test \
|
||||
akka-pki/test \
|
||||
akka-protobuf/test \
|
||||
akka-protobuf-v3/test \
|
||||
akka-slf4j/test \akka-stream/test \
|
||||
akka-stream-tests-tck/test \
|
||||
akka-coordination/test \
|
||||
akka-serialization-jackson/test:compile \
|
||||
akka-testkit/test \
|
||||
akka-stream-testkit/test \
|
||||
akka-remote/compile
|
||||
|
|
@ -28,25 +28,19 @@ cache:
|
|||
- $HOME/.jabba/jdk
|
||||
|
||||
# script for the default 'test' stage:
|
||||
script: sbt -jvm-opts .jvmopts-travis -Dakka.build.scalaVersion=$TRAVIS_SCALA_VERSION ";update ;mimaReportBinaryIssues ;test:compile ;validateCompile ;headerCheckAll"
|
||||
script: sbt -jvm-opts .jvmopts-ci -Dakka.build.scalaVersion=$TRAVIS_SCALA_VERSION ";update ;mimaReportBinaryIssues ;test:compile ;validateCompile ;headerCheckAll"
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: whitesource
|
||||
name: whitesource
|
||||
script: git branch -f "$TRAVIS_BRANCH" && git checkout "$TRAVIS_BRANCH" && sbt whitesourceCheckPolicies whitesourceUpdate
|
||||
- stage: scala3
|
||||
name: scala3
|
||||
# separate job since only a few modules compile with Scala 3 yet
|
||||
script: jabba install adopt@1.11-0 && jabba use adopt@1.11-0 && sbt -jvm-opts .jvmopts-travis -Dakka.build.scalaVersion=3.0 akka-actor-tests/test akka-actor-testkit-typed/test akka-actor-typed/compile akka-actor-typed-tests/test akka-discovery/test akka-pki/test akka-protobuf/test akka-protobuf-v3/test akka-slf4j/test akka-stream/test akka-stream-tests-tck/test akka-coordination/test akka-serialization-jackson/test:compile akka-testkit/test akka-stream-testkit/test akka-remote/compile
|
||||
|
||||
stages:
|
||||
- name: whitesource
|
||||
if: repo = akka/akka AND ((branch = master AND type != pull_request) OR tag =~ ^v)
|
||||
- name: test
|
||||
if: type == pull_request OR NOT tag =~ ^v
|
||||
- name: scala3
|
||||
if: type == pull_request OR NOT tag =~ ^v
|
||||
|
||||
env:
|
||||
global:
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import org.scalatest.time.Span
|
|||
import org.scalatest.time.SpanSugar._
|
||||
import org.scalatest.wordspec.AnyWordSpec
|
||||
|
||||
import akka.testkit.TimingTest
|
||||
import akka.util.DefaultExecutionContext._
|
||||
import akka.util.ccompat.JavaConverters._
|
||||
|
||||
|
|
@ -123,7 +124,7 @@ class BoundedBlockingQueueSpec
|
|||
(events should contain).inOrder(offer("a"), poll, offer("b"))
|
||||
}
|
||||
|
||||
"check the backing queue size before offering" in {
|
||||
"check the backing queue size before offering" taggedAs TimingTest in {
|
||||
val TestContext(queue, events, _, notFull, lock, _) = newBoundedBlockingQueue(1)
|
||||
queue.offer("a")
|
||||
|
||||
|
|
|
|||
|
|
@ -49,12 +49,12 @@ public final class ActorContextPipeToSelfTest extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
public void handlesSuccess() {
|
||||
assertEquals("ok: hi", responseFrom(CompletableFuture.completedFuture("hi")));
|
||||
assertEquals("ok: hi", responseFrom(CompletableFuture.completedFuture("hi"), "success"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlesFailure() {
|
||||
assertEquals("ko: boom", responseFrom(failedFuture(new RuntimeException("boom"))));
|
||||
assertEquals("ko: boom", responseFrom(failedFuture(new RuntimeException("boom")), "failure"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -110,7 +110,7 @@ public final class ActorContextPipeToSelfTest extends JUnitSuite {
|
|||
return future;
|
||||
}
|
||||
|
||||
private String responseFrom(final CompletionStage<String> future) {
|
||||
private String responseFrom(final CompletionStage<String> future, String postfix) {
|
||||
final TestProbe<Msg> probe = testKit.createTestProbe();
|
||||
final Behavior<Msg> behavior =
|
||||
Behaviors.setup(
|
||||
|
|
@ -134,14 +134,14 @@ public final class ActorContextPipeToSelfTest extends JUnitSuite {
|
|||
return Behaviors.stopped();
|
||||
});
|
||||
});
|
||||
final String name = "pipe-to-self-spec";
|
||||
final String name = "pipe-to-self-spec-" + postfix;
|
||||
final Props props = Props.empty().withDispatcherFromConfig("pipe-to-self-spec-dispatcher");
|
||||
|
||||
testKit.spawn(behavior, name, props);
|
||||
|
||||
final Msg msg = probe.expectMessageClass(Msg.class);
|
||||
|
||||
assertEquals("pipe-to-self-spec", msg.selfName);
|
||||
assertEquals(name, msg.selfName);
|
||||
assertThat(
|
||||
msg.threadName, startsWith("ActorContextPipeToSelfTest-pipe-to-self-spec-dispatcher"));
|
||||
return msg.response;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ final class ActorContextPipeToSelfSpec
|
|||
with LogCapturing {
|
||||
|
||||
"The Scala DSL ActorContext pipeToSelf" must {
|
||||
"handle success" in { responseFrom(Future.successful("hi")) should ===("ok: hi") }
|
||||
"handle failure" in { responseFrom(Future.failed(Fail)) should ===(s"ko: $Fail") }
|
||||
"handle success" in { responseFrom(Future.successful("hi"), "success") should ===("ok: hi") }
|
||||
"handle failure" in { responseFrom(Future.failed(Fail), "failure") should ===(s"ko: $Fail") }
|
||||
"handle adapted null" in {
|
||||
val probe = testKit.createTestProbe[String]()
|
||||
val promise = Promise[String]()
|
||||
|
|
@ -63,7 +63,7 @@ final class ActorContextPipeToSelfSpec
|
|||
|
||||
object Fail extends NoStackTrace
|
||||
|
||||
private def responseFrom(future: Future[String]) = {
|
||||
private def responseFrom(future: Future[String], postfix: String) = {
|
||||
final case class Msg(response: String, selfName: String, threadName: String)
|
||||
|
||||
val probe = TestProbe[Msg]()
|
||||
|
|
@ -77,14 +77,14 @@ final class ActorContextPipeToSelfSpec
|
|||
Behaviors.stopped
|
||||
}
|
||||
}
|
||||
val name = "pipe-to-self-spec"
|
||||
val name = s"pipe-to-self-spec-$postfix"
|
||||
val props = Props.empty.withDispatcherFromConfig("pipe-to-self-spec-dispatcher")
|
||||
|
||||
spawn(behavior, name, props)
|
||||
|
||||
val msg = probe.expectMessageType[Msg]
|
||||
|
||||
msg.selfName should ===("pipe-to-self-spec")
|
||||
msg.selfName should ===(name)
|
||||
msg.threadName should startWith("ActorContextPipeToSelfSpec-pipe-to-self-spec-dispatcher")
|
||||
msg.response
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue