2017-10-02 01:43:03 +00:00
|
|
|
t = Template(; user=me)
|
2018-09-28 20:30:10 +00:00
|
|
|
pkg_dir = joinpath(t.dir, test_pkg)
|
2017-10-02 01:43:03 +00:00
|
|
|
|
|
|
|
@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",
|
2018-09-19 20:28:41 +00:00
|
|
|
"https://travis-ci.com/{{USER}}/{{PKGNAME}}.jl.svg?branch=master",
|
|
|
|
"https://travis-ci.com/{{USER}}/{{PKGNAME}}.jl",
|
2017-10-02 01:43:03 +00:00
|
|
|
),
|
|
|
|
]
|
|
|
|
@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()
|
2018-09-26 19:55:33 +00:00
|
|
|
@test badges(p, me, test_pkg) == ["[](https://travis-ci.com/$me/$test_pkg.jl)"]
|
2017-10-02 01:43:03 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
@testset "File generation" begin
|
2018-09-24 18:25:40 +00:00
|
|
|
# Without a coverage plugin in the template, there should be no post-test step.
|
2017-10-02 01:43:03 +00:00
|
|
|
p = TravisCI()
|
2018-09-28 20:30:10 +00:00
|
|
|
@test gen_plugin(p, t, test_pkg) == [".travis.yml"]
|
2017-10-02 01:43:03 +00:00
|
|
|
@test isfile(joinpath(pkg_dir, ".travis.yml"))
|
2018-09-19 19:25:09 +00:00
|
|
|
travis = read(joinpath(pkg_dir, ".travis.yml"), String)
|
2018-09-24 18:25:40 +00:00
|
|
|
|
2018-09-19 19:30:23 +00:00
|
|
|
@test !occursin("after_success", travis)
|
|
|
|
@test !occursin("Codecov.submit", travis)
|
|
|
|
@test !occursin("Coveralls.submit", travis)
|
2018-12-19 19:48:07 +00:00
|
|
|
@test !occursin("stage: Documentation", travis)
|
2017-10-02 01:43:03 +00:00
|
|
|
rm(joinpath(pkg_dir, ".travis.yml"))
|
2018-09-24 18:25:40 +00:00
|
|
|
|
2018-11-05 22:05:30 +00:00
|
|
|
# Generating the plugin with Codecov in the template should create a post-test step.
|
|
|
|
t.plugins[Codecov] = Codecov()
|
2018-09-28 20:30:10 +00:00
|
|
|
gen_plugin(p, t, test_pkg)
|
2018-11-05 22:05:30 +00:00
|
|
|
delete!(t.plugins, Codecov)
|
2018-09-19 19:25:09 +00:00
|
|
|
travis = read(joinpath(pkg_dir, ".travis.yml"), String)
|
2018-09-19 19:30:23 +00:00
|
|
|
@test occursin("after_success", travis)
|
|
|
|
@test occursin("Codecov.submit", travis)
|
|
|
|
@test !occursin("Coveralls.submit", travis)
|
2018-12-19 19:48:07 +00:00
|
|
|
@test !occursin("stage: Documentation", travis)
|
2017-10-02 01:43:03 +00:00
|
|
|
rm(joinpath(pkg_dir, ".travis.yml"))
|
2018-09-24 18:25:40 +00:00
|
|
|
|
|
|
|
# Coveralls should do the same.
|
2017-10-02 01:43:03 +00:00
|
|
|
t.plugins[Coveralls] = Coveralls()
|
2018-09-28 20:30:10 +00:00
|
|
|
gen_plugin(p, t, test_pkg)
|
2017-10-02 01:43:03 +00:00
|
|
|
delete!(t.plugins, Coveralls)
|
2018-09-19 19:25:09 +00:00
|
|
|
travis = read(joinpath(pkg_dir, ".travis.yml"), String)
|
2018-09-19 19:30:23 +00:00
|
|
|
@test occursin("after_success", travis)
|
|
|
|
@test occursin("Coveralls.submit", travis)
|
|
|
|
@test !occursin("Codecov.submit", travis)
|
2018-12-19 19:48:07 +00:00
|
|
|
@test !occursin("stage: Documentation", travis)
|
2017-10-02 01:43:03 +00:00
|
|
|
rm(joinpath(pkg_dir, ".travis.yml"))
|
2018-09-24 18:25:40 +00:00
|
|
|
|
|
|
|
# With a Documenter plugin, there should be a docs deployment step.
|
2017-10-02 01:43:03 +00:00
|
|
|
t.plugins[GitHubPages] = GitHubPages()
|
2018-09-28 20:30:10 +00:00
|
|
|
gen_plugin(p, t, test_pkg)
|
2017-10-02 01:43:03 +00:00
|
|
|
delete!(t.plugins, GitHubPages)
|
2018-09-19 19:25:09 +00:00
|
|
|
travis = read(joinpath(pkg_dir, ".travis.yml"), String)
|
2018-09-19 19:30:23 +00:00
|
|
|
@test occursin("after_success", travis)
|
2018-12-19 19:48:07 +00:00
|
|
|
@test occursin("stage: Documentation", travis)
|
2018-09-19 19:30:23 +00:00
|
|
|
@test !occursin("Codecov.submit", travis)
|
|
|
|
@test !occursin("Coveralls.submit", travis)
|
2017-10-02 01:43:03 +00:00
|
|
|
rm(joinpath(pkg_dir, ".travis.yml"))
|
2018-09-24 18:25:40 +00:00
|
|
|
|
2017-10-02 01:43:03 +00:00
|
|
|
p = TravisCI(; config_file=nothing)
|
2018-09-28 20:30:10 +00:00
|
|
|
@test isempty(gen_plugin(p, t, test_pkg))
|
2017-10-02 01:43:03 +00:00
|
|
|
@test !isfile(joinpath(pkg_dir, ".travis.yml"))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-09-28 20:30:10 +00:00
|
|
|
rm(pkg_dir; recursive=true)
|