Merge pull request #30551 from marcospereira/build/nightly-builds-improvements

GH Actions: Nightly builds improvements
This commit is contained in:
Marcos Pereira 2021-08-24 11:40:37 -04:00 committed by GitHub
commit 554044e387
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 164 additions and 203 deletions

139
.github/workflows/nightly-builds.yml vendored Normal file
View file

@ -0,0 +1,139 @@
name: Nightly Builds
on:
schedule:
- cron: "0 0 * * *"
jobs:
nightly-cluster-metrics-sigar:
name: Akka Cluster Metrics Test with Sigar
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0
- name: Set up JDK 8
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.8.0
- name: Cache Coursier cache
uses: coursier/cache-action@v6.2
- name: sbt akka-cluster-metrics/test
run: |-
sbt -jvm-opts .jvmopts-ci \
-Djava.security.egd=file:/dev/./urandom \
-Dakka.test.sigar=true \
-Dakka.cluster.assert=on \
-Dakka.test.timefactor=2 \
-Dakka.test.tags.exclude=gh-exclude \
clean akka-cluster-metrics/test
- name: Test Reports
# Makes it easier to spot failures instead of looking at the logs.
if: ${{ failure() }}
uses: marcospereira/action-surefire-report@v1
with:
report_paths: '**/target/test-reports/TEST-*.xml'
fail_if_no_tests: false
skip_publishing: true
- name: Email on failure
if: ${{ failure() }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: "Failed: ${{ github.workflow }} / ${{ github.job }}"
to: akka.official@gmail.com
from: Akka CI (GHActions)
body: |
Job ${{ github.job }} in workflow ${{ github.workflow }} of ${{github.repository}} failed!
https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
jdk-nightly-tests:
name: JDK ${{ matrix.jdkVersion }} / Scala ${{ matrix.scalaVersion }}
runs-on: ubuntu-20.04
strategy:
matrix:
# No need to specify the full Scala version. Only the Scala binary version
# is required and Akka build will set the right full version from it.
scalaVersion: ["2.12", "2.13"]
jdkVersion: ["adopt@1.8.0", "adopt@1.11"]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.jdkVersion }}
uses: olafurpg/setup-scala@v10
with:
java-version: ${{ matrix.jdkVersion }}
- name: Cache Coursier cache
uses: coursier/cache-action@v6.2
# Only run multijvm tests in Scala 2.13. No need to run it to
# multiple Scala versions AND multiple JDK versions. This will
# run multijvm tests to run for both JDK 8 and 11 though.
- name: Compile and Test
run: |-
## TODO: restore the multi-node tests
sbt -jvm-opts .jvmopts-ci \
-Dakka.build.scalaVersion=${{ matrix.scalaVersion }} \
-Dakka.test.timefactor=2 \
-Dakka.cluster.assert=on \
-Dakka.test.multi-in-test=${{ matrix.scalaVersion == '2.13' }} \
-Dakka.test.tags.exclude=gh-exclude \
clean update Test/compile test checkTestsHaveRun
- name: Test Reports
# Makes it easier to spot failures instead of looking at the logs.
if: ${{ failure() }}
uses: marcospereira/action-surefire-report@v1
with:
report_paths: '**/target/test-reports/TEST-*.xml'
fail_if_no_tests: false
skip_publishing: true
- name: Docs
# Docs generation requires JDK 11. Checks with `startsWith` helps
# the check to be more resilient if the JDK version changes to a
# more specific one such as adopt@1.11.0-9.
if: ${{ startsWith(matrix.jdkVersion, 'adopt@1.11') }}
run: |-
sudo apt-get install graphviz
sbt -jvm-opts .jvmopts-ci \
-Dakka.build.scalaVersion=${{ matrix.scalaVersion }} \
-Dakka.genjavadoc.enabled=true \
doc
- name: Publish
run: |-
sbt -jvm-opts .jvmopts-ci \
-Dakka.build.scalaVersion=${{ matrix.scalaVersion }} \
publishLocal publishM2
- name: Email on failure
if: ${{ failure() }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: "Failed: ${{ github.workflow }} / ${{ github.job }}"
to: akka.official@gmail.com
from: Akka CI (GHActions)
body: |
Job ${{ github.job }} in workflow ${{ github.workflow }} of ${{github.repository}} failed!
https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

View file

@ -1,43 +0,0 @@
name: Nightly Akka Cluster Metrics Test with Sigar
on:
schedule:
- cron: '0 0 * * *'
jobs:
sbt:
name: Test Akka Cluster Metrics
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0
- name: Set up JDK 8
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.8.0
- name: Test
run: |-
sbt -jvm-opts .jvmopts-ci \
-Djava.security.egd=file:/dev/./urandom \
-Dakka.test.sigar=true \
-Dakka.cluster.assert=on \
clean akka-cluster-metrics/test
- name: Email on failure
if: ${{ failure() }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
# Using port 465 already sets `secure: true`
secure: true
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: PRValidation Failed (Akka)
to: akka.official@gmail.com
from: Akka CI (GHActions)
body: |
Nightly Akka Cluster Metrics Test with Sigar of ${{github.repository}} failed!
https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

View file

@ -1,46 +0,0 @@
name: Nightly jkd11
on:
schedule:
- cron: '0 6 * * *'
jobs:
compile-and-test:
name: Compile and test
runs-on: ubuntu-20.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
- name: Cache Coursier cache
uses: coursier/cache-action@v6.2
- name: Compile and test for JDK11
run: |-
sbt -jvm-opts .jvmopts-ci \
-Dakka.test.timefactor=1 \
-Dakka.genjavadoc.enabled=true \
-Dakka.test.multi-in-test=false \
clean test checkTestsHaveRun
- name: Email on failure
if: ${{ failure() }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: Nightly jkd11 Failed (Akka)
to: akka.official@gmail.com
from: Akka CI (GHActions)
body: |
Nightly jkd11 of ${{github.repository}} failed!
https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

View file

@ -1,47 +0,0 @@
name: Nightly jdk8/scala2.13
on:
schedule:
- cron: '0 20 * * *'
jobs:
compile-and-test:
name: Compile and test
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.8.0
- name: Cache Coursier cache
uses: coursier/cache-action@v6.2
- name: Compile and test for JDK8 (scala2.13)
run: |-
# TODO: restore -Dakka.test.multi-node.java=/usr/lib/jvm/jdk8u192-b12/bin/java
sbt -jvm-opts .jvmopts-ci \
-Dakka.ci-server=true \
-Dakka.build.scalaVersion=2.13.3 \
-Dakka.test.timefactor=1 \
-Dakka.cluster.assert=on \
clean compile test doc
- name: Email on failure
if: ${{ failure() }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: Nightly jdk8/scala2.13 Failed (Akka)
to: akka.official@gmail.com
from: Akka CI (GHActions)
body: |
Nightly jdk8/scala2.13 of ${{github.repository}} failed!
https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

View file

@ -1,52 +0,0 @@
name: Nightly jkd8
on:
schedule:
- cron: '0 4,21 * * *'
jobs:
compile-and-test:
name: Compile and test
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.8.0
- name: Cache Coursier cache
uses: coursier/cache-action@v6.2
- name: Compile and test for JDK ${{ matrix.JABBA_JDK }}, Scala ${{ matrix.SCALA_VERSION }}
run: |-
## TODO: restore the multi-node tests
sbt -jvm-opts .jvmopts-ci \
-Dakka.ci-server=true \
-Dakka.test.timefactor=1 \
-Dakka.cluster.assert=on \
-Dakka.test.metrics.reporters.0=console \
-Dakka.test.metrics.reporters.1=graphit \
-Dakka.test.metrics.reporter.graphite.prefix=jenkins \
-Dakka.test.metrics.reporter.graphite.host=54.72.154.120 \
-Dakka.sbt.statsd=false \
clean update test:compile test publishLocal publishM2
- name: Email on failure
if: ${{ failure() }}
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: Nightly jdk8 Failed (Akka)
to: akka.official@gmail.com
from: Akka CI (GHActions)
body: |
Nightly jdk8 of ${{github.repository}} failed!
https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

View file

@ -360,7 +360,7 @@ lazy val protobufV3 = akkaModule("akka-protobuf-v3")
// https://github.com/sbt/sbt-assembly/issues/400
.inLibrary(Dependencies.Compile.Provided.protobufRuntime)
.inProject),
assembly / assemblyOption := (assembly / assemblyOption).value.copy(includeScala = false, includeBin = false),
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false).withIncludeBin(false),
autoScalaLibrary := false, // do not include scala dependency in pom
exportJars := true, // in dependent projects, use assembled and shaded jar
makePomConfiguration := makePomConfiguration.value

View file

@ -4,12 +4,8 @@
package akka
import java.io.FileReader
import java.io.{ FileInputStream, InputStreamReader }
import java.util.Properties
import java.time.format.DateTimeFormatter
import java.time.ZonedDateTime
import java.time.ZoneOffset
import com.lightbend.paradox.projectinfo.ParadoxProjectInfoPluginKeys._
import com.typesafe.sbt.MultiJvmPlugin.autoImport.MultiJvm
import sbtassembly.AssemblyPlugin.autoImport._
@ -21,6 +17,13 @@ import scala.collection.breakOut
object AkkaBuild {
object CliOptions {
// CI is the env var defined by Github Actions and Travis:
// - https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables
// - https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
val runningOnCi: CliOption[Boolean] = CliOption("akka.ci-server", sys.env.contains("CI"))
}
val enableMiMa = true
val parallelExecutionByDefault = false // TODO: enable this once we're sure it does not break things
@ -108,6 +111,15 @@ object AkkaBuild {
}
}
private def jvmGCLogOptions(isJdk11OrHigher: Boolean, isJdk8: Boolean): Seq[String] = {
if (isJdk11OrHigher)
// -Xlog:gc* is equivalent to -XX:+PrintGCDetails. See:
// https://docs.oracle.com/en/java/javase/11/tools/java.html#GUID-BE93ABDC-999C-4CB5-A88B-1994AAAC74D5
Seq("-Xlog:gc*")
else if (isJdk8) Seq("-XX:+PrintGCTimeStamps", "-XX:+PrintGCDetails")
else Nil
}
// -XDignore.symbol.file suppresses sun.misc.Unsafe warnings
final val DefaultJavacOptions = Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-XDignore.symbol.file")
@ -132,8 +144,8 @@ object AkkaBuild {
crossVersion := CrossVersion.binary,
// Adds a `src/main/scala-2.13+` source directory for code shared
// between Scala 2.13 and Scala 3
unmanagedSourceDirectories in Compile ++= {
val sourceDir = (sourceDirectory in Compile).value
Compile / unmanagedSourceDirectories ++= {
val sourceDir = (Compile / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, n)) => Seq(sourceDir / "scala-2.13+")
case Some((2, n)) if n >= 13 => Seq(sourceDir / "scala-2.13+")
@ -191,10 +203,9 @@ object AkkaBuild {
// faster random source
"-Djava.security.egd=file:/dev/./urandom")
if (sys.props.contains("akka.ci-server"))
defaults ++ Seq("-XX:+PrintGCTimeStamps", "-XX:+PrintGCDetails")
else
defaults
defaults ++ CliOptions.runningOnCi
.ifTrue(jvmGCLogOptions(JdkOptions.isJdk11orHigher, JdkOptions.isJdk8))
.getOrElse(Nil)
},
// all system properties passed to sbt prefixed with "akka." will be passed on to the forked jvms as is
Test / javaOptions := {
@ -213,7 +224,7 @@ object AkkaBuild {
group.runPolicy match {
case Tests.SubProcess(forkOptions) =>
// format: off
group.copy(runPolicy = Tests.SubProcess(
group.withRunPolicy(Tests.SubProcess(
forkOptions.withWorkingDirectory(workingDirectory = Some(new File(System.getProperty("user.dir"))))))
// format: on
case _ => group

View file

@ -24,8 +24,7 @@ object MultiNode extends AutoPlugin {
// MultiJvm tests can be excluded from normal test target an validatePullRequest
// with -Dakka.test.multi-in-test=false
val multiNodeTestInTest: Boolean =
System.getProperty("akka.test.multi-in-test", "true") == "true"
val multiNodeTestInTest: Boolean = sys.props.getOrElse("akka.test.multi-in-test", "true").toBoolean
object CliOptions {
val multiNode = CliOption("akka.test.multi-node", false)
@ -85,7 +84,7 @@ object MultiNode extends AutoPlugin {
(name: String) =>
new Logger {
def trace(t: => Throwable): Unit = { logger.trace(t) }
def success(message: => String): Unit = { success(message) }
def success(message: => String): Unit = { logger.success(message) }
def log(level: Level.Value, message: => String): Unit =
logger.log(level, s"[${scala.Console.BLUE}$name${scala.Console.RESET}] $message")
}