Add CirrusCI plugin

This commit is contained in:
Chris de Graaf 2019-01-03 10:43:00 -06:00 committed by Chris de Graaf
parent beb169a2c4
commit 3db77fb865
3 changed files with 63 additions and 0 deletions

16
defaults/cirrus.yml Normal file
View File

@ -0,0 +1,16 @@
freebsd_instance:
image: freebsd-12-0-release-amd64
task:
name: FreeBSD
env:
JULIA_VERSION: {{VERSION}}
install_script:
- sh -c "$(fetch https://raw.githubusercontent.com/ararslan/CirrusCI.jl/master/bin/install.sh -o -)"
build_script:
- cirrusjl build
test_script:
- cirrusjl test
{{#COVERAGE}}
coverage_script:
- cirrusjl coverage{{#CODECOV}} codecov{{/CODECOV}}{{#COVERALLS}} coveralls{{/COVERALLS}}
{{/COVERAGE}}

View File

@ -23,6 +23,7 @@ export
AppVeyor,
TravisCI,
GitLabCI,
CirrusCI,
Codecov,
Coveralls
@ -42,6 +43,7 @@ include(joinpath("plugins", "appveyor.jl"))
include(joinpath("plugins", "codecov.jl"))
include(joinpath("plugins", "travisci.jl"))
include(joinpath("plugins", "gitlabci.jl"))
include(joinpath("plugins", "cirrusci.jl"))
include(joinpath("plugins", "githubpages.jl"))
include(joinpath("plugins", "gitlabpages.jl"))

45
src/plugins/cirrusci.jl Normal file
View File

@ -0,0 +1,45 @@
"""
CirrusCI(; config_file::Union{AbstractString, Nothing}="") -> CirrusCI
Add `CirrusCI` to a template's plugins to add a `.cirrus.yml` configuration file to
generated repositories, and an appropriate badge to the README. The default configuration
file supports only FreeBSD builds via [CirrusCI.jl](https://github.com/ararslan/CirrusCI.jl)
# Keyword Arguments
* `config_file::Union{AbstractString, Nothing}=""`: Path to a custom `.cirrus.yml`.
If `nothing` is supplied, no file will be generated.
"""
struct CirrusCI <: GenericPlugin
gitignore::Vector{String}
src::Union{String, Nothing}
dest::String
badges::Vector{Badge}
view::Dict{String, Any}
function CirrusCI(; config_file::Union{AbstractString, Nothing}="")
if config_file !== nothing
config_file = if isempty(config_file)
joinpath(DEFAULTS_DIR, "cirrus.yml")
elseif isfile(config_file)
abspath(config_file)
else
throw(ArgumentError("File $(abspath(config_file)) does not exist"))
end
end
return new(
[],
config_file,
".cirrus.yml",
[
Badge(
"Build Status",
"https://api.cirrus-ci.com/github/{{USER}}/{{PKGNAME}}.jl.svg",
"https://cirrus-ci.com/github/{{USER}}/{{PKGNAME}}.jl",
),
],
Dict{String, Any}(),
)
end
end
interactive(::Type{CirrusCI}) = interactive(CirrusCI; file="cirrus.yml")