From a975db36755d57779501105901979c6a6fba5ba8 Mon Sep 17 00:00:00 2001 From: Michal Bednarz Date: Fri, 30 Oct 2020 11:18:33 +0100 Subject: [PATCH] Enable examples in CI --- .travis.yml | 2 ++ examples/src/test/resources/ideprobe.conf | 6 +++--- .../scala/org/virtuslab/ideprobe/ModuleTest.scala | 14 +++++++------- project/CI.scala | 4 +++- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index becb9e4d..e72b50b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,8 @@ jobs: script: ci/tests/run probe 2.13.1 - name: test-scala @ scala-2.13 script: ci/tests/run scala 2.13.1 + - name: test-examples @ scala-2.13 + script: ci/tests/run examples 2.13.1 - stage: Release name: Release script: sbt ci-release diff --git a/examples/src/test/resources/ideprobe.conf b/examples/src/test/resources/ideprobe.conf index e20619a5..d4451dfa 100644 --- a/examples/src/test/resources/ideprobe.conf +++ b/examples/src/test/resources/ideprobe.conf @@ -5,9 +5,9 @@ probe { ] } endpoints.awaitIdle { - initialWait = "0 seconds" - newTaskWait = "1 second" - checkFrequency = "100 millis" + initialWait = "2 seconds" + newTaskWait = "2 second" + checkFrequency = "250 millis" } paths.screenshots = ${?IDEPROBE_SCREENSHOTS_DIR} } diff --git a/examples/src/test/scala/org/virtuslab/ideprobe/ModuleTest.scala b/examples/src/test/scala/org/virtuslab/ideprobe/ModuleTest.scala index 805e3c0b..87853833 100644 --- a/examples/src/test/scala/org/virtuslab/ideprobe/ModuleTest.scala +++ b/examples/src/test/scala/org/virtuslab/ideprobe/ModuleTest.scala @@ -11,12 +11,6 @@ import org.virtuslab.ideprobe.scala.protocol.SbtProjectSettingsChangeRequest class ModuleTest extends IdeProbeFixture with ScalaPluginExtension with RobotPluginExtension { - registerFixtureTransformer(_.withAfterIntelliJStartup((fixture, intelliJ) => { - deleteIdeaSettings(intelliJ) - intelliJ.probe.withRobot.openProject(intelliJ.workspace) - useSbtShell(intelliJ) - })) - @ParameterizedTest @ValueSource( strings = Array( @@ -25,7 +19,10 @@ class ModuleTest extends IdeProbeFixture with ScalaPluginExtension with RobotPlu "projects/dokka.conf" ) ) - @Test def runTestsInDifferentScopes(configName: String): Unit = fixtureFromConfig(configName).run { intelliJ => + def runTestsInDifferentScopes(configName: String): Unit = fixtureFromConfig(configName).run { intelliJ => + deleteIdeaSettings(intelliJ) + intelliJ.probe.withRobot.openProject(intelliJ.workspace) + useSbtShell(intelliJ) val runnerToSelect = intelliJ.config.get[String]("runner") val modulesToTest = intelliJ.config[Seq[String]]("modules.test") intelliJ.probe.build().assertSuccess() @@ -45,6 +42,9 @@ class ModuleTest extends IdeProbeFixture with ScalaPluginExtension with RobotPlu ) ) def verifyModulesPresent(configName: String): Unit = fixtureFromConfig(configName).run { intelliJ => + deleteIdeaSettings(intelliJ) + intelliJ.probe.withRobot.openProject(intelliJ.workspace) + useSbtShell(intelliJ) val project = intelliJ.probe.projectModel() val expectedModules = intelliJ.config[Seq[String]]("modules.verify") val missingModules = expectedModules.diff(project.moduleNames) diff --git a/project/CI.scala b/project/CI.scala index c3085638..cde1b7e4 100644 --- a/project/CI.scala +++ b/project/CI.scala @@ -4,7 +4,7 @@ import sbt.Keys.loadedBuild import sbt.{Def, ProjectRef, _} object CI { - private val excluded = Set("ci", "ide-probe", "ideprobe", "probe", "examples") + private val excluded = Set("ci", "ide-probe", "ideprobe", "probe") lazy val generateScripts = taskKey[Seq[File]]("Generate CI scripts") private def scalaVersionToModulePostfix(scalaVersion: String): String = @@ -12,6 +12,7 @@ object CI { def groupedProjects(scalaVersions: List[String]): Def.Initialize[Task[Map[String, Seq[ProjectRef]]]] = Def.task { val extensionDir = Paths.get(loadedBuild.value.root).resolve("extensions") + val examplesDir = Paths.get(loadedBuild.value.root).resolve("examples") val excludedCross = for { version <- scalaVersions module <- excluded @@ -23,6 +24,7 @@ object CI { case (_, project) => val projectPath = project.base.toPath if (projectPath.startsWith(extensionDir)) extensionDir.relativize(projectPath).getName(0).toString + else if (projectPath.startsWith(examplesDir)) "examples" else "probe" } .mapValues(_.map(_._1))