Skip to content

Commit 9d78e40

Browse files
authored
Merge pull request #576 from romanowski/using-directives-followup
Test examples on CI
2 parents 2e1b5b3 + 2f3d8f4 commit 9d78e40

File tree

38 files changed

+60
-524
lines changed

38 files changed

+60
-524
lines changed

.github/scripts/check_examples.sc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//> using scala "3"
2+
//> using lib "com.lihaoyi::os-lib:0.8.0"
3+
4+
val toParse: Seq[os.Path] =
5+
if args.nonEmpty then args.map(p => os.pwd / os.RelPath(p))
6+
else os.list(os.pwd / "examples").filterNot(_.last.startsWith("."))
7+
8+
9+
val failed = toParse.filter { path =>
10+
val args =
11+
if !os.exists(path / ".opts") then Nil
12+
else os.read(path / ".opts").split(" ").toSeq
13+
14+
15+
println(s"Running $path")
16+
os.proc(os.pwd / "scala-cli", "--jvm", "temurin:17", args, path)
17+
.call(check = false).exitCode != 0
18+
}
19+
20+
if failed.isEmpty then println("Success!") else
21+
println("Failed examples:")
22+
failed.foreach(path => println(s" $path failed"))

.github/scripts/check_gifs.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ jobs:
202202
run: .github/scripts/check_docs.sh
203203
- name: Test gifs
204204
run: gifs/generate_gifs.sh $(ls gifs/scenarios/)
205+
- name: Build binary
206+
run: ./mill copyTo cli.launcher ./scala-cli
207+
- name: Check examples
208+
run: bash ./scala-cli --jvm temurin:17 .github/scripts/check_examples.sc
205209

206210
checks:
207211
timeout-minutes: 15

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ out/
55
.scala
66
.bsp
77
.idea/
8+
9+
*.semanticdb

examples/cross-build/.opts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--js --help

examples/cross-build/Hello.js.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//> using scala 2.13
2-
//> using target scala-js
1+
//> using scala "2.13"
2+
//> using target "scala-js"
33

44
import scala.scalajs.js
55

examples/cross-build/Hello.native.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//> using scala 2.13
2-
//> using target scala-native
1+
//> using scala "2.13"
2+
//> using target "scala-native"
33

44
import scala.scalanative.libc._
55
import scala.scalanative.unsafe._

examples/gists/Messages.scala

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/gists/README.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

examples/intro/README.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)