Skip to content

Commit 087b9fc

Browse files
committed
Fix package matching on Travis and AppVeyor.
1 parent 0b49345 commit 087b9fc

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

test/runtests.jl

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
# GPUArrays development often happens in lockstep with other packages, so try to match branches
2-
if haskey(ENV, "GITLAB_CI")
3-
using Pkg
4-
5-
function match_package(package, branch)
6-
try
7-
Pkg.add(PackageSpec(name=package, rev=String(branch)))
8-
@info "Installed $package from $branch branch"
9-
catch ex
10-
@warn "Could not install $package from $branch branch, trying master" exception=ex
11-
Pkg.add(PackageSpec(name=package, rev="master"))
12-
@info "Installed $package from master branch"
13-
end
14-
end
15-
16-
branch = ENV["CI_COMMIT_REF_NAME"]
17-
for package in ("Adapt", "CuArrays")
18-
match_package(package, branch)
2+
using Pkg
3+
function match_package(package, var)
4+
try
5+
branch = ENV[var]
6+
Pkg.add(PackageSpec(name=package, rev=branch))
7+
@info "Installed $package from branch $branch"
8+
catch ex
9+
@warn "Could not install $package from $branch branch, trying master" exception=ex
10+
Pkg.add(PackageSpec(name=package, rev="master"))
11+
@info "Installed $package from master"
1912
end
2013
end
14+
haskey(ENV, "TRAVIS") && match_package("Adapt", "TRAVIS_PULL_REQUEST_BRANCH")
15+
haskey(ENV, "APPVEYOR") && match_package("Adapt", "APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH")
16+
haskey(ENV, "GITLAB_CI") && match_package("Adapt", "CI_COMMIT_REF_NAME")
2117

2218
using GPUArrays, Test
2319

@@ -26,6 +22,7 @@ using GPUArrays, Test
2622
end
2723

2824
if haskey(ENV, "GITLAB_CI")
25+
match_package("CuArrays", "CI_COMMIT_REF_NAME")
2926
@testset "CuArray" begin
3027
Pkg.test("CuArrays")
3128
end

0 commit comments

Comments
 (0)