2019-02-05 17:31:51 +00:00
|
|
|
const VersionsOrStrings = Vector{Union{VersionNumber, String}}
|
2019-08-31 10:33:33 +00:00
|
|
|
const ALLOWED_FAILURES = ["1.3", "nightly"] # TODO: Update this list with new RCs.
|
|
|
|
const DEFAULT_CI_VERSIONS = VersionsOrStrings([VERSION, default_version(), "nightly"])
|
2019-02-05 17:31:51 +00:00
|
|
|
|
|
|
|
format_version(v::VersionNumber) = "$(v.major).$(v.minor)"
|
2019-08-29 16:04:11 +00:00
|
|
|
format_version(v::AbstractString) = string(v)
|
2019-02-05 17:31:51 +00:00
|
|
|
|
2019-08-29 16:04:11 +00:00
|
|
|
function collect_versions(t::Template, versions::Vector)
|
2019-08-31 10:33:33 +00:00
|
|
|
vs = map(format_version, [t.julia_version, versions...])
|
|
|
|
return unique(sort(vs))
|
2019-02-05 17:31:51 +00:00
|
|
|
end
|
|
|
|
|
2019-08-29 16:04:11 +00:00
|
|
|
@with_kw struct TravisCI <: BasicPlugin
|
2019-02-05 17:31:51 +00:00
|
|
|
file::String = default_file("travis.yml")
|
|
|
|
linux::Bool = true
|
|
|
|
osx::Bool = true
|
|
|
|
windows::Bool = true
|
|
|
|
x86::Bool = false
|
|
|
|
coverage::Bool = true
|
|
|
|
extra_versions::VersionsOrStrings = DEFAULT_CI_VERSIONS
|
|
|
|
end
|
|
|
|
|
|
|
|
source(p::TravisCI) = p.file
|
|
|
|
destination(::TravisCI) = ".travis.yml"
|
|
|
|
|
|
|
|
badges(::TravisCI) = Badge(
|
|
|
|
"Build Status",
|
|
|
|
"https://travis-ci.com/{{USER}}/{{PKG}}.jl.svg?branch=master",
|
|
|
|
"https://travis-ci.com/{{USER}}/{{PKG}}.jl",
|
|
|
|
)
|
|
|
|
|
2019-08-27 14:59:25 +00:00
|
|
|
function view(p::TravisCI, t::Template, pkg::AbstractString)
|
2019-08-27 05:43:10 +00:00
|
|
|
os = String[]
|
|
|
|
p.linux && push!(os, "linux")
|
|
|
|
p.osx && push!(os, "osx")
|
|
|
|
p.windows && push!(os, "windows")
|
|
|
|
|
2019-08-29 16:04:11 +00:00
|
|
|
|
|
|
|
versions = collect_versions(t, p.extra_versions)
|
|
|
|
allow_failures = filter(in(versions), ALLOWED_FAILURES)
|
2019-08-27 05:43:10 +00:00
|
|
|
|
|
|
|
x86 = Dict{String, String}[]
|
|
|
|
if p.x86
|
2019-08-27 14:59:25 +00:00
|
|
|
foreach(versions) do v
|
2019-08-31 10:33:33 +00:00
|
|
|
p.linux && push!(x86, Dict("JULIA" => v, "OS" => "linux"))
|
|
|
|
p.windows && push!(x86, Dict("JULIA" => v, "OS" => "windows"))
|
2019-08-27 14:59:25 +00:00
|
|
|
end
|
2019-02-05 17:31:51 +00:00
|
|
|
end
|
2019-08-27 05:43:10 +00:00
|
|
|
|
2019-02-05 17:31:51 +00:00
|
|
|
return Dict(
|
2019-08-27 05:43:10 +00:00
|
|
|
"ALLOW_FAILURES" => allow_failures,
|
|
|
|
"HAS_ALLOW_FAILURES" => !isempty(allow_failures),
|
2019-02-05 17:31:51 +00:00
|
|
|
"HAS_CODECOV" => hasplugin(t, Codecov),
|
2019-08-29 16:04:11 +00:00
|
|
|
"HAS_COVERAGE" => p.coverage && hasplugin(t, is_coverage),
|
2019-02-05 17:31:51 +00:00
|
|
|
"HAS_COVERALLS" => hasplugin(t, Coveralls),
|
|
|
|
"HAS_DOCUMENTER" => hasplugin(t, Documenter{TravisCI}),
|
2019-08-27 05:43:10 +00:00
|
|
|
"HAS_JOBS" => p.x86 || hasplugin(t, Documenter{TravisCI}),
|
|
|
|
"OS" => os,
|
2019-02-05 17:31:51 +00:00
|
|
|
"PKG" => pkg,
|
2019-08-29 16:04:11 +00:00
|
|
|
"USER" => t.user,
|
2019-02-05 17:31:51 +00:00
|
|
|
"VERSION" => format_version(t.julia_version),
|
2019-08-29 16:04:11 +00:00
|
|
|
"VERSIONS" => versions,
|
2019-08-27 05:43:10 +00:00
|
|
|
"X86" => x86,
|
2019-02-05 17:31:51 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2019-08-29 16:04:11 +00:00
|
|
|
@with_kw struct AppVeyor <: BasicPlugin
|
2019-02-05 17:31:51 +00:00
|
|
|
file::String = default_file("appveyor.yml")
|
|
|
|
x86::Bool = false
|
|
|
|
coverage::Bool = true
|
|
|
|
extra_versions::VersionsOrStrings = DEFAULT_CI_VERSIONS
|
|
|
|
end
|
|
|
|
|
|
|
|
source(p::AppVeyor) = p.file
|
|
|
|
destination(::AppVeyor) = ".appveyor.yml"
|
|
|
|
|
|
|
|
badges(::AppVeyor) = Badge(
|
|
|
|
"Build Status",
|
|
|
|
"https://ci.appveyor.com/api/projects/status/github/{{USER}}/{{PKG}}.jl?svg=true",
|
|
|
|
"https://ci.appveyor.com/project/{{USER}}/{{PKG}}-jl",
|
|
|
|
)
|
|
|
|
|
2019-08-29 16:04:11 +00:00
|
|
|
function view(p::AppVeyor, t::Template, pkg::AbstractString)
|
2019-02-05 17:31:51 +00:00
|
|
|
platforms = ["x64"]
|
2019-08-29 16:04:11 +00:00
|
|
|
p.x86 && push!(platforms, "x86")
|
|
|
|
|
|
|
|
versions = collect_versions(t, p.extra_versions)
|
|
|
|
allow_failures = filter(in(versions), ALLOWED_FAILURES)
|
|
|
|
|
2019-02-05 17:31:51 +00:00
|
|
|
return Dict(
|
2019-08-29 16:04:11 +00:00
|
|
|
"ALLOW_FAILURES" => allow_failures,
|
|
|
|
"HAS_ALLOW_FAILURES" => !isempty(allow_failures),
|
|
|
|
"HAS_CODECOV" => p.coverage && hasplugin(t, Codecov),
|
2019-02-05 17:31:51 +00:00
|
|
|
"PKG" => pkg,
|
2019-08-29 16:04:11 +00:00
|
|
|
"PLATFORMS" => platforms,
|
|
|
|
"USER" => t.user,
|
|
|
|
"VERSIONS" => versions,
|
2019-02-05 17:31:51 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2019-08-29 16:04:11 +00:00
|
|
|
@with_kw struct CirrusCI <: BasicPlugin
|
2019-02-05 17:31:51 +00:00
|
|
|
file::String = default_file("cirrus.yml")
|
|
|
|
image::String = "freebsd-12-0-release-amd64"
|
|
|
|
coverage::Bool = true
|
|
|
|
extra_versions::VersionsOrStrings = DEFAULT_CI_VERSIONS
|
|
|
|
end
|
|
|
|
|
|
|
|
source(p::CirrusCI) = p.file
|
|
|
|
destination(::CirrusCI) = ".cirrus.yml"
|
|
|
|
|
|
|
|
badges(::CirrusCI) = Badge(
|
|
|
|
"Build Status",
|
|
|
|
"https://api.cirrus-ci.com/github/{{USER}}/{{PACKAGE}}.jl.svg",
|
|
|
|
"https://cirrus-ci.com/github/{{USER}}/{{PKG}}.jl",
|
|
|
|
)
|
|
|
|
|
2019-08-31 11:45:41 +00:00
|
|
|
function view(p::CirrusCI, t::Template, pkg::AbstractString)
|
2019-02-05 17:31:51 +00:00
|
|
|
return Dict(
|
|
|
|
"HAS_CODECOV" => hasplugin(t, Codecov),
|
|
|
|
"HAS_COVERALLS" => hasplugin(t, Coveralls),
|
2019-08-29 16:04:11 +00:00
|
|
|
"HAS_COVERAGE" => p.coverage && hasplugin(t, is_coverage),
|
2019-02-05 17:31:51 +00:00
|
|
|
"IMAGE" => p.image,
|
|
|
|
"PKG" => pkg,
|
2019-08-29 16:04:11 +00:00
|
|
|
"USER" => t.user,
|
|
|
|
"VERSIONS" => collect_versions(t, p.extra_versions),
|
2019-02-05 17:31:51 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2019-08-29 16:04:11 +00:00
|
|
|
@with_kw struct GitLabCI <: BasicPlugin
|
2019-08-31 10:33:33 +00:00
|
|
|
file::String = default_file("gitlab-ci.yml")
|
2019-02-05 17:31:51 +00:00
|
|
|
documentation::Bool = true
|
|
|
|
coverage::Bool = true
|
2019-08-31 10:33:33 +00:00
|
|
|
extra_versions::VersionsOrStrings = ["1.0"] # Nightly has no Docker image.
|
2019-02-05 17:31:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
gitignore(p::GitLabCI) = p.coverage ? COVERAGE_GITIGNORE : String[]
|
|
|
|
|
2019-08-31 11:45:41 +00:00
|
|
|
source(p::GitLabCI) = p.file
|
2019-02-05 17:31:51 +00:00
|
|
|
destination(::GitLabCI) = ".gitlab-ci.yml"
|
|
|
|
|
|
|
|
function badges(p::GitLabCI)
|
|
|
|
ci = Badge(
|
|
|
|
"Build Status",
|
|
|
|
"https://gitlab.com/{{USER}}/{{PKG}}.jl/badges/master/build.svg",
|
|
|
|
"https://gitlab.com/{{USER}}/{{PKG}}.jl/pipelines",
|
|
|
|
)
|
|
|
|
cov = Badge(
|
|
|
|
"Coverage",
|
|
|
|
"https://gitlab.com/{{USER}}/{{PKG}}.jl/badges/master/coverage.svg",
|
|
|
|
"https://gitlab.com/{{USER}}/{{PKG}}.jl/commits/master",
|
|
|
|
)
|
|
|
|
return p.coverage ? [ci, cov] : [ci]
|
|
|
|
end
|
|
|
|
|
2019-08-31 11:45:41 +00:00
|
|
|
function view(p::GitLabCI, t::Template, pkg::AbstractString)
|
2019-02-05 17:31:51 +00:00
|
|
|
return Dict(
|
|
|
|
"HAS_COVERAGE" => p.coverage,
|
|
|
|
"HAS_DOCUMENTER" => hasplugin(t, Documenter{GitLabCI}),
|
|
|
|
"PKG" => pkg,
|
2019-08-29 16:04:11 +00:00
|
|
|
"USER" => t.user,
|
2019-02-05 17:31:51 +00:00
|
|
|
"VERSION" => format_version(t.julia_version),
|
2019-08-29 16:04:11 +00:00
|
|
|
"VERSIONS" => collect_versions(t, p.extra_versions),
|
2019-02-05 17:31:51 +00:00
|
|
|
)
|
|
|
|
end
|
2019-08-29 16:04:11 +00:00
|
|
|
|
|
|
|
is_ci(::Type) = false
|
|
|
|
is_ci(::Type{<:Union{AppVeyor, TravisCI, CirrusCI, GitLabCI}}) = true
|