Repository navigation
Expand file tree
/
Copy pathmain.dang
More file actions
44 lines (40 loc) · 1.4 KB
/
Copy pathmain.dang
File metadata and controls
44 lines (40 loc) · 1.4 KB
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
pub description = "Run a locked Ruby project's Minitest suite through its Rakefile"
"""
Minitest for one Bundler project, run as `bundle exec rake test` with the gems
its Gemfile.lock pins.
"""
type Minitest {
"""
Project root. See the `ruby` module.
"""
root: String! = "."
"""
Custom Ruby container. See the `ruby` module.
"""
base: Container
"""
Whether to load the bundled OpenTelemetry plugin, which sends a session span
and one span per test to the trace Dagger provides. An export failure only
warns; it never changes the verdict.
"""
tracing: Boolean! = true
"""
Run `bundle exec rake test` in the project root and fail with its output.
"""
test(ws: Workspace!): Void @check {
let env = ruby(root: root, base: base)
let installed = env.container(ws)
# Added after the bundle is installed and loaded through RUBYOPT, so the
# project's Gemfile and lock are never touched.
let ctr = if (tracing) {
installed
.withDirectory("/opt/dagger_minitest_otel", currentModule.source.directory("dagger_minitest_otel"))
.withEnvVariable("RUBYOPT", "${RUBYOPT} -I/opt/dagger_minitest_otel -rdagger_minitest_otel", expand: true)
} else { installed }
let ran = ctr.withExec(["bundle", "exec", "rake", "test"], expect: ANY)
if (ran.exitCode != 0) {
raise "Minitest failed in " + env.path + ":\n" + ran.stdout + ran.stderr
}
null
}
}