Skip to content

Commit cbcff27

Browse files
authored
Merge pull request #199 from dwijnand/test-on-scala-3.next
2 parents 40378d0 + 8c7e88a commit cbcff27

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

.github/workflows/ci.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
name: test
22
on:
3+
schedule:
4+
- cron: '0 0 * * *'
35
push:
46
branches:
57
- main
68
pull_request:
79
jobs:
8-
test:
10+
test: &test
911
strategy:
1012
fail-fast: false
1113
matrix:
1214
java: [8, 11, 17]
1315
scala: [2.13.6, 3.0.2]
1416
runs-on: ubuntu-latest
17+
if: ${{ github.event_name != schedule }}
1518
steps:
1619
- uses: actions/checkout@v2
1720
with:
@@ -22,4 +25,13 @@ jobs:
2225
distribution: temurin
2326
java-version: ${{matrix.java}}
2427
- name: Test
25-
run: sbt ++${{matrix.scala}} test core/headerCheck package
28+
run: sbt "setScalaVersion ${{matrix.scala}}" test core/headerCheck package
29+
30+
test-rc:
31+
<<: *test
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
java: [8]
36+
scala: [3.next]
37+
if: ${{ github.event_name == schedule }}

build.sbt

+8
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,11 @@ lazy val testmacros = project.in(file("testmacros"))
6666
}),
6767
publish / skip := true,
6868
)
69+
70+
commands += Command.single("setScalaVersion") { (state, arg0) =>
71+
val arg = arg0 match {
72+
case "3.next" => GetScala3Next.get()
73+
case _ => arg0
74+
}
75+
s"++$arg" :: state
76+
}

project/GetScala3Next.scala

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import java.nio.ByteBuffer
2+
3+
import scala.concurrent._, duration._
4+
5+
import gigahorse._, support.okhttp.Gigahorse
6+
7+
import sjsonnew.shaded.scalajson.ast.unsafe._
8+
import sjsonnew.support.scalajson.unsafe.{ Converter, Parser }
9+
10+
object GetScala3Next {
11+
val asJson = (r: FullResponse) => Parser.parseFromByteBuffer(r.bodyAsByteBuffer).get
12+
13+
def get(): String = {
14+
val req = Gigahorse.url("https://api.github.com/repos/lampepfl/dotty/releases")
15+
.get.addQueryString("per_page" -> "1")
16+
17+
val http = Gigahorse.http(Gigahorse.config)
18+
19+
try {
20+
val f = http.run(req, asJson)
21+
22+
val f2 = f.collect {
23+
case JArray(Array(JObject(fields))) => fields.collectFirst {
24+
case JField("tag_name", JString(version)) => version
25+
}
26+
}.map(_.getOrElse(sys.error(s"Expected an array of 1 string, got $j")))
27+
28+
Await.result(f2, 120.seconds)
29+
} finally http.close()
30+
}
31+
}

0 commit comments

Comments
 (0)