2019-01-02 18:55:26 +08:00
|
|
|
/*
|
2022-02-04 12:36:44 +01:00
|
|
|
* Copyright (C) 2009-2022 Lightbend Inc. <https://www.lightbend.com>
|
2015-01-22 20:26:34 +02:00
|
|
|
*/
|
2018-03-13 23:45:55 +09:00
|
|
|
|
2022-11-12 10:21:24 +01:00
|
|
|
package org.apache.pekko
|
2015-01-22 20:26:34 +02:00
|
|
|
|
2019-01-15 12:23:27 +11:00
|
|
|
import com.hpe.sbt.ValidatePullRequest
|
|
|
|
|
import com.hpe.sbt.ValidatePullRequest.PathGlobFilter
|
2017-10-30 03:13:14 +02:00
|
|
|
import com.lightbend.paradox.sbt.ParadoxPlugin
|
|
|
|
|
import com.lightbend.paradox.sbt.ParadoxPlugin.autoImport.paradox
|
2016-12-02 14:23:13 +01:00
|
|
|
import com.typesafe.tools.mima.plugin.MimaKeys.mimaReportBinaryIssues
|
2016-03-10 10:45:35 +02:00
|
|
|
import com.typesafe.tools.mima.plugin.MimaPlugin
|
2017-10-30 03:13:14 +02:00
|
|
|
import sbtunidoc.BaseUnidocPlugin.autoImport.unidoc
|
2015-05-05 19:39:56 +02:00
|
|
|
import sbt.Keys._
|
|
|
|
|
import sbt._
|
|
|
|
|
|
2022-12-02 14:49:16 +01:00
|
|
|
object PekkoValidatePullRequest extends AutoPlugin {
|
2015-01-22 20:26:34 +02:00
|
|
|
|
2019-09-30 12:40:22 +02:00
|
|
|
object CliOptions {
|
2022-12-03 11:56:56 +01:00
|
|
|
val mimaEnabled = CliOption("pekko.mima.enabled", true)
|
2019-09-30 12:40:22 +02:00
|
|
|
}
|
|
|
|
|
|
2019-01-15 12:23:27 +11:00
|
|
|
import ValidatePullRequest.autoImport._
|
2015-01-22 20:26:34 +02:00
|
|
|
|
2015-05-12 16:10:27 +02:00
|
|
|
override def trigger = allRequirements
|
2019-01-15 12:23:27 +11:00
|
|
|
override def requires = ValidatePullRequest
|
2015-05-10 02:01:12 +02:00
|
|
|
|
2021-02-01 15:38:29 +00:00
|
|
|
val ValidatePR = config("pr-validation").extend(Test)
|
2015-05-05 19:39:56 +02:00
|
|
|
|
|
|
|
|
override lazy val projectConfigurations = Seq(ValidatePR)
|
|
|
|
|
|
2019-01-15 12:23:27 +11:00
|
|
|
val additionalTasks = settingKey[Seq[TaskKey[_]]]("Additional tasks for pull request validation")
|
2015-05-05 19:39:56 +02:00
|
|
|
|
2021-02-01 15:38:29 +00:00
|
|
|
override lazy val globalSettings = Seq(credentials ++= {
|
|
|
|
|
// todo this should probably be supplied properly
|
|
|
|
|
GitHub.envTokenOrThrow.map { token =>
|
|
|
|
|
Credentials("GitHub API", "api.github.com", "", token)
|
|
|
|
|
}
|
|
|
|
|
}, additionalTasks := Seq.empty)
|
2016-01-22 00:56:25 +01:00
|
|
|
|
2019-01-15 12:23:27 +11:00
|
|
|
override lazy val buildSettings = Seq(
|
|
|
|
|
validatePullRequest / includeFilter := PathGlobFilter("akka-*/**"),
|
|
|
|
|
validatePullRequestBuildAll / excludeFilter := PathGlobFilter("project/MiMa.scala"),
|
2021-09-27 14:09:23 +02:00
|
|
|
prValidatorGithubRepository := Some("akka/akka"),
|
|
|
|
|
prValidatorTargetBranch := "origin/main")
|
2015-12-01 16:53:48 +01:00
|
|
|
|
|
|
|
|
override lazy val projectSettings = inConfig(ValidatePR)(Defaults.testTasks) ++ Seq(
|
2021-05-25 12:50:51 +02:00
|
|
|
ValidatePR / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-l", "performance"),
|
|
|
|
|
ValidatePR / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-l", "long-running"),
|
|
|
|
|
ValidatePR / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-l", "timing"),
|
2021-08-24 11:27:47 -04:00
|
|
|
ValidatePR / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-l", "gh-exclude"),
|
2021-02-01 15:38:29 +00:00
|
|
|
// make it fork just like regular test running
|
2021-05-25 12:50:51 +02:00
|
|
|
ValidatePR / fork := (Test / fork).value,
|
|
|
|
|
ValidatePR / testGrouping := (Test / testGrouping).value,
|
|
|
|
|
ValidatePR / javaOptions := (Test / javaOptions).value,
|
|
|
|
|
prValidatorTasks := Seq(ValidatePR / test) ++ additionalTasks.value,
|
|
|
|
|
prValidatorEnforcedBuildAllTasks := Seq(Test / test) ++ additionalTasks.value)
|
2015-01-22 20:26:34 +02:00
|
|
|
}
|
2015-05-21 09:48:49 +03:00
|
|
|
|
|
|
|
|
/**
|
2021-02-01 15:38:29 +00:00
|
|
|
* This autoplugin adds Multi Jvm tests to validatePullRequest task.
|
|
|
|
|
* It is needed, because ValidatePullRequest autoplugin does not depend on MultiNode and
|
|
|
|
|
* therefore test:executeTests is not yet modified to include multi-jvm tests when ValidatePullRequest
|
|
|
|
|
* build strategy is being determined.
|
|
|
|
|
*
|
|
|
|
|
* Making ValidatePullRequest depend on MultiNode is impossible, as then ValidatePullRequest
|
|
|
|
|
* autoplugin would trigger only on projects which have both of these plugins enabled.
|
|
|
|
|
*/
|
2015-05-21 09:48:49 +03:00
|
|
|
object MultiNodeWithPrValidation extends AutoPlugin {
|
2022-12-02 14:49:16 +01:00
|
|
|
import PekkoValidatePullRequest._
|
2018-06-27 07:04:05 +02:00
|
|
|
import com.typesafe.sbt.MultiJvmPlugin.MultiJvmKeys.MultiJvm
|
2019-01-15 12:23:27 +11:00
|
|
|
|
2015-05-21 09:48:49 +03:00
|
|
|
override def trigger = allRequirements
|
2022-12-02 14:49:16 +01:00
|
|
|
override def requires = PekkoValidatePullRequest && MultiNode
|
2016-11-29 08:33:36 +01:00
|
|
|
override lazy val projectSettings =
|
2019-01-15 12:23:27 +11:00
|
|
|
if (MultiNode.multiNodeTestInTest) Seq(additionalTasks += MultiNode.multiTest)
|
2018-06-27 07:04:05 +02:00
|
|
|
else Seq.empty
|
2015-05-21 09:48:49 +03:00
|
|
|
}
|
|
|
|
|
|
2016-03-10 10:45:35 +02:00
|
|
|
/**
|
2021-02-01 15:38:29 +00:00
|
|
|
* This autoplugin adds MiMa binary issue reporting to validatePullRequest task,
|
|
|
|
|
* when a project has MimaPlugin autoplugin enabled.
|
|
|
|
|
*/
|
2016-03-10 10:45:35 +02:00
|
|
|
object MimaWithPrValidation extends AutoPlugin {
|
2022-12-02 14:49:16 +01:00
|
|
|
import PekkoValidatePullRequest._
|
2016-03-10 10:45:35 +02:00
|
|
|
|
|
|
|
|
override def trigger = allRequirements
|
2022-12-02 14:49:16 +01:00
|
|
|
override def requires = PekkoValidatePullRequest && MimaPlugin
|
2019-09-30 12:40:22 +02:00
|
|
|
override lazy val projectSettings =
|
|
|
|
|
CliOptions.mimaEnabled.ifTrue(additionalTasks += mimaReportBinaryIssues).toList
|
2017-10-30 03:13:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-01 15:38:29 +00:00
|
|
|
* This autoplugin adds Paradox doc generation to validatePullRequest task,
|
|
|
|
|
* when a project has ParadoxPlugin autoplugin enabled.
|
|
|
|
|
*/
|
2017-10-30 03:13:14 +02:00
|
|
|
object ParadoxWithPrValidation extends AutoPlugin {
|
2022-12-02 14:49:16 +01:00
|
|
|
import PekkoValidatePullRequest._
|
2017-10-30 03:13:14 +02:00
|
|
|
|
|
|
|
|
override def trigger = allRequirements
|
2022-12-02 14:49:16 +01:00
|
|
|
override def requires = PekkoValidatePullRequest && ParadoxPlugin
|
2021-05-25 12:50:51 +02:00
|
|
|
override lazy val projectSettings = Seq(additionalTasks += Compile / paradox)
|
2016-03-10 10:45:35 +02:00
|
|
|
}
|
|
|
|
|
|
2015-05-21 09:48:49 +03:00
|
|
|
object UnidocWithPrValidation extends AutoPlugin {
|
2022-12-02 14:49:16 +01:00
|
|
|
import PekkoValidatePullRequest._
|
2015-05-21 09:48:49 +03:00
|
|
|
|
|
|
|
|
override def trigger = noTrigger
|
2021-05-25 12:50:51 +02:00
|
|
|
override lazy val projectSettings = Seq(additionalTasks += Compile / unidoc)
|
2015-05-21 09:48:49 +03:00
|
|
|
}
|