Skip to content

Commit 6495c3e

Browse files
Gedochaotgodzik
andauthored
[NIT] Refactor Scala CLI CI scripts (#3702)
* Enable `-Werror` for `check-cross-version.deps.sc` * Bump `scala-xml` to 2.4.0 * Enable `-Werror` for `generate-junit-reports.sc` * Enable `-Wunused:all` for Scala CLI CI scripts * Update .github/scripts/check-cross-version-deps.sc Co-authored-by: Tomasz Godzik <[email protected]> --------- Co-authored-by: Tomasz Godzik <[email protected]>
1 parent 7a73dd1 commit 6495c3e

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

.github/scripts/check-cross-version-deps.sc

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env -S scala-cli shebang
22
//> using scala 3
33
//> using toolkit default
4+
//> using options -Werror -Wunused:all
45

56
val modules =
67
os.proc(os.pwd / "mill", "-i", "resolve", "__[]")
@@ -18,14 +19,17 @@ for { module <- modules } {
1819
.lines()
1920
.filter(_.count(_ == ':') == 2)
2021
.map { case depRegex(org, name, depVersion) => (org, name, depVersion) }
22+
val invalidOrgAndName = "invalid:invalid"
2123
val scalaVersionsByOrgAndName = deps
22-
.groupBy { case (org, scalaDepSuffixRegex(nameWithoutSuffix, _), _) =>
23-
s"$org:$nameWithoutSuffix"
24+
.groupBy {
25+
case (org, scalaDepSuffixRegex(nameWithoutSuffix, _), _) => s"$org:$nameWithoutSuffix"
26+
case _ => invalidOrgAndName
2427
}
25-
.map { case (key, entries) =>
26-
key -> entries.map { case (_, scalaDepSuffixRegex(_, scalaVersion), _) =>
27-
scalaVersion
28-
}.distinct
28+
.collect {
29+
case (key, entries) if key != invalidOrgAndName =>
30+
key -> entries
31+
.collect { case (_, scalaDepSuffixRegex(_, scalaVersion), _) => scalaVersion }
32+
.distinct
2933
}
3034
.filter { case (_, scalaVersions) => scalaVersions.head != null } // filter out non-Scala deps
3135
println("Checking for clashing dependency Scala versions...")

.github/scripts/generate-junit-reports.sc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env -S scala-cli shebang
22
//> using scala 3
33
//> using toolkit default
4-
//> using dep org.scala-lang.modules::scala-xml:2.3.0
4+
//> using dep org.scala-lang.modules::scala-xml:2.4.0
5+
//> using options -Werror -Wunused:all
56
// adapted from https://github.com/vic/mill-test-junit-report
67
import java.io.File
78
import scala.collection.mutable.ArrayBuffer

0 commit comments

Comments
 (0)