Deprecate CodeCov for Codecov

This commit is contained in:
Chris de Graaf 2018-11-05 16:05:30 -06:00
parent aa3758476a
commit 34f30637a2
11 changed files with 47 additions and 46 deletions

View File

@ -4,7 +4,7 @@
[![Latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://invenia.github.io/PkgTemplates.jl/latest) [![Latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://invenia.github.io/PkgTemplates.jl/latest)
[![Build Status](https://travis-ci.org/invenia/PkgTemplates.jl.svg?branch=master)](https://travis-ci.org/invenia/PkgTemplates.jl) [![Build Status](https://travis-ci.org/invenia/PkgTemplates.jl.svg?branch=master)](https://travis-ci.org/invenia/PkgTemplates.jl)
[![Build Status](https://ci.appveyor.com/api/projects/status/r24xamruqlm88uti/branch/master?svg=true)](https://ci.appveyor.com/project/christopher-dG/pkgtemplates-jl/branch/master) [![Build Status](https://ci.appveyor.com/api/projects/status/r24xamruqlm88uti/branch/master?svg=true)](https://ci.appveyor.com/project/christopher-dG/pkgtemplates-jl/branch/master)
[![CodeCov](https://codecov.io/gh/invenia/PkgTemplates.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/invenia/PkgTemplates.jl) [![Codecov](https://codecov.io/gh/invenia/PkgTemplates.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/invenia/PkgTemplates.jl)
**PkgTemplates is a Julia package for creating new Julia packages in an easy, **PkgTemplates is a Julia package for creating new Julia packages in an easy,
repeatable, and customizable way.** repeatable, and customizable way.**
@ -80,7 +80,7 @@ julia> t = Template(;
julia_version=v"0.7", julia_version=v"0.7",
plugins=[ plugins=[
TravisCI(), TravisCI(),
CodeCov(), Codecov(),
Coveralls(), Coveralls(),
AppVeyor(), AppVeyor(),
GitHubPages(), GitHubPages(),
@ -97,7 +97,7 @@ Template:
• AppVeyor: • AppVeyor:
→ Config file: Default → Config file: Default
→ 0 gitignore entries → 0 gitignore entries
• CodeCov: • Codecov:
→ Config file: None → Config file: None
→ 3 gitignore entries: "*.jl.cov", "*.jl.*.cov", "*.jl.mem" → 3 gitignore entries: "*.jl.cov", "*.jl.*.cov", "*.jl.mem"
• Coveralls: • Coveralls:

View File

@ -4,7 +4,7 @@
[![Latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://invenia.github.io/PkgTemplates.jl/latest) [![Latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://invenia.github.io/PkgTemplates.jl/latest)
[![Build Status](https://travis-ci.org/invenia/PkgTemplates.jl.svg?branch=master)](https://travis-ci.org/invenia/PkgTemplates.jl) [![Build Status](https://travis-ci.org/invenia/PkgTemplates.jl.svg?branch=master)](https://travis-ci.org/invenia/PkgTemplates.jl)
[![Build Status](https://ci.appveyor.com/api/projects/status/r24xamruqlm88uti/branch/master?svg=true)](https://ci.appveyor.com/project/christopher-dG/pkgtemplates-jl/branch/master) [![Build Status](https://ci.appveyor.com/api/projects/status/r24xamruqlm88uti/branch/master?svg=true)](https://ci.appveyor.com/project/christopher-dG/pkgtemplates-jl/branch/master)
[![CodeCov](https://codecov.io/gh/invenia/PkgTemplates.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/invenia/PkgTemplates.jl) [![Codecov](https://codecov.io/gh/invenia/PkgTemplates.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/invenia/PkgTemplates.jl)
**PkgTemplates is a Julia package for creating new Julia packages in an easy, **PkgTemplates is a Julia package for creating new Julia packages in an easy,
repeatable, and customizable way.** repeatable, and customizable way.**
@ -40,7 +40,7 @@ t = Template(;
ssh=true, ssh=true,
plugins=[ plugins=[
TravisCI(), TravisCI(),
CodeCov(), Codecov(),
Coveralls(), Coveralls(),
AppVeyor(), AppVeyor(),
GitHubPages(), GitHubPages(),

View File

@ -19,7 +19,7 @@ GitLabCI
## Code Coverage ## Code Coverage
```@docs ```@docs
CodeCov Codecov
Coveralls Coveralls
``` ```

View File

@ -24,7 +24,7 @@ export
AppVeyor, AppVeyor,
TravisCI, TravisCI,
GitLabCI, GitLabCI,
CodeCov, Codecov,
Coveralls Coveralls
""" """
@ -46,6 +46,6 @@ include(joinpath("plugins", "gitlabci.jl"))
include(joinpath("plugins", "githubpages.jl")) include(joinpath("plugins", "githubpages.jl"))
const DEFAULTS_DIR = normpath(joinpath(@__DIR__, "..", "defaults")) const DEFAULTS_DIR = normpath(joinpath(@__DIR__, "..", "defaults"))
const BADGE_ORDER = [GitHubPages, TravisCI, AppVeyor, GitLabCI, CodeCov, Coveralls] const BADGE_ORDER = [GitHubPages, TravisCI, AppVeyor, GitLabCI, Codecov, Coveralls]
end end

View File

@ -321,7 +321,7 @@ function substitute(
"USER" => pkg_template.user, "USER" => pkg_template.user,
"VERSION" => "$(v.major).$(v.minor)", "VERSION" => "$(v.major).$(v.minor)",
"DOCUMENTER" => any(map(p -> isa(p, Documenter), values(pkg_template.plugins))), "DOCUMENTER" => any(map(p -> isa(p, Documenter), values(pkg_template.plugins))),
"CODECOV" => haskey(pkg_template.plugins, CodeCov), "CODECOV" => haskey(pkg_template.plugins, Codecov),
"COVERALLS" => haskey(pkg_template.plugins, Coveralls), "COVERALLS" => haskey(pkg_template.plugins, Coveralls),
) )
# d["AFTER"] is true whenever something needs to occur in a CI "after_script". # d["AFTER"] is true whenever something needs to occur in a CI "after_script".

View File

@ -1,7 +1,7 @@
""" """
CodeCov(; config_file::Union{AbstractString, Nothing}=nothing) -> CodeCov Codecov(; config_file::Union{AbstractString, Nothing}=nothing) -> Codecov
Add `CodeCov` to a template's plugins to optionally add a `.codecov.yml` configuration file Add `Codecov` to a template's plugins to optionally add a `.codecov.yml` configuration file
to generated repositories, and an appropriate badge to the README. Also updates the to generated repositories, and an appropriate badge to the README. Also updates the
`.gitignore` accordingly. `.gitignore` accordingly.
@ -9,14 +9,14 @@ to generated repositories, and an appropriate badge to the README. Also updates
* `config_file::Union{AbstractString, Nothing}=nothing`: Path to a custom `.codecov.yml`. * `config_file::Union{AbstractString, Nothing}=nothing`: Path to a custom `.codecov.yml`.
If left unset, no file will be generated. If left unset, no file will be generated.
""" """
@auto_hash_equals struct CodeCov <: GenericPlugin @auto_hash_equals struct Codecov <: GenericPlugin
gitignore::Vector{AbstractString} gitignore::Vector{AbstractString}
src::Union{AbstractString, Nothing} src::Union{AbstractString, Nothing}
dest::AbstractString dest::AbstractString
badges::Vector{Badge} badges::Vector{Badge}
view::Dict{String, Any} view::Dict{String, Any}
function CodeCov(; config_file::Union{AbstractString, Nothing}=nothing) function Codecov(; config_file::Union{AbstractString, Nothing}=nothing)
if config_file != nothing if config_file != nothing
config_file = if isfile(config_file) config_file = if isfile(config_file)
abspath(config_file) abspath(config_file)
@ -30,7 +30,7 @@ to generated repositories, and an appropriate badge to the README. Also updates
".codecov.yml", ".codecov.yml",
[ [
Badge( Badge(
"CodeCov", "Codecov",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl/branch/master/graph/badge.svg", "https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl/branch/master/graph/badge.svg",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl", "https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl",
), ),
@ -39,5 +39,6 @@ to generated repositories, and an appropriate badge to the README. Also updates
) )
end end
end end
Base.@deprecate_binding CodeCov Codecov
interactive(plugin_type::Type{CodeCov}) = interactive(plugin_type; file=nothing) interactive(::Type{Codecov}) = interactive(Codecov; file=nothing)

View File

@ -47,18 +47,18 @@ end
println() println()
end end
@testset "CodeCov" begin @testset "Codecov" begin
write(stdin.buffer, "\n") write(stdin.buffer, "\n")
p = interactive(CodeCov) p = interactive(Codecov)
@test p.src === nothing @test p.src === nothing
write(stdin.buffer, "$test_file\n") write(stdin.buffer, "$test_file\n")
p = interactive(CodeCov) p = interactive(Codecov)
@test p.src == test_file @test p.src == test_file
write(stdin.buffer, "none\n") write(stdin.buffer, "none\n")
p = interactive(CodeCov) p = interactive(Codecov)
@test p.src === nothing @test p.src === nothing
write(stdin.buffer, "$fake_path\n") write(stdin.buffer, "$fake_path\n")
@test_throws ArgumentError interactive(CodeCov) @test_throws ArgumentError interactive(Codecov)
println() println()
end end

View File

@ -37,10 +37,10 @@ pkg_dir = joinpath(t.dir, test_pkg)
@test !occursin("%JL_CODECOV_SCRIPT%", appveyor) @test !occursin("%JL_CODECOV_SCRIPT%", appveyor)
rm(joinpath(pkg_dir, ".appveyor.yml")) rm(joinpath(pkg_dir, ".appveyor.yml"))
# Generating the plugin with CodeCov in the template should create a post-test step. # Generating the plugin with Codecov in the template should create a post-test step.
t.plugins[CodeCov] = CodeCov() t.plugins[Codecov] = Codecov()
gen_plugin(p, t, test_pkg) gen_plugin(p, t, test_pkg)
delete!(t.plugins, CodeCov) delete!(t.plugins, Codecov)
appveyor = read(joinpath(pkg_dir, ".appveyor.yml"), String) appveyor = read(joinpath(pkg_dir, ".appveyor.yml"), String)
@test occursin("on_success", appveyor) @test occursin("on_success", appveyor)
@test occursin("%JL_CODECOV_SCRIPT%", appveyor) @test occursin("%JL_CODECOV_SCRIPT%", appveyor)

View File

@ -1,38 +1,38 @@
t = Template(; user=me) t = Template(; user=me)
pkg_dir = joinpath(t.dir, test_pkg) pkg_dir = joinpath(t.dir, test_pkg)
@testset "CodeCov" begin @testset "Codecov" begin
@testset "Plugin creation" begin @testset "Plugin creation" begin
p = CodeCov() p = Codecov()
@test p.gitignore == ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"] @test p.gitignore == ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"]
@test p.src === nothing @test p.src === nothing
@test p.dest == ".codecov.yml" @test p.dest == ".codecov.yml"
@test p.badges == [ @test p.badges == [
Badge( Badge(
"CodeCov", "Codecov",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl/branch/master/graph/badge.svg", "https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl/branch/master/graph/badge.svg",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl", "https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl",
) )
] ]
@test isempty(p.view) @test isempty(p.view)
p = CodeCov(; config_file=nothing) p = Codecov(; config_file=nothing)
@test p.src === nothing @test p.src === nothing
p = CodeCov(; config_file=test_file) p = Codecov(; config_file=test_file)
@test p.src == test_file @test p.src == test_file
@test_throws ArgumentError CodeCov(; config_file=fake_path) @test_throws ArgumentError Codecov(; config_file=fake_path)
end end
@testset "Badge generation" begin @testset "Badge generation" begin
p = CodeCov() p = Codecov()
@test badges(p, me, test_pkg) == ["[![CodeCov](https://codecov.io/gh/$me/$test_pkg.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/$me/$test_pkg.jl)"] @test badges(p, me, test_pkg) == ["[![Codecov](https://codecov.io/gh/$me/$test_pkg.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/$me/$test_pkg.jl)"]
end end
@testset "File generation" begin @testset "File generation" begin
p = CodeCov() p = Codecov()
@test isempty(gen_plugin(p, t, test_pkg)) @test isempty(gen_plugin(p, t, test_pkg))
@test !isfile(joinpath(pkg_dir, ".codecov.yml")) @test !isfile(joinpath(pkg_dir, ".codecov.yml"))
p = CodeCov(; config_file=test_file) p = Codecov(; config_file=test_file)
@test gen_plugin(p, t, test_pkg) == [".codecov.yml"] @test gen_plugin(p, t, test_pkg) == [".codecov.yml"]
@test isfile(joinpath(pkg_dir, ".codecov.yml")) @test isfile(joinpath(pkg_dir, ".codecov.yml"))
end end

View File

@ -40,10 +40,10 @@ pkg_dir = joinpath(t.dir, test_pkg)
@test !occursin("Pkg.add(\"Documenter\")", travis) @test !occursin("Pkg.add(\"Documenter\")", travis)
rm(joinpath(pkg_dir, ".travis.yml")) rm(joinpath(pkg_dir, ".travis.yml"))
# Generating the plugin with CodeCov in the template should create a post-test step. # Generating the plugin with Codecov in the template should create a post-test step.
t.plugins[CodeCov] = CodeCov() t.plugins[Codecov] = Codecov()
gen_plugin(p, t, test_pkg) gen_plugin(p, t, test_pkg)
delete!(t.plugins, CodeCov) delete!(t.plugins, Codecov)
travis = read(joinpath(pkg_dir, ".travis.yml"), String) travis = read(joinpath(pkg_dir, ".travis.yml"), String)
@test occursin("after_success", travis) @test occursin("after_success", travis)
@test occursin("Codecov.submit", travis) @test occursin("Codecov.submit", travis)

View File

@ -25,7 +25,7 @@ const template_text = """
PKGNAME: {{PKGNAME}} PKGNAME: {{PKGNAME}}
VERSION: {{VERSION}}} VERSION: {{VERSION}}}
{{#DOCUMENTER}}Documenter{{/DOCUMENTER}} {{#DOCUMENTER}}Documenter{{/DOCUMENTER}}
{{#CODECOV}}CodeCov{{/CODECOV}} {{#CODECOV}}Codecov{{/CODECOV}}
{{#COVERALLS}}Coveralls{{/COVERALLS}} {{#COVERALLS}}Coveralls{{/COVERALLS}}
{{#AFTER}}After{{/AFTER}} {{#AFTER}}After{{/AFTER}}
{{#OTHER}}Other{{/OTHER}} {{#OTHER}}Other{{/OTHER}}
@ -70,13 +70,13 @@ write(test_file, template_text)
# The template should contain whatever plugins you give it. # The template should contain whatever plugins you give it.
t = Template(; t = Template(;
user=me, user=me,
plugins = [GitHubPages(), TravisCI(), AppVeyor(), CodeCov(), Coveralls()], plugins = [GitHubPages(), TravisCI(), AppVeyor(), Codecov(), Coveralls()],
) )
@test Set(keys(t.plugins)) == Set( @test Set(keys(t.plugins)) == Set(
[GitHubPages, TravisCI, AppVeyor, CodeCov, Coveralls] [GitHubPages, TravisCI, AppVeyor, Codecov, Coveralls]
) )
@test Set(values(t.plugins)) == Set( @test Set(values(t.plugins)) == Set(
[GitHubPages(), TravisCI(), AppVeyor(), CodeCov(), Coveralls()] [GitHubPages(), TravisCI(), AppVeyor(), Codecov(), Coveralls()]
) )
# Duplicate plugins should warn. # Duplicate plugins should warn.
@ -128,7 +128,7 @@ end
ssh=true, ssh=true,
plugins=[ plugins=[
TravisCI(), TravisCI(),
CodeCov(), Codecov(),
GitHubPages(), GitHubPages(),
], ],
) )
@ -143,7 +143,7 @@ end
Minimum Julia version: v$(PkgTemplates.version_floor()) Minimum Julia version: v$(PkgTemplates.version_floor())
SSH remote: Yes SSH remote: Yes
Plugins: Plugins:
CodeCov: Codecov:
Config file: None Config file: None
3 gitignore entries: "*.jl.cov", "*.jl.*.cov", "*.jl.mem" 3 gitignore entries: "*.jl.cov", "*.jl.*.cov", "*.jl.mem"
GitHubPages: GitHubPages:
@ -160,7 +160,7 @@ end
t = Template(; t = Template(;
user=me, user=me,
license="MPL", license="MPL",
plugins=[Coveralls(), TravisCI(), CodeCov(), GitHubPages(), AppVeyor()], plugins=[Coveralls(), TravisCI(), Codecov(), GitHubPages(), AppVeyor()],
) )
temp_dir = mktempdir() temp_dir = mktempdir()
pkg_dir = joinpath(temp_dir, test_pkg) pkg_dir = joinpath(temp_dir, test_pkg)
@ -304,7 +304,7 @@ end
text = substitute(template_text, view) text = substitute(template_text, view)
@test !occursin("PKGNAME: $test_pkg", text) @test !occursin("PKGNAME: $test_pkg", text)
@test !occursin("Documenter", text) @test !occursin("Documenter", text)
@test !occursin("CodeCov", text) @test !occursin("Codecov", text)
@test !occursin("Coveralls", text) @test !occursin("Coveralls", text)
@test !occursin("After", text) @test !occursin("After", text)
@test !occursin("Other", text) @test !occursin("Other", text)
@ -330,9 +330,9 @@ end
@test occursin("After", text) @test occursin("After", text)
empty!(t.plugins) empty!(t.plugins)
t.plugins[CodeCov] = CodeCov() t.plugins[Codecov] = Codecov()
text = substitute(template_text, t; view=view) text = substitute(template_text, t; view=view)
@test occursin("CodeCov", text) @test occursin("Codecov", text)
@test occursin("After", text) @test occursin("After", text)
empty!(t.plugins) empty!(t.plugins)