-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub-scala-build-and-test.dhall
127 lines (121 loc) · 5.17 KB
/
github-scala-build-and-test.dhall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
let GithubActions =
https://regadas.dev/github-actions-dhall/package.dhall
sha256:71df44892a17abca817cfb35e2612d117f7fceec55114a6eb76b65a7eea4e6f4
let matrix =
-- { java = [ "8.0.382", "11.0.21", "17.0.9" ], scala = [ "2.13.13" ] }
-- Scala "2.12.19" is not supported - it gives too many problems all over the place.
toMap { java = [ "8.0.382", "22.0.1" ], scala = [ "2.13.13" ] }
let checkout_and_cache =
[ GithubActions.steps.actions/checkout
// { `with` = Some (toMap { submodules = "true" }) }
, GithubActions.steps.actions/cache
{ path =
''
~/.sbt
"~/.cache/coursier"
''
, key = "sbt"
, hashFiles =
[ "build.sbt", "project/plugins.sbt", "project/build.properties" ]
}
]
in GithubActions.Workflow::{
, name = "scall_build_and_test"
, on = GithubActions.On::{ push = Some GithubActions.Push::{=} }
, jobs = toMap
{ checks = GithubActions.Job::{
, name = Some "Check formatting"
, runs-on = GithubActions.types.RunsOn.ubuntu-latest
, steps =
checkout_and_cache
# [ GithubActions.steps.actions/setup-java { java-version = "17" }
, GithubActions.steps.run
{ run = "sbt scalafmtCheckAll scalafmtSbtCheck" }
]
}
, pdftutorial = GithubActions.Job::{
, name = Some "Build and validate the tutorial"
, runs-on = GithubActions.types.RunsOn.ubuntu-latest
, steps =
checkout_and_cache
# [ GithubActions.steps.actions/setup-java { java-version = "17" }
, GithubActions.Step::{
, name = Some "Setup scala-cli"
, uses = Some "VirtusLab/scala-cli-setup@main"
}
, GithubActions.Step::{
, name = Some "Setup dhall executable"
, uses = Some "dhall-lang/setup-dhall@v4"
, `with` = Some (toMap { version = "1.42.0" })
}
, GithubActions.Step::{
, name = Some "Setup latex"
, uses = Some "zauguin/install-texlive@v3"
, `with` = Some (toMap { packages = "scheme-full" })
}
, GithubActions.steps.run
{ run = "bash tutorial/make_pdf.sh dryrunx" }
, GithubActions.Step::{
, name = Some "Upload tutorial PDF"
, uses = Some "actions/upload-artifact@v4"
, `with` = Some
( toMap
{ name = "Tutorial PDF file and logs"
, if-no-files-found = "error"
, path =
''
./tutorial/programming_dhall.pdf
./tutorial/generated.log
./tutorial/programming_dhall.log''
}
)
}
]
}
, build = GithubActions.Job::{
, name = Some "Build"
, needs = Some [ "checks" ]
, strategy = Some GithubActions.Strategy::{ matrix }
, runs-on = GithubActions.types.RunsOn.ubuntu-latest
, permissions =
let Permission = GithubActions.types.Permission
in let read = GithubActions.types.PermissionAccess.read
in let write = GithubActions.types.PermissionAccess.write
in Some
[ { mapKey = Permission.actions, mapValue = read }
, { mapKey = Permission.checks, mapValue = write }
, { mapKey = Permission.contents, mapValue = read }
]
, steps =
checkout_and_cache
# [ GithubActions.steps.actions/setup-java
{ java-version = "\${{ matrix.java }}" }
, GithubActions.steps.run
{ run =
"sbt -DJDK_VERSION=\${{ matrix.java }} ++\${{ matrix.scala }} coverage test coverageReport"
}
, GithubActions.Step::{
, name = Some "Report test results"
, uses = Some "dorny/test-reporter@v1.7.0"
, `if` = Some "success() || failure()"
, `with` = Some
( toMap
{ name = "Test results"
, path = "*/target/test-reports/*.xml"
, reporter = "java-junit"
, fail-on-error = "true"
}
)
}
, GithubActions.Step::{
, name = Some "Upload coverage reports to Codecov"
, uses = Some "codecov/codecov-action@v3"
, env = Some
( toMap
{ CODECOV_TOKEN = "\${{ secrets.CODECOV_TOKEN }}" }
)
}
]
}
}
}