Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate CodeCov for Codecov #34

Merged
merged 1 commit into from Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -4,7 +4,7 @@
[![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://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,
repeatable, and customizable way.**
Expand Down Expand Up @@ -80,7 +80,7 @@ julia> t = Template(;
julia_version=v"0.7",
plugins=[
TravisCI(),
CodeCov(),
Codecov(),
Coveralls(),
AppVeyor(),
GitHubPages(),
Expand All @@ -97,7 +97,7 @@ Template:
• AppVeyor:
→ Config file: Default
→ 0 gitignore entries
CodeCov:
Codecov:
→ Config file: None
→ 3 gitignore entries: "*.jl.cov", "*.jl.*.cov", "*.jl.mem"
• Coveralls:
Expand Down
4 changes: 2 additions & 2 deletions docs/src/index.md
Expand Up @@ -4,7 +4,7 @@
[![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://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,
repeatable, and customizable way.**
Expand Down Expand Up @@ -40,7 +40,7 @@ t = Template(;
ssh=true,
plugins=[
TravisCI(),
CodeCov(),
Codecov(),
Coveralls(),
AppVeyor(),
GitHubPages(),
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/plugins.md
Expand Up @@ -19,7 +19,7 @@ GitLabCI
## Code Coverage

```@docs
CodeCov
Codecov
Coveralls
```

Expand Down
4 changes: 2 additions & 2 deletions src/PkgTemplates.jl
Expand Up @@ -24,7 +24,7 @@ export
AppVeyor,
TravisCI,
GitLabCI,
CodeCov,
Codecov,
Coveralls

"""
Expand All @@ -46,6 +46,6 @@ include(joinpath("plugins", "gitlabci.jl"))
include(joinpath("plugins", "githubpages.jl"))

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
2 changes: 1 addition & 1 deletion src/generate.jl
Expand Up @@ -321,7 +321,7 @@ function substitute(
"USER" => pkg_template.user,
"VERSION" => "$(v.major).$(v.minor)",
"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),
)
# d["AFTER"] is true whenever something needs to occur in a CI "after_script".
Expand Down
13 changes: 7 additions & 6 deletions src/plugins/codecov.jl
@@ -1,22 +1,22 @@
"""
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
`.gitignore` accordingly.

# Keyword Arguments:
* `config_file::Union{AbstractString, Nothing}=nothing`: Path to a custom `.codecov.yml`.
If left unset, no file will be generated.
"""
@auto_hash_equals struct CodeCov <: GenericPlugin
@auto_hash_equals struct Codecov <: GenericPlugin
gitignore::Vector{AbstractString}
src::Union{AbstractString, Nothing}
dest::AbstractString
badges::Vector{Badge}
view::Dict{String, Any}

function CodeCov(; config_file::Union{AbstractString, Nothing}=nothing)
function Codecov(; config_file::Union{AbstractString, Nothing}=nothing)
if config_file != nothing
config_file = if isfile(config_file)
abspath(config_file)
Expand All @@ -30,7 +30,7 @@ to generated repositories, and an appropriate badge to the README. Also updates
".codecov.yml",
[
Badge(
"CodeCov",
"Codecov",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl/branch/master/graph/badge.svg",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl",
),
Expand All @@ -39,5 +39,6 @@ to generated repositories, and an appropriate badge to the README. Also updates
)
end
end
Base.@deprecate_binding CodeCov Codecov

interactive(plugin_type::Type{CodeCov}) = interactive(plugin_type; file=nothing)
interactive(::Type{Codecov}) = interactive(Codecov; file=nothing)
10 changes: 5 additions & 5 deletions test/interactive/plugins.jl
Expand Up @@ -47,18 +47,18 @@ end
println()
end

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

Expand Down
6 changes: 3 additions & 3 deletions test/plugins/appveyor.jl
Expand Up @@ -37,10 +37,10 @@ pkg_dir = joinpath(t.dir, test_pkg)
@test !occursin("%JL_CODECOV_SCRIPT%", appveyor)
rm(joinpath(pkg_dir, ".appveyor.yml"))

# Generating the plugin with CodeCov in the template should create a post-test step.
t.plugins[CodeCov] = CodeCov()
# Generating the plugin with Codecov in the template should create a post-test step.
t.plugins[Codecov] = Codecov()
gen_plugin(p, t, test_pkg)
delete!(t.plugins, CodeCov)
delete!(t.plugins, Codecov)
appveyor = read(joinpath(pkg_dir, ".appveyor.yml"), String)
@test occursin("on_success", appveyor)
@test occursin("%JL_CODECOV_SCRIPT%", appveyor)
Expand Down
20 changes: 10 additions & 10 deletions test/plugins/codecov.jl
@@ -1,38 +1,38 @@
t = Template(; user=me)
pkg_dir = joinpath(t.dir, test_pkg)

@testset "CodeCov" begin
@testset "Codecov" begin
@testset "Plugin creation" begin
p = CodeCov()
p = Codecov()
@test p.gitignore == ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"]
@test p.src === nothing
@test p.dest == ".codecov.yml"
@test p.badges == [
Badge(
"CodeCov",
"Codecov",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl/branch/master/graph/badge.svg",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl",
)
]
@test isempty(p.view)
p = CodeCov(; config_file=nothing)
p = Codecov(; config_file=nothing)
@test p.src === nothing
p = CodeCov(; config_file=test_file)
p = Codecov(; config_file=test_file)
@test p.src == test_file
@test_throws ArgumentError CodeCov(; config_file=fake_path)
@test_throws ArgumentError Codecov(; config_file=fake_path)
end

@testset "Badge generation" begin
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)"]
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)"]
end

@testset "File generation" begin
p = CodeCov()
p = Codecov()
@test isempty(gen_plugin(p, t, test_pkg))
@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 isfile(joinpath(pkg_dir, ".codecov.yml"))
end
Expand Down
6 changes: 3 additions & 3 deletions test/plugins/travisci.jl
Expand Up @@ -40,10 +40,10 @@ pkg_dir = joinpath(t.dir, test_pkg)
@test !occursin("Pkg.add(\"Documenter\")", travis)
rm(joinpath(pkg_dir, ".travis.yml"))

# Generating the plugin with CodeCov in the template should create a post-test step.
t.plugins[CodeCov] = CodeCov()
# Generating the plugin with Codecov in the template should create a post-test step.
t.plugins[Codecov] = Codecov()
gen_plugin(p, t, test_pkg)
delete!(t.plugins, CodeCov)
delete!(t.plugins, Codecov)
travis = read(joinpath(pkg_dir, ".travis.yml"), String)
@test occursin("after_success", travis)
@test occursin("Codecov.submit", travis)
Expand Down
20 changes: 10 additions & 10 deletions test/tests.jl
Expand Up @@ -25,7 +25,7 @@ const template_text = """
PKGNAME: {{PKGNAME}}
VERSION: {{VERSION}}}
{{#DOCUMENTER}}Documenter{{/DOCUMENTER}}
{{#CODECOV}}CodeCov{{/CODECOV}}
{{#CODECOV}}Codecov{{/CODECOV}}
{{#COVERALLS}}Coveralls{{/COVERALLS}}
{{#AFTER}}After{{/AFTER}}
{{#OTHER}}Other{{/OTHER}}
Expand Down Expand Up @@ -70,13 +70,13 @@ write(test_file, template_text)
# The template should contain whatever plugins you give it.
t = Template(;
user=me,
plugins = [GitHubPages(), TravisCI(), AppVeyor(), CodeCov(), Coveralls()],
plugins = [GitHubPages(), TravisCI(), AppVeyor(), Codecov(), Coveralls()],
)
@test Set(keys(t.plugins)) == Set(
[GitHubPages, TravisCI, AppVeyor, CodeCov, Coveralls]
[GitHubPages, TravisCI, AppVeyor, Codecov, Coveralls]
)
@test Set(values(t.plugins)) == Set(
[GitHubPages(), TravisCI(), AppVeyor(), CodeCov(), Coveralls()]
[GitHubPages(), TravisCI(), AppVeyor(), Codecov(), Coveralls()]
)

# Duplicate plugins should warn.
Expand Down Expand Up @@ -128,7 +128,7 @@ end
ssh=true,
plugins=[
TravisCI(),
CodeCov(),
Codecov(),
GitHubPages(),
],
)
Expand All @@ -143,7 +143,7 @@ end
→ Minimum Julia version: v$(PkgTemplates.version_floor())
→ SSH remote: Yes
→ Plugins:
CodeCov:
Codecov:
→ Config file: None
→ 3 gitignore entries: "*.jl.cov", "*.jl.*.cov", "*.jl.mem"
• GitHubPages:
Expand All @@ -160,7 +160,7 @@ end
t = Template(;
user=me,
license="MPL",
plugins=[Coveralls(), TravisCI(), CodeCov(), GitHubPages(), AppVeyor()],
plugins=[Coveralls(), TravisCI(), Codecov(), GitHubPages(), AppVeyor()],
)
temp_dir = mktempdir()
pkg_dir = joinpath(temp_dir, test_pkg)
Expand Down Expand Up @@ -304,7 +304,7 @@ end
text = substitute(template_text, view)
@test !occursin("PKGNAME: $test_pkg", text)
@test !occursin("Documenter", text)
@test !occursin("CodeCov", text)
@test !occursin("Codecov", text)
@test !occursin("Coveralls", text)
@test !occursin("After", text)
@test !occursin("Other", text)
Expand All @@ -330,9 +330,9 @@ end
@test occursin("After", text)
empty!(t.plugins)

t.plugins[CodeCov] = CodeCov()
t.plugins[Codecov] = Codecov()
text = substitute(template_text, t; view=view)
@test occursin("CodeCov", text)
@test occursin("Codecov", text)
@test occursin("After", text)
empty!(t.plugins)

Expand Down