2017-10-02 01:43:03 +00:00
|
|
|
user = gitconfig["github.user"]
|
|
|
|
t = Template(; user=me)
|
|
|
|
temp_dir = mktempdir()
|
|
|
|
pkg_dir = joinpath(temp_dir, test_pkg)
|
|
|
|
|
|
|
|
@testset "TravisCI" begin
|
|
|
|
@testset "Plugin creation" begin
|
|
|
|
p = TravisCI()
|
|
|
|
@test isempty(p.gitignore)
|
2018-09-19 19:19:16 +00:00
|
|
|
@test p.src == joinpath(PkgTemplates.DEFAULTS_DIR, "travis.yml")
|
2017-10-02 01:43:03 +00:00
|
|
|
@test p.dest == ".travis.yml"
|
|
|
|
@test p.badges == [
|
|
|
|
Badge(
|
|
|
|
"Build Status",
|
|
|
|
"https://travis-ci.org/{{USER}}/{{PKGNAME}}.jl.svg?branch=master",
|
|
|
|
"https://travis-ci.org/{{USER}}/{{PKGNAME}}.jl",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
@test isempty(p.view)
|
|
|
|
p = TravisCI(; config_file=nothing)
|
2018-09-19 19:19:16 +00:00
|
|
|
@test p.src === nothing
|
2017-10-02 01:43:03 +00:00
|
|
|
p = TravisCI(; config_file=test_file)
|
2018-09-19 19:19:16 +00:00
|
|
|
@test p.src == test_file
|
2017-10-02 01:43:03 +00:00
|
|
|
@test_throws ArgumentError TravisCI(; config_file=fake_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
@testset "Badge generation" begin
|
|
|
|
p = TravisCI()
|
|
|
|
@test badges(p, user, test_pkg) == ["[](https://travis-ci.org/$user/$test_pkg.jl)"]
|
|
|
|
end
|
|
|
|
|
|
|
|
@testset "File generation" begin
|
|
|
|
p = TravisCI()
|
|
|
|
@test gen_plugin(p, t, temp_dir, test_pkg) == [".travis.yml"]
|
|
|
|
@test isfile(joinpath(pkg_dir, ".travis.yml"))
|
|
|
|
travis = readstring(joinpath(pkg_dir, ".travis.yml"))
|
|
|
|
@test !contains(travis, "after_success")
|
|
|
|
@test !contains(travis, "Codecov.submit")
|
|
|
|
@test !contains(travis, "Coveralls.submit")
|
|
|
|
@test !contains(travis, "Pkg.add(\"Documenter\")")
|
|
|
|
rm(joinpath(pkg_dir, ".travis.yml"))
|
|
|
|
t.plugins[CodeCov] = CodeCov()
|
|
|
|
gen_plugin(p, t, temp_dir, test_pkg)
|
|
|
|
delete!(t.plugins, CodeCov)
|
|
|
|
travis = readstring(joinpath(pkg_dir, ".travis.yml"))
|
|
|
|
@test contains(travis, "after_success")
|
|
|
|
@test contains(travis, "Codecov.submit")
|
|
|
|
@test !contains(travis, "Coveralls.submit")
|
|
|
|
@test !contains(travis, "Pkg.add(\"Documenter\")")
|
|
|
|
rm(joinpath(pkg_dir, ".travis.yml"))
|
|
|
|
t.plugins[Coveralls] = Coveralls()
|
|
|
|
gen_plugin(p, t, temp_dir, test_pkg)
|
|
|
|
delete!(t.plugins, Coveralls)
|
|
|
|
travis = readstring(joinpath(pkg_dir, ".travis.yml"))
|
|
|
|
@test contains(travis, "after_success")
|
|
|
|
@test contains(travis, "Coveralls.submit")
|
|
|
|
@test !contains(travis, "Codecov.submit")
|
|
|
|
@test !contains(travis, "Pkg.add(\"Documenter\")")
|
|
|
|
rm(joinpath(pkg_dir, ".travis.yml"))
|
|
|
|
t.plugins[GitHubPages] = GitHubPages()
|
|
|
|
gen_plugin(p, t, temp_dir, test_pkg)
|
|
|
|
delete!(t.plugins, GitHubPages)
|
|
|
|
travis = readstring(joinpath(pkg_dir, ".travis.yml"))
|
|
|
|
@test contains(travis, "after_success")
|
|
|
|
@test contains(travis, "Pkg.add(\"Documenter\")")
|
|
|
|
@test !contains(travis, "Codecov.submit")
|
|
|
|
@test !contains(travis, "Coveralls.submit")
|
|
|
|
rm(joinpath(pkg_dir, ".travis.yml"))
|
|
|
|
p = TravisCI(; config_file=nothing)
|
|
|
|
@test isempty(gen_plugin(p, t, temp_dir, test_pkg))
|
|
|
|
@test !isfile(joinpath(pkg_dir, ".travis.yml"))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
rm(temp_dir; recursive=true)
|