-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michal Bednarz
committed
Nov 23, 2020
1 parent
e1ef66b
commit 6dc14a5
Showing
9 changed files
with
91 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- 2020.3 | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: release | ||
run: sbt ci-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Test | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
test: | ||
timeout-minutes: 120 | ||
runs-on: ubuntu-latest | ||
name: test-${{ matrix.type }} | ||
strategy: | ||
matrix: | ||
type: [probe 2.12.10, probe 2.13.1, scala 2.13.1, examples 2.13.1] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: generate scripts | ||
run: sbt ci/generateScripts | ||
- name: build image | ||
run: sh ci/tests/build_image | ||
- name: test | ||
run: sh ci/tests/run ${{ matrix.type }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 46 additions & 55 deletions
101
examples/src/test/scala/org/virtuslab/ideprobe/ModuleTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,64 @@ | ||
package org.virtuslab.ideprobe | ||
|
||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.ValueSource | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import org.junit.runners.Parameterized.Parameters | ||
import org.junit.{Assert, Test} | ||
import org.virtuslab.ideprobe.Extensions._ | ||
import org.virtuslab.ideprobe.dependencies.{IntelliJVersion, Plugin} | ||
import org.virtuslab.ideprobe.protocol._ | ||
import org.virtuslab.ideprobe.robot.RobotPluginExtension | ||
import org.virtuslab.ideprobe.scala.ScalaPluginExtension | ||
import org.virtuslab.ideprobe.scala.protocol.SbtProjectSettingsChangeRequest | ||
|
||
class ModuleTest extends IdeProbeFixture with ScalaPluginExtension with RobotPluginExtension { | ||
@RunWith(classOf[Parameterized]) | ||
class ModuleTest(configName: String) extends IdeProbeFixture with ScalaPluginExtension with RobotPluginExtension { | ||
registerFixtureTransformer(_.withAfterIntelliJStartup((fixture, intelliJ) => { | ||
deleteIdeaSettings(intelliJ) | ||
intelliJ.probe.withRobot.openProject(intelliJ.workspace) | ||
useSbtShell(intelliJ) | ||
})) | ||
|
||
registerFixtureTransformer(_.withAfterIntelliJStartup((fixture, intelliJ) => { | ||
deleteIdeaSettings(intelliJ) | ||
intelliJ.probe.withRobot.openProject(intelliJ.workspace) | ||
useSbtShell(intelliJ) | ||
})) | ||
|
||
@ParameterizedTest | ||
@ValueSource( | ||
strings = Array( | ||
"projects/io.conf", | ||
"projects/librarymanagement.conf", | ||
"projects/dokka.conf" | ||
) | ||
) | ||
@Test def runTestsInDifferentScopes(configName: String): Unit = fixtureFromConfig(configName).run { intelliJ => | ||
val runnerToSelect = intelliJ.config.get[String]("runner") | ||
val modulesToTest = intelliJ.config[Seq[String]]("modules.test") | ||
intelliJ.probe.build().assertSuccess() | ||
modulesToTest.foreach { moduleName => | ||
val scope = TestScope.Module(ModuleRef(moduleName)) | ||
val result = intelliJ.probe.runTestsFromGenerated(scope, runnerToSelect) | ||
Assert.assertTrue(s"Test result $result should not be empty", result.suites.nonEmpty) | ||
@Test def verifyModulesPresent: Unit = fixtureFromConfig(configName).run { intelliJ => | ||
val project = intelliJ.probe.projectModel() | ||
val expectedModules = intelliJ.config[Seq[String]]("modules.verify") | ||
val missingModules = expectedModules.diff(project.moduleNames) | ||
Assert.assertTrue(s"Modules $missingModules are missing", missingModules.isEmpty) | ||
} | ||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource( | ||
strings = Array( | ||
"projects/io.conf", | ||
"projects/librarymanagement.conf", | ||
"projects/dokka.conf" | ||
) | ||
) | ||
def verifyModulesPresent(configName: String): Unit = fixtureFromConfig(configName).run { intelliJ => | ||
val project = intelliJ.probe.projectModel() | ||
val expectedModules = intelliJ.config[Seq[String]]("modules.verify") | ||
val missingModules = expectedModules.diff(project.moduleNames) | ||
Assert.assertTrue(s"Modules $missingModules are missing", missingModules.isEmpty) | ||
} | ||
@Test def runTestsInDifferentScopes: Unit = fixtureFromConfig(configName).run { intelliJ => | ||
val runnerToSelect = intelliJ.config.get[String]("runner") | ||
val modulesToTest = intelliJ.config[Seq[String]]("modules.test") | ||
intelliJ.probe.build().assertSuccess() | ||
modulesToTest.foreach { moduleName => | ||
val scope = TestScope.Module(ModuleRef(moduleName)) | ||
val result = intelliJ.probe.runTestsFromGenerated(scope, runnerToSelect) | ||
Assert.assertTrue(s"Test result $result should not be empty", result.suites.nonEmpty) | ||
} | ||
} | ||
|
||
protected def useSbtShell(intelliJ: RunningIntelliJFixture): Unit = { | ||
if (intelliJ.workspace.resolve("build.sbt").isFile) { | ||
intelliJ.probe.setSbtProjectSettings( | ||
SbtProjectSettingsChangeRequest( | ||
useSbtShellForImport = Setting.Changed(true), | ||
useSbtShellForBuild = Setting.Changed(true) | ||
protected def useSbtShell(intelliJ: RunningIntelliJFixture): Unit = { | ||
if (intelliJ.workspace.resolve("build.sbt").isFile) { | ||
intelliJ.probe.setSbtProjectSettings( | ||
SbtProjectSettingsChangeRequest( | ||
useSbtShellForImport = Setting.Changed(true), | ||
useSbtShellForBuild = Setting.Changed(true) | ||
) | ||
) | ||
) | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* The presence of .idea can prevent automatic import of gradle project | ||
*/ | ||
private def deleteIdeaSettings(intelliJ: RunningIntelliJFixture): Unit = { | ||
val path = intelliJ.workspace.resolve(".idea") | ||
if (path.isDirectory) path.delete() | ||
} | ||
/** | ||
* The presence of .idea can prevent automatic import of gradle project | ||
*/ | ||
private def deleteIdeaSettings(intelliJ: RunningIntelliJFixture): Unit = { | ||
val path = intelliJ.workspace.resolve(".idea") | ||
if (path.isDirectory) path.delete() | ||
} | ||
} | ||
|
||
object ModuleTest { | ||
@Parameters(name = "{0}") def data: java.util.Collection[String] = { | ||
java.util.Arrays.asList("projects/io.conf", "projects/librarymanagement.conf", "projects/dokka.conf") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters