generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathtest_harness.jl
54 lines (51 loc) · 1.87 KB
/
test_harness.jl
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
import Pkg
include("kwargs.jl")
kwargs = Kwargs.kwargs(; coverage=ENV["COVERAGE"],
force_latest_compatible_version=ENV["FORCE_LATEST_COMPATIBLE_VERSION"],
allow_reresolve=ENV["ALLOW_RERESOLVE"],
julia_args=[string("--check-bounds=", ENV["CHECK_BOUNDS"]),
string("--compiled-modules=", ENV["COMPILED_MODULES"]),
# Needs to be done via `julia_args` to ensure `depwarn: no` is respected:
# https://github.com/JuliaLang/Pkg.jl/pull/1763#discussion_r406819660
string("--depwarn=", ENV["DEPWARN"]),],
test_args=ARGS,
)
kwargs_reprs = map(kv -> string(kv[1], "=", repr(kv[2])), collect(kwargs))
kwargs_repr = join(kwargs_reprs, ", ")
print("""
│
│ To reproduce this CI run locally run the following from the same repository state on julia version $VERSION:
│
│ `import Pkg; Pkg.test(;$kwargs_repr)`
│
""")
if parse(Bool, ENV["ANNOTATE"]) && v"1.8pre" < VERSION < v"1.9.0-beta3"
push!(LOAD_PATH, "@tests-logger-env") # access dependencies
using GitHubActions, Logging
global_logger(GitHubActionsLogger())
include("test_logger.jl")
pop!(LOAD_PATH)
try
TestLogger.test(; kwargs...)
catch e
if e isa Pkg.Types.PkgError
# don't show the stacktrace of the test harness because it's not useful
showerror(stderr, e)
exit(1)
else
rethrow()
end
end
else
try
Pkg.test(; kwargs...)
catch e
if e isa Pkg.Types.PkgError
# don't show the stacktrace of the test harness because it's not useful
showerror(stderr, e)
exit(1)
else
rethrow()
end
end
end