Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cucumber-plugin #60

Merged
merged 8 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Satify Build, Format and Coverage
name: Satify Build

on:
push:
Expand Down Expand Up @@ -34,6 +34,8 @@ jobs:
cache: 'sbt'
- name: Run tests
run: sbt test
- name: Run cucumber tests
run: sbt cucumber

format:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create Release
name: Satify Release

on:
pull_request:
Expand Down
34 changes: 26 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,46 @@ ThisBuild / version := "0.1.0-SNAPSHOT"
val languageVersion = "3.3.0"
ThisBuild / scalaVersion := languageVersion

Test / fork := true

val scalaTest = "org.scalatest" %% "scalatest" % "3.2.16" % Test
val archUnit = "com.tngtech.archunit" % "archunit" % "1.0.0" % Test
val archUnit = "com.tngtech.archunit" % "archunit" % "1.1.0" % Test
val scalaSwing = "org.scala-lang.modules" %% "scala-swing" % "3.0.0"
val slf4jSimpleLog = "org.slf4j" % "slf4j-simple" % "2.0.7" % Test
val scalaCompiler = "org.scala-lang" %% "scala3-compiler" % languageVersion
val cucumber = "io.cucumber" %% "cucumber-scala" % "8.14.1" % Test
val cucumberScala = "io.cucumber" %% "cucumber-scala" % "8.14.1" % Test

lazy val root = (project in file("."))
.settings(
name := "satify",
libraryDependencies ++= Seq(scalaTest, archUnit, slf4jSimpleLog, scalaSwing, scalaCompiler, cucumber),
libraryDependencies ++= Seq(scalaTest, archUnit, slf4jSimpleLog, scalaSwing, scalaCompiler, cucumberScala),
assembly / assemblyJarName := "satify.jar"
)

jacocoReportSettings := JacocoReportSettings()
.withTitle("Jacoco Satify Coverage Report")
.withThresholds(
JacocoThresholds(
branch = 40,
line = 70)
JacocoThresholds(branch = 40, line = 70)
)
.withFormats(JacocoReportFormats.ScalaHTML)

jacocoExcludes := Seq("*view*", "*update.Message*", "*Main*")

lazy val cucumber = taskKey[Unit]("Executes cucumber tests")
cucumber := {
val opts = ForkOptions(
javaHome = None,
outputStrategy = Some(StdoutOutput),
bootJars = Vector.empty,
workingDirectory = None,
runJVMOptions = Vector(
"-classpath",
(Test / fullClasspath).value
.filterNot(_.data.toString.contains("instrumented"))
.map(_.data)
.mkString(if (org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS) ";" else ":"),
"io.cucumber.core.cli.Main"
),
connectInput = false,
envVars = Map[String, String](),
)
Fork.java(opts, List())
}
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.4.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0")
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.4.0")
2 changes: 1 addition & 1 deletion src/main/scala/satify/dsl/Reflection.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ object Reflection:
"""import satify.model.expression.Expression
|import satify.dsl.DSL.{*, given}
|""".stripMargin
println(imports + code)
println(code)
dotty.tools.repl.ScriptEngine().eval(imports + code).asInstanceOf[Expression]
1 change: 1 addition & 0 deletions src/test/resources/cucumber.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cucumber.publish.quiet=true
7 changes: 0 additions & 7 deletions src/test/resources/features/Example.feature

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package steps
package satify.features

import io.cucumber.scala.{EN, ScalaDsl}
import org.scalatest.matchers.should.Matchers.*
Expand All @@ -7,7 +7,7 @@ import satify.model.CNF
import satify.model.expression.Expression
import satify.update.converters.TseitinTransformation.tseitin

class TseitinTransformation extends ScalaDsl with EN:
class TseitinTransformationSteps extends ScalaDsl with EN:
var exp: Expression = _
var cnf: CNF = _
Given("""The expression {string}""")((strExp: String) => exp = reflect(strExp))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package parser
package satify.parser

import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
Expand Down
12 changes: 0 additions & 12 deletions src/test/scala/steps/ExampleCucumberSteps.scala

This file was deleted.