Skip to content

Commit 38ccea2

Browse files
committed
Match branches of Adapt.jl.
1 parent 1d36c49 commit 38ccea2

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

test/runtests.jl

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,26 @@ using Pkg
77
GPUArrays.test(JLArray)
88
end
99

10-
function test_package(package, branch=nothing)
11-
mktempdir() do devdir
12-
withenv("JULIA_PKG_DEVDIR" => devdir) do
13-
# try to install from the same branch of GPUArrays
14-
try
15-
if branch === nothing
16-
branch = chomp(read(`git -C $(@__DIR__) rev-parse --abbrev-ref HEAD`, String))
17-
branch == "HEAD" && error("in detached HEAD state")
18-
end
19-
Pkg.add(PackageSpec(name=package, rev=String(branch)))
20-
@info "Installed $package from $branch branch"
21-
catch ex
22-
@warn "Could not install $package from same branch as GPUArrays, trying master branch" exception=ex
23-
Pkg.add(PackageSpec(name=package, rev="master"))
24-
end
10+
if haskey(ENV, "GITLAB_CI")
11+
using Pkg
2512

26-
Pkg.test(package)
13+
function match_package(package, branch)
14+
try
15+
Pkg.add(PackageSpec(name=package, rev=String(branch)))
16+
@info "Installed $package from $branch branch"
17+
catch ex
18+
@warn "Could not install $package from $branch branch, trying master" exception=ex
19+
Pkg.add(PackageSpec(name=package, rev="master"))
20+
@info "Installed $package from master branch"
2721
end
2822
end
29-
end
3023

31-
if haskey(ENV, "GITLAB_CI")
3224
branch = ENV["CI_COMMIT_REF_NAME"]
25+
for package in ("Adapt", "CuArrays")
26+
match_package(package, branch)
27+
end
28+
3329
@testset "CuArray" begin
34-
test_package("CuArrays", branch)
30+
Pkg.test("CuArrays")
3531
end
3632
end

0 commit comments

Comments
 (0)