From 74c214f6f8ceef0bbcaad73a9c830f684e786784 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 7 Sep 2021 12:06:09 +0000 Subject: [PATCH 01/24] Setup Safari ci --- .github/workflows/ci.yml | 13 +++++++++++-- build.sbt | 14 +++++++++++++- project/JSEnv.scala | 1 + 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7bcec4..a868d5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,10 +25,19 @@ jobs: name: Build and Test strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest] scala: [2.12.14, 2.13.6, 3.0.2] java: [adopt@1.8] - ci: [ciNode, ciFirefox, ciChrome, ciJSDOMNodeJS] + ci: [ciNode, ciFirefox, ciChrome, ciSafari, ciJSDOMNodeJS] + exclude: + - ci: ciNode + os: macos-latest + - ci: ciFirefox + os: macos-latest + - ci: ciChrome + os: macos-latest + - ci: ciJSDOMNodeJS + os: macos-latest runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) diff --git a/build.sbt b/build.sbt index 64e9afc..29fd4e1 100644 --- a/build.sbt +++ b/build.sbt @@ -17,6 +17,7 @@ import org.openqa.selenium.WebDriver import org.openqa.selenium.chrome.{ChromeDriver, ChromeOptions} import org.openqa.selenium.firefox.{FirefoxOptions, FirefoxProfile} +import org.openqa.selenium.safari.{SafariOptions, SafariDriver} import org.openqa.selenium.remote.server.{DriverFactory, DriverProvider} import org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv @@ -47,6 +48,10 @@ ThisBuild / scmInfo := Some( ThisBuild / crossScalaVersions := Seq("2.12.14", "2.13.6", "3.0.2") +val PrimaryOS = "ubuntu-latest" +val MacOS = "macos-latest" +ThisBuild / githubWorkflowOSes := Seq(PrimaryOS, MacOS) + ThisBuild / githubWorkflowBuildPreamble ++= Seq( WorkflowStep.Use( UseRef.Public("actions", "setup-node", "v2.1.2"), @@ -58,7 +63,10 @@ ThisBuild / githubWorkflowBuildPreamble ++= Seq( name = Some("Install jsdom"), cond = Some("matrix.ci == 'ciJSDOMNodeJS'"))) -val ciVariants = List("ciNode", "ciFirefox", "ciChrome", "ciJSDOMNodeJS") +val ciVariants = List("ciNode", "ciFirefox", "ciChrome", "ciSafari", "ciJSDOMNodeJS") + +ThisBuild / githubWorkflowBuildMatrixExclusions ++= ciVariants.filter(_ != "ciSafari") + .map(ci => MatrixExclude(Map("ci" -> ci, "os" -> MacOS))) ThisBuild / githubWorkflowBuildMatrixAdditions += "ci" -> ciVariants @@ -69,6 +77,7 @@ replaceCommandAlias("ci", ciVariants.mkString("; ", "; ", "")) addCommandAlias("ciNode", "; set useJSEnv := JSEnv.NodeJS; core/test; core/doc") addCommandAlias("ciFirefox", "; set useJSEnv := JSEnv.Firefox; all core/test webworker/test; set useJSEnv := JSEnv.NodeJS") addCommandAlias("ciChrome", "; set useJSEnv := JSEnv.Chrome; all core/test webworker/test; set useJSEnv := JSEnv.NodeJS") +addCommandAlias("ciSafari", "; set useJSEnv := JSEnv.Safari; all core/test; set useJSEnv := JSEnv.NodeJS") addCommandAlias("ciJSDOMNodeJS", "; set useJSEnv := JSEnv.JSDOMNodeJS; core/test; set useJSEnv := JSEnv.NodeJS") // release configuration @@ -130,6 +139,9 @@ ThisBuild / Test / jsEnv := { defaultFactory.registerDriverProvider(provider) } new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) + case Safari => + val options = new SafariOptions() + new SeleniumJSEnv(options) } } diff --git a/project/JSEnv.scala b/project/JSEnv.scala index 4cd815f..99352a1 100644 --- a/project/JSEnv.scala +++ b/project/JSEnv.scala @@ -2,6 +2,7 @@ sealed abstract class JSEnv object JSEnv { case object Chrome extends JSEnv case object Firefox extends JSEnv + case object Safari extends JSEnv case object JSDOMNodeJS extends JSEnv case object NodeJS extends JSEnv } From 31bab00eb1d6f1ab99012c3b2b8835eb636b71e3 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 7 Sep 2021 12:10:14 +0000 Subject: [PATCH 02/24] Don't run Safari on ubuntu --- .github/workflows/ci.yml | 2 ++ build.sbt | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a868d5e..aece75d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,8 @@ jobs: java: [adopt@1.8] ci: [ciNode, ciFirefox, ciChrome, ciSafari, ciJSDOMNodeJS] exclude: + - ci: ciSafari + os: ubuntu-latest - ci: ciNode os: macos-latest - ci: ciFirefox diff --git a/build.sbt b/build.sbt index 29fd4e1..138b9a8 100644 --- a/build.sbt +++ b/build.sbt @@ -65,6 +65,7 @@ ThisBuild / githubWorkflowBuildPreamble ++= Seq( val ciVariants = List("ciNode", "ciFirefox", "ciChrome", "ciSafari", "ciJSDOMNodeJS") +ThisBuild / githubWorkflowBuildMatrixExclusions += MatrixExclude(Map("ci" -> "ciSafari", "os" -> PrimaryOS)) ThisBuild / githubWorkflowBuildMatrixExclusions ++= ciVariants.filter(_ != "ciSafari") .map(ci => MatrixExclude(Map("ci" -> ci, "os" -> MacOS))) From 779f485c5f3c864ea19dc2feb61ff1de8decbe9b Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 7 Sep 2021 13:25:30 +0000 Subject: [PATCH 03/24] Cache Safari JSEnv --- build.sbt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 138b9a8..27f5cc7 100644 --- a/build.sbt +++ b/build.sbt @@ -109,6 +109,11 @@ lazy val useJSEnv = Global / useJSEnv := JSEnv.NodeJS +lazy val safariEnv = { + val options = new SafariOptions() + new SeleniumJSEnv(options) +} + ThisBuild / Test / jsEnv := { import JSEnv._ @@ -141,8 +146,7 @@ ThisBuild / Test / jsEnv := { } new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) case Safari => - val options = new SafariOptions() - new SeleniumJSEnv(options) + safariEnv } } From 35e7b42d8749c68bac5d0bc522a51f03be09b853 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 12 Sep 2021 16:01:45 +0000 Subject: [PATCH 04/24] Revert "Cache Safari JSEnv" This reverts commit 779f485c5f3c864ea19dc2feb61ff1de8decbe9b. --- build.sbt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index 27f5cc7..138b9a8 100644 --- a/build.sbt +++ b/build.sbt @@ -109,11 +109,6 @@ lazy val useJSEnv = Global / useJSEnv := JSEnv.NodeJS -lazy val safariEnv = { - val options = new SafariOptions() - new SeleniumJSEnv(options) -} - ThisBuild / Test / jsEnv := { import JSEnv._ @@ -146,7 +141,8 @@ ThisBuild / Test / jsEnv := { } new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) case Safari => - safariEnv + val options = new SafariOptions() + new SeleniumJSEnv(options) } } From e0ed1b7ef1951b2736370f48459609c742612ccc Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 12 Sep 2021 16:08:45 +0000 Subject: [PATCH 05/24] Enable Test / parallelExecution := false --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 138b9a8..1fcc60a 100644 --- a/build.sbt +++ b/build.sbt @@ -146,6 +146,7 @@ ThisBuild / Test / jsEnv := { } } +ThisBuild / Test / parallelExecution := false ThisBuild / Test / testOptions += Tests.Argument(MUnitFramework, "+l") // project structure From 534e8ec5abf82a9a9ef09d64fbf7fc8faa2ad1a2 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 12 Sep 2021 16:27:31 +0000 Subject: [PATCH 06/24] Try adding a killall --- build.sbt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.sbt b/build.sbt index 66ed18f..92f7b4b 100644 --- a/build.sbt +++ b/build.sbt @@ -141,6 +141,8 @@ ThisBuild / Test / jsEnv := { } new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) case Safari => + import scala.sys.process._ + Process("killall", "Safari").! val options = new SafariOptions() new SeleniumJSEnv(options) } From 196f429500ce7b1c12ab2cc404a27dda574510ea Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 12 Sep 2021 16:29:53 +0000 Subject: [PATCH 07/24] Use correct syntax --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 92f7b4b..d85ea0e 100644 --- a/build.sbt +++ b/build.sbt @@ -142,7 +142,7 @@ ThisBuild / Test / jsEnv := { new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) case Safari => import scala.sys.process._ - Process("killall", "Safari").! + Process(List("killall", "Safari")).! val options = new SafariOptions() new SeleniumJSEnv(options) } From 04623602e0ad62d91a739dd624ef18d3bf25f8a7 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Tue, 7 Sep 2021 13:25:30 +0000 Subject: [PATCH 08/24] Cache Safari JSEnv --- build.sbt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index d85ea0e..3519933 100644 --- a/build.sbt +++ b/build.sbt @@ -109,6 +109,13 @@ lazy val useJSEnv = Global / useJSEnv := JSEnv.NodeJS +lazy val safariEnv = { + import scala.sys.process._ + Process(List("killall", "Safari")).! + val options = new SafariOptions() + new SeleniumJSEnv(options) +} + ThisBuild / Test / jsEnv := { import JSEnv._ @@ -141,10 +148,7 @@ ThisBuild / Test / jsEnv := { } new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) case Safari => - import scala.sys.process._ - Process(List("killall", "Safari")).! - val options = new SafariOptions() - new SeleniumJSEnv(options) + safariEnv } } From d4f7279b9208940981948cc689a31694b3cae3da Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 12 Sep 2021 16:37:42 +0000 Subject: [PATCH 09/24] Test only core on Safari for now --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 3519933..1a928a2 100644 --- a/build.sbt +++ b/build.sbt @@ -78,7 +78,7 @@ replaceCommandAlias("ci", ciVariants.mkString("; ", "; ", "")) addCommandAlias("ciNode", "; set Global / useJSEnv := JSEnv.NodeJS; test; core/doc") addCommandAlias("ciFirefox", "; set Global / useJSEnv := JSEnv.Firefox; test; set Global / useJSEnv := JSEnv.NodeJS") addCommandAlias("ciChrome", "; set Global / useJSEnv := JSEnv.Chrome; test; set Global / useJSEnv := JSEnv.NodeJS") -addCommandAlias("ciSafari", "; set Global / useJSEnv := JSEnv.Safari; test; set Global / useJSEnv := JSEnv.NodeJS") +addCommandAlias("ciSafari", "; set Global / useJSEnv := JSEnv.Safari; core / test; set Global / useJSEnv := JSEnv.NodeJS") addCommandAlias("ciJSDOMNodeJS", "; set Global / useJSEnv := JSEnv.JSDOMNodeJS; test; set Global / useJSEnv := JSEnv.NodeJS") // release configuration From 419e29e265021bcc30661c035063090866576dbd Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Sun, 12 Sep 2021 17:50:29 +0000 Subject: [PATCH 10/24] Enable keepAlive --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 1a928a2..3756177 100644 --- a/build.sbt +++ b/build.sbt @@ -113,7 +113,7 @@ lazy val safariEnv = { import scala.sys.process._ Process(List("killall", "Safari")).! val options = new SafariOptions() - new SeleniumJSEnv(options) + new SeleniumJSEnv(options, SeleniumJSEnv.Config().withKeepAlive(true)) } ThisBuild / Test / jsEnv := { From 1cc8fce96b4aeb30a6fd2dfc8ab6bdfc1a7ef6f1 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 17:36:49 +0000 Subject: [PATCH 11/24] Don't do weird stuff --- build.sbt | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index 2211a05..2b4f87b 100644 --- a/build.sbt +++ b/build.sbt @@ -109,13 +109,6 @@ lazy val useJSEnv = Global / useJSEnv := JSEnv.NodeJS -lazy val safariEnv = { - import scala.sys.process._ - Process(List("killall", "Safari")).! - val options = new SafariOptions() - new SeleniumJSEnv(options, SeleniumJSEnv.Config().withKeepAlive(true)) -} - ThisBuild / Test / jsEnv := { import JSEnv._ @@ -148,7 +141,8 @@ ThisBuild / Test / jsEnv := { } new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) case Safari => - safariEnv + val options = new SafariOptions() + new SeleniumJSEnv(options, SeleniumJSEnv.Config().withKeepAlive(true)) } } From 0db7bf60ca4ddde5f7fedce201ee08446888cbe1 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 17:50:19 +0000 Subject: [PATCH 12/24] Simplify build config --- .github/workflows/ci.yml | 14 +++----------- build.sbt | 8 +++----- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cb5c9a..dfe8d8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,20 +25,12 @@ jobs: name: Build and Test strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest] scala: [2.11.12, 2.12.15, 2.13.7, 3.0.2] java: [temurin@11] - ci: [ciNode, ciFirefox, ciChrome, ciSafari, ciJSDOMNodeJS] - exclude: + ci: [ciNode, ciFirefox, ciChrome, ciJSDOMNodeJS] + include: - ci: ciSafari - os: ubuntu-latest - - ci: ciNode - os: macos-latest - - ci: ciFirefox - os: macos-latest - - ci: ciChrome - os: macos-latest - - ci: ciJSDOMNodeJS os: macos-latest runs-on: ${{ matrix.os }} steps: diff --git a/build.sbt b/build.sbt index 2b4f87b..bc4a27a 100644 --- a/build.sbt +++ b/build.sbt @@ -50,7 +50,7 @@ ThisBuild / crossScalaVersions := Seq("2.11.12", "2.12.15", "2.13.7", "3.0.2") val PrimaryOS = "ubuntu-latest" val MacOS = "macos-latest" -ThisBuild / githubWorkflowOSes := Seq(PrimaryOS, MacOS) +ThisBuild / githubWorkflowOSes := Seq(PrimaryOS) ThisBuild / githubWorkflowBuildPreamble ++= Seq( WorkflowStep.Use( @@ -63,11 +63,9 @@ ThisBuild / githubWorkflowBuildPreamble ++= Seq( name = Some("Install jsdom"), cond = Some("matrix.ci == 'ciJSDOMNodeJS'"))) -val ciVariants = List("ciNode", "ciFirefox", "ciChrome", "ciSafari", "ciJSDOMNodeJS") +val ciVariants = List("ciNode", "ciFirefox", "ciChrome", "ciJSDOMNodeJS") -ThisBuild / githubWorkflowBuildMatrixExclusions += MatrixExclude(Map("ci" -> "ciSafari", "os" -> PrimaryOS)) -ThisBuild / githubWorkflowBuildMatrixExclusions ++= ciVariants.filter(_ != "ciSafari") - .map(ci => MatrixExclude(Map("ci" -> ci, "os" -> MacOS))) +ThisBuild / githubWorkflowBuildMatrixInclusions += MatrixInclude(Map.empty, Map("ci" -> "ciSafari", "os" -> MacOS)) ThisBuild / githubWorkflowBuildMatrixAdditions += "ci" -> ciVariants From 1eb424a6fa951e767c4c57e5aecd3d6c355c2774 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 17:52:53 +0000 Subject: [PATCH 13/24] Revert "Simplify build config" This reverts commit 0db7bf60ca4ddde5f7fedce201ee08446888cbe1. --- .github/workflows/ci.yml | 14 +++++++++++--- build.sbt | 8 +++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfe8d8e..2cb5c9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,12 +25,20 @@ jobs: name: Build and Test strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest] scala: [2.11.12, 2.12.15, 2.13.7, 3.0.2] java: [temurin@11] - ci: [ciNode, ciFirefox, ciChrome, ciJSDOMNodeJS] - include: + ci: [ciNode, ciFirefox, ciChrome, ciSafari, ciJSDOMNodeJS] + exclude: - ci: ciSafari + os: ubuntu-latest + - ci: ciNode + os: macos-latest + - ci: ciFirefox + os: macos-latest + - ci: ciChrome + os: macos-latest + - ci: ciJSDOMNodeJS os: macos-latest runs-on: ${{ matrix.os }} steps: diff --git a/build.sbt b/build.sbt index bc4a27a..2b4f87b 100644 --- a/build.sbt +++ b/build.sbt @@ -50,7 +50,7 @@ ThisBuild / crossScalaVersions := Seq("2.11.12", "2.12.15", "2.13.7", "3.0.2") val PrimaryOS = "ubuntu-latest" val MacOS = "macos-latest" -ThisBuild / githubWorkflowOSes := Seq(PrimaryOS) +ThisBuild / githubWorkflowOSes := Seq(PrimaryOS, MacOS) ThisBuild / githubWorkflowBuildPreamble ++= Seq( WorkflowStep.Use( @@ -63,9 +63,11 @@ ThisBuild / githubWorkflowBuildPreamble ++= Seq( name = Some("Install jsdom"), cond = Some("matrix.ci == 'ciJSDOMNodeJS'"))) -val ciVariants = List("ciNode", "ciFirefox", "ciChrome", "ciJSDOMNodeJS") +val ciVariants = List("ciNode", "ciFirefox", "ciChrome", "ciSafari", "ciJSDOMNodeJS") -ThisBuild / githubWorkflowBuildMatrixInclusions += MatrixInclude(Map.empty, Map("ci" -> "ciSafari", "os" -> MacOS)) +ThisBuild / githubWorkflowBuildMatrixExclusions += MatrixExclude(Map("ci" -> "ciSafari", "os" -> PrimaryOS)) +ThisBuild / githubWorkflowBuildMatrixExclusions ++= ciVariants.filter(_ != "ciSafari") + .map(ci => MatrixExclude(Map("ci" -> ci, "os" -> MacOS))) ThisBuild / githubWorkflowBuildMatrixAdditions += "ci" -> ciVariants From 367775da1217eae5a8728a19daffd2f114be6662 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 17:57:04 +0000 Subject: [PATCH 14/24] Remove keepalive for Safari --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2b4f87b..67c4d83 100644 --- a/build.sbt +++ b/build.sbt @@ -142,7 +142,7 @@ ThisBuild / Test / jsEnv := { new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) case Safari => val options = new SafariOptions() - new SeleniumJSEnv(options, SeleniumJSEnv.Config().withKeepAlive(true)) + new SeleniumJSEnv(options, SeleniumJSEnv.Config()) } } From 65913cc71c2ebcc12520293e91e9f6b25b51b3c5 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 18:05:42 +0000 Subject: [PATCH 15/24] Temporarily disable webworkers project --- build.sbt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/build.sbt b/build.sbt index 67c4d83..79c3613 100644 --- a/build.sbt +++ b/build.sbt @@ -152,7 +152,7 @@ ThisBuild / Test / testOptions += Tests.Argument(MUnitFramework, "+l") // project structure lazy val root = project - .aggregate(core, webworker) + .aggregate(core) .enablePlugins(NoPublishPlugin) lazy val core = project @@ -164,17 +164,17 @@ lazy val core = project .enablePlugins(ScalaJSPlugin) // this project solely exists for testing purposes -lazy val webworker = project - .in(file("webworker")) - .dependsOn(core % "compile->test") - .settings( - name := "scala-js-macrotask-executor-webworker", - scalaJSUseMainModuleInitializer := true, - libraryDependencies ++= Seq( - "org.scala-js" %%% "scalajs-dom" % "2.0.0", - "org.scalameta" %%% "munit" % MUnitVersion % Test, - ), - (Test / test) := (Test / test).dependsOn(Compile / fastOptJS).value, - buildInfoKeys := Seq(scalaVersion, baseDirectory, BuildInfoKey("isBrowser" -> useJSEnv.value.isBrowser)), - buildInfoPackage := "org.scalajs.macrotaskexecutor") - .enablePlugins(ScalaJSPlugin, BuildInfoPlugin, NoPublishPlugin) +// lazy val webworker = project +// .in(file("webworker")) +// .dependsOn(core % "compile->test") +// .settings( +// name := "scala-js-macrotask-executor-webworker", +// scalaJSUseMainModuleInitializer := true, +// libraryDependencies ++= Seq( +// "org.scala-js" %%% "scalajs-dom" % "2.0.0", +// "org.scalameta" %%% "munit" % MUnitVersion % Test, +// ), +// (Test / test) := (Test / test).dependsOn(Compile / fastOptJS).value, +// buildInfoKeys := Seq(scalaVersion, baseDirectory, BuildInfoKey("isBrowser" -> useJSEnv.value.isBrowser)), +// buildInfoPackage := "org.scalajs.macrotaskexecutor") +// .enablePlugins(ScalaJSPlugin, BuildInfoPlugin, NoPublishPlugin) From 035370ffe51e7546d464f4f77b88b64aed0e36b6 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 18:36:32 +0000 Subject: [PATCH 16/24] Revert "Temporarily disable webworkers project" This reverts commit 65913cc71c2ebcc12520293e91e9f6b25b51b3c5. --- build.sbt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/build.sbt b/build.sbt index 79c3613..67c4d83 100644 --- a/build.sbt +++ b/build.sbt @@ -152,7 +152,7 @@ ThisBuild / Test / testOptions += Tests.Argument(MUnitFramework, "+l") // project structure lazy val root = project - .aggregate(core) + .aggregate(core, webworker) .enablePlugins(NoPublishPlugin) lazy val core = project @@ -164,17 +164,17 @@ lazy val core = project .enablePlugins(ScalaJSPlugin) // this project solely exists for testing purposes -// lazy val webworker = project -// .in(file("webworker")) -// .dependsOn(core % "compile->test") -// .settings( -// name := "scala-js-macrotask-executor-webworker", -// scalaJSUseMainModuleInitializer := true, -// libraryDependencies ++= Seq( -// "org.scala-js" %%% "scalajs-dom" % "2.0.0", -// "org.scalameta" %%% "munit" % MUnitVersion % Test, -// ), -// (Test / test) := (Test / test).dependsOn(Compile / fastOptJS).value, -// buildInfoKeys := Seq(scalaVersion, baseDirectory, BuildInfoKey("isBrowser" -> useJSEnv.value.isBrowser)), -// buildInfoPackage := "org.scalajs.macrotaskexecutor") -// .enablePlugins(ScalaJSPlugin, BuildInfoPlugin, NoPublishPlugin) +lazy val webworker = project + .in(file("webworker")) + .dependsOn(core % "compile->test") + .settings( + name := "scala-js-macrotask-executor-webworker", + scalaJSUseMainModuleInitializer := true, + libraryDependencies ++= Seq( + "org.scala-js" %%% "scalajs-dom" % "2.0.0", + "org.scalameta" %%% "munit" % MUnitVersion % Test, + ), + (Test / test) := (Test / test).dependsOn(Compile / fastOptJS).value, + buildInfoKeys := Seq(scalaVersion, baseDirectory, BuildInfoKey("isBrowser" -> useJSEnv.value.isBrowser)), + buildInfoPackage := "org.scalajs.macrotaskexecutor") + .enablePlugins(ScalaJSPlugin, BuildInfoPlugin, NoPublishPlugin) From 9d964326d0f0a53d4e7e59e006549608afad9d34 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 19:38:51 +0000 Subject: [PATCH 17/24] Try try again --- build.sbt | 75 ++++++++++++++++++++++++--------------------- project/JSEnv.scala | 2 +- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/build.sbt b/build.sbt index 67c4d83..6a68199 100644 --- a/build.sbt +++ b/build.sbt @@ -109,42 +109,44 @@ lazy val useJSEnv = Global / useJSEnv := JSEnv.NodeJS -ThisBuild / Test / jsEnv := { - import JSEnv._ - - val old = (Test / jsEnv).value - - useJSEnv.value match { - case NodeJS => old - case JSDOMNodeJS => new JSDOMNodeJSEnv() - case Firefox => - val profile = new FirefoxProfile() - profile.setPreference("privacy.file_unique_origin", false) - val options = new FirefoxOptions() - options.setProfile(profile) - options.setHeadless(true) - new SeleniumJSEnv(options) - case Chrome => - val options = new ChromeOptions() - options.setHeadless(true) - options.addArguments("--allow-file-access-from-files") - val factory = new DriverFactory { - val defaultFactory = SeleniumJSEnv.Config().driverFactory - def newInstance(capabilities: org.openqa.selenium.Capabilities): WebDriver = { - val driver = defaultFactory.newInstance(capabilities).asInstanceOf[ChromeDriver] - driver.manage().timeouts().pageLoadTimeout(1, TimeUnit.HOURS) - driver.manage().timeouts().setScriptTimeout(1, TimeUnit.HOURS) - driver +lazy val common = Seq( + Test / jsEnv := { + import JSEnv._ + + val old = (Test / jsEnv).value + + useJSEnv.value match { + case NodeJS => old + case JSDOMNodeJS => new JSDOMNodeJSEnv() + case Firefox => + val profile = new FirefoxProfile() + profile.setPreference("privacy.file_unique_origin", false) + val options = new FirefoxOptions() + options.setProfile(profile) + options.setHeadless(true) + new SeleniumJSEnv(options) + case Chrome => + val options = new ChromeOptions() + options.setHeadless(true) + options.addArguments("--allow-file-access-from-files") + val factory = new DriverFactory { + val defaultFactory = SeleniumJSEnv.Config().driverFactory + def newInstance(capabilities: org.openqa.selenium.Capabilities): WebDriver = { + val driver = defaultFactory.newInstance(capabilities).asInstanceOf[ChromeDriver] + driver.manage().timeouts().pageLoadTimeout(1, TimeUnit.HOURS) + driver.manage().timeouts().setScriptTimeout(1, TimeUnit.HOURS) + driver + } + def registerDriverProvider(provider: DriverProvider): Unit = + defaultFactory.registerDriverProvider(provider) } - def registerDriverProvider(provider: DriverProvider): Unit = - defaultFactory.registerDriverProvider(provider) - } - new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) - case Safari => - val options = new SafariOptions() - new SeleniumJSEnv(options, SeleniumJSEnv.Config()) + new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) + case Safari => + val options = new SafariOptions() + new SeleniumJSEnv(options, SeleniumJSEnv.Config()) + } } -} +) ThisBuild / Test / parallelExecution := false ThisBuild / Test / testOptions += Tests.Argument(MUnitFramework, "+l") @@ -161,6 +163,7 @@ lazy val core = project name := "scala-js-macrotask-executor", libraryDependencies += "org.scalameta" %%% "munit" % MUnitVersion % Test, ) + .settings(common) .enablePlugins(ScalaJSPlugin) // this project solely exists for testing purposes @@ -176,5 +179,7 @@ lazy val webworker = project ), (Test / test) := (Test / test).dependsOn(Compile / fastOptJS).value, buildInfoKeys := Seq(scalaVersion, baseDirectory, BuildInfoKey("isBrowser" -> useJSEnv.value.isBrowser)), - buildInfoPackage := "org.scalajs.macrotaskexecutor") + buildInfoPackage := "org.scalajs.macrotaskexecutor" + ) + .settings(common) .enablePlugins(ScalaJSPlugin, BuildInfoPlugin, NoPublishPlugin) diff --git a/project/JSEnv.scala b/project/JSEnv.scala index ab4dc8c..e24e3ca 100644 --- a/project/JSEnv.scala +++ b/project/JSEnv.scala @@ -4,5 +4,5 @@ object JSEnv { case object Firefox extends JSEnv(true) case object JSDOMNodeJS extends JSEnv(false) case object NodeJS extends JSEnv(false) - case object Safari extends JSEnv(false) // TODO + case object Safari extends JSEnv(true) } From 6ea98e3422896631d54906a5ac5d3296ba577654 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 19:43:50 +0000 Subject: [PATCH 18/24] Poke ci From a899b2feb0f16bf18eefa6181a47c60e38b0799e Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 19:49:12 +0000 Subject: [PATCH 19/24] Disable parallel exec --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 6a68199..335b4ca 100644 --- a/build.sbt +++ b/build.sbt @@ -148,7 +148,8 @@ lazy val common = Seq( } ) -ThisBuild / Test / parallelExecution := false +ThisBuild / parallelExecution := false +Global / concurrentRestrictions += Tags.limit(Tags.Test, 1) ThisBuild / Test / testOptions += Tests.Argument(MUnitFramework, "+l") // project structure From 03919b3593be2fca65042dd699eb009e6880936c Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 19:54:52 +0000 Subject: [PATCH 20/24] One more grand idea --- build.sbt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 335b4ca..315ffd1 100644 --- a/build.sbt +++ b/build.sbt @@ -109,7 +109,7 @@ lazy val useJSEnv = Global / useJSEnv := JSEnv.NodeJS -lazy val common = Seq( +def commonSettings(disableSafari: Boolean = false) = Seq( Test / jsEnv := { import JSEnv._ @@ -141,9 +141,10 @@ lazy val common = Seq( defaultFactory.registerDriverProvider(provider) } new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) - case Safari => + case Safari if !disableSafari => val options = new SafariOptions() new SeleniumJSEnv(options, SeleniumJSEnv.Config()) + case _ => old } } ) @@ -164,7 +165,7 @@ lazy val core = project name := "scala-js-macrotask-executor", libraryDependencies += "org.scalameta" %%% "munit" % MUnitVersion % Test, ) - .settings(common) + .settings(commonSettings()) .enablePlugins(ScalaJSPlugin) // this project solely exists for testing purposes @@ -182,5 +183,5 @@ lazy val webworker = project buildInfoKeys := Seq(scalaVersion, baseDirectory, BuildInfoKey("isBrowser" -> useJSEnv.value.isBrowser)), buildInfoPackage := "org.scalajs.macrotaskexecutor" ) - .settings(common) + .settings(commonSettings(disableSafari = true)) // bugged .enablePlugins(ScalaJSPlugin, BuildInfoPlugin, NoPublishPlugin) From 29738da2b8417486803b8c9646aa90af0a387b92 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 19:58:56 +0000 Subject: [PATCH 21/24] no idea --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 315ffd1..b0f364d 100644 --- a/build.sbt +++ b/build.sbt @@ -141,7 +141,8 @@ def commonSettings(disableSafari: Boolean = false) = Seq( defaultFactory.registerDriverProvider(provider) } new SeleniumJSEnv(options, SeleniumJSEnv.Config().withDriverFactory(factory)) - case Safari if !disableSafari => + case Safari if !disableSafari => + println("DEBUG DEBUG DEBUG DEBUG") val options = new SafariOptions() new SeleniumJSEnv(options, SeleniumJSEnv.Config()) case _ => old From 2a17a9e94603d9b7eba7561a9995f15a0a727d59 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 21:12:19 +0000 Subject: [PATCH 22/24] Try to limit threads --- .github/workflows/ci.yml | 6 +++--- build.sbt | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cb5c9a..c5c1a79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,9 +77,9 @@ jobs: run: npm install - name: Check that workflows are up to date - run: sbt ++${{ matrix.scala }} githubWorkflowCheck + run: 'sbt -XX:ActiveProcessorCount=1 ++${{ matrix.scala }} githubWorkflowCheck' - - run: sbt ++${{ matrix.scala }} '${{ matrix.ci }}' + - run: 'sbt -XX:ActiveProcessorCount=1 ++${{ matrix.scala }} ''${{ matrix.ci }}''' publish: name: Publish Artifacts @@ -128,4 +128,4 @@ jobs: PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} run: (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase 5EBC14B0F6C55083 - - run: sbt ++${{ matrix.scala }} release + - run: 'sbt -XX:ActiveProcessorCount=1 ++${{ matrix.scala }} release' diff --git a/build.sbt b/build.sbt index b0f364d..f02e809 100644 --- a/build.sbt +++ b/build.sbt @@ -52,6 +52,8 @@ val PrimaryOS = "ubuntu-latest" val MacOS = "macos-latest" ThisBuild / githubWorkflowOSes := Seq(PrimaryOS, MacOS) +ThisBuild / githubWorkflowSbtCommand += " -XX:ActiveProcessorCount=1" + ThisBuild / githubWorkflowBuildPreamble ++= Seq( WorkflowStep.Use( UseRef.Public("actions", "setup-node", "v2.1.2"), From d3709967d01fc02234544ae42eb1bbe0f3b0ebe1 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 21:14:20 +0000 Subject: [PATCH 23/24] Prefix JVM opts with -J --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index f02e809..8c28b9c 100644 --- a/build.sbt +++ b/build.sbt @@ -52,7 +52,7 @@ val PrimaryOS = "ubuntu-latest" val MacOS = "macos-latest" ThisBuild / githubWorkflowOSes := Seq(PrimaryOS, MacOS) -ThisBuild / githubWorkflowSbtCommand += " -XX:ActiveProcessorCount=1" +ThisBuild / githubWorkflowSbtCommand += " -J-XX:ActiveProcessorCount=1" ThisBuild / githubWorkflowBuildPreamble ++= Seq( WorkflowStep.Use( From 918654f1cecc5b5dc35dd3c18617e1dce81e2875 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Thu, 28 Apr 2022 21:16:04 +0000 Subject: [PATCH 24/24] Regenerate workflow --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5c1a79..2353eea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,9 +77,9 @@ jobs: run: npm install - name: Check that workflows are up to date - run: 'sbt -XX:ActiveProcessorCount=1 ++${{ matrix.scala }} githubWorkflowCheck' + run: 'sbt -J-XX:ActiveProcessorCount=1 ++${{ matrix.scala }} githubWorkflowCheck' - - run: 'sbt -XX:ActiveProcessorCount=1 ++${{ matrix.scala }} ''${{ matrix.ci }}''' + - run: 'sbt -J-XX:ActiveProcessorCount=1 ++${{ matrix.scala }} ''${{ matrix.ci }}''' publish: name: Publish Artifacts @@ -128,4 +128,4 @@ jobs: PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} run: (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase 5EBC14B0F6C55083 - - run: 'sbt -XX:ActiveProcessorCount=1 ++${{ matrix.scala }} release' + - run: 'sbt -J-XX:ActiveProcessorCount=1 ++${{ matrix.scala }} release'