Merge pull request #47 from invenia/cdg/cirrus
Add CirrusCI plugin for FreeBSD support
This commit is contained in:
commit
53a015d22f
@ -16,10 +16,9 @@ deps = ["Markdown"]
|
||||
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
|
||||
|
||||
[[IteratorInterfaceExtensions]]
|
||||
deps = ["Test"]
|
||||
git-tree-sha1 = "5484e5ede2a4137b9643f4d646e8e7b87b794415"
|
||||
git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856"
|
||||
uuid = "82899510-4779-5014-852e-03e436cf321d"
|
||||
version = "0.1.1"
|
||||
version = "1.0.0"
|
||||
|
||||
[[LibGit2]]
|
||||
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
|
||||
@ -39,10 +38,10 @@ deps = ["Base64"]
|
||||
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
|
||||
|
||||
[[Mustache]]
|
||||
deps = ["Printf", "Tables", "Test"]
|
||||
git-tree-sha1 = "3cc9a0b673519c5c39186e636d747facb12bf075"
|
||||
deps = ["Printf", "Tables"]
|
||||
git-tree-sha1 = "d27b8b8b99c052ea1fdd40c678bfb2dfaec4e96e"
|
||||
uuid = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70"
|
||||
version = "0.5.11"
|
||||
version = "0.5.12"
|
||||
|
||||
[[Pkg]]
|
||||
deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
|
||||
@ -76,16 +75,16 @@ uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
|
||||
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
|
||||
|
||||
[[TableTraits]]
|
||||
deps = ["IteratorInterfaceExtensions", "Test"]
|
||||
git-tree-sha1 = "eba4b1d0a82bdd773307d652c6e5f8c82104c676"
|
||||
deps = ["IteratorInterfaceExtensions"]
|
||||
git-tree-sha1 = "b1ad568ba658d8cbb3b892ed5380a6f3e781a81e"
|
||||
uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
|
||||
version = "0.4.1"
|
||||
version = "1.0.0"
|
||||
|
||||
[[Tables]]
|
||||
deps = ["IteratorInterfaceExtensions", "LinearAlgebra", "Requires", "TableTraits", "Test"]
|
||||
git-tree-sha1 = "37be2ed169d5771c1ac8d516d3bcb0093c49966e"
|
||||
git-tree-sha1 = "9e748316f5aa7b7753c90de612ef98fe8b0ea297"
|
||||
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
|
||||
version = "0.1.15"
|
||||
version = "0.2.1"
|
||||
|
||||
[[Test]]
|
||||
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
|
||||
|
17
README.md
17
README.md
@ -15,6 +15,22 @@ repeatable, and customizable way.**
|
||||
pkg> add PkgTemplates
|
||||
```
|
||||
|
||||
## Plugins
|
||||
|
||||
`PkgTemplates` is based on plugins which handle the setup of individual package components.
|
||||
The available plugins are:
|
||||
|
||||
* Continuous Integration (CI)
|
||||
* [Travis CI](https://travis-ci.com) (Linux, MacOS)
|
||||
* [AppVeyor](https://appveyor.com) (Windows)
|
||||
* [GitLabCI](https://gitlab.com) (Linux)
|
||||
* [CirrusCI](https://cirrus-ci.org) (FreeBSD)
|
||||
* Code Coverage
|
||||
* [Codecov](https://codecov.io)
|
||||
* [Coveralls](https://coveralls.io)
|
||||
* Documentation
|
||||
* [GitHubPages](https://pages.github.com)
|
||||
|
||||
## Usage
|
||||
|
||||
Assuming you have the relatively standard Git options `user.name`, `user.email` and `github.user` set up globally with `git config --global`, the simplest template requires no arguments:
|
||||
@ -61,6 +77,7 @@ julia> t = Template(;
|
||||
Coveralls(),
|
||||
AppVeyor(),
|
||||
GitHubPages(),
|
||||
CirrusCI(),
|
||||
],
|
||||
)
|
||||
Template:
|
||||
|
16
defaults/cirrus.yml
Normal file
16
defaults/cirrus.yml
Normal 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}}
|
@ -15,6 +15,22 @@ repeatable, and customizable way.**
|
||||
pkg> add PkgTemplates
|
||||
```
|
||||
|
||||
## Plugins
|
||||
|
||||
`PkgTemplates` is based on plugins which handle the setup of individual package components.
|
||||
The available plugins are:
|
||||
|
||||
* Continuous Integration (CI)
|
||||
* [Travis CI](https://travis-ci.com) (Linux, MacOS)
|
||||
* [AppVeyor](https://appveyor.com) (Windows)
|
||||
* [GitLabCI](https://gitlab.com) (Linux)
|
||||
* [CirrusCI](https://cirrus-ci.org) (FreeBSD)
|
||||
* Code Coverage
|
||||
* [Codecov](https://codecov.io)
|
||||
* [Coveralls](https://coveralls.io)
|
||||
* Documentation
|
||||
* [GitHubPages](https://pages.github.com)
|
||||
|
||||
## Usage
|
||||
|
||||
```@setup usage
|
||||
@ -56,6 +72,7 @@ t = Template(;
|
||||
Coveralls(),
|
||||
AppVeyor(),
|
||||
GitHubPages(),
|
||||
CirrusCI(),
|
||||
],
|
||||
)
|
||||
generate("MyPkg2", t)
|
||||
|
@ -14,6 +14,7 @@ describes plugins that already exist; for information on writing your own plugin
|
||||
TravisCI
|
||||
AppVeyor
|
||||
GitLabCI
|
||||
CirrusCI
|
||||
```
|
||||
|
||||
## Code Coverage
|
||||
|
@ -23,6 +23,7 @@ export
|
||||
AppVeyor,
|
||||
TravisCI,
|
||||
GitLabCI,
|
||||
CirrusCI,
|
||||
Codecov,
|
||||
Coveralls,
|
||||
Citation
|
||||
@ -43,6 +44,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"))
|
||||
include(joinpath("plugins", "citation.jl"))
|
||||
|
45
src/plugins/cirrusci.jl
Normal file
45
src/plugins/cirrusci.jl
Normal 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")
|
54
test/plugins/cirrusci.jl
Normal file
54
test/plugins/cirrusci.jl
Normal file
@ -0,0 +1,54 @@
|
||||
t = Template(; user=me)
|
||||
pkg_dir = joinpath(t.dir, test_pkg)
|
||||
|
||||
@testset "CirrusCI" begin
|
||||
@testset "Plugin creation" begin
|
||||
p = CirrusCI()
|
||||
@test isempty(p.gitignore)
|
||||
@test p.src == joinpath(DEFAULTS_DIR, "cirrus.yml")
|
||||
@test p.dest == ".cirrus.yml"
|
||||
@test p.badges == [
|
||||
Badge(
|
||||
"Build Status",
|
||||
"https://api.cirrus-ci.com/github/{{USER}}/{{PKGNAME}}.jl.svg",
|
||||
"https://cirrus-ci.com/github/{{USER}}/{{PKGNAME}}.jl",
|
||||
),
|
||||
]
|
||||
@test isempty(p.view)
|
||||
p = CirrusCI(; config_file=nothing)
|
||||
@test p.src === nothing
|
||||
p = CirrusCI(; config_file=test_file)
|
||||
@test p.src == test_file
|
||||
@test_throws ArgumentError CirrusCI(; config_file=fake_path)
|
||||
end
|
||||
|
||||
@testset "Badge generation" begin
|
||||
p = CirrusCI()
|
||||
@test badges(p, me, test_pkg) == ["[](https://cirrus-ci.com/github/$me/$test_pkg.jl)"]
|
||||
end
|
||||
|
||||
@testset "File generation" begin
|
||||
# Without a coverage plugin in the template, there should be no coverage step.
|
||||
p = CirrusCI()
|
||||
@test gen_plugin(p, t, test_pkg) == [".cirrus.yml"]
|
||||
@test isfile(joinpath(pkg_dir, ".cirrus.yml"))
|
||||
cirrus = read(joinpath(pkg_dir, ".cirrus.yml"), String)
|
||||
@test !occursin("coverage_script", cirrus)
|
||||
rm(joinpath(pkg_dir, ".cirrus.yml"))
|
||||
|
||||
# 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)
|
||||
cirrus = read(joinpath(pkg_dir, ".cirrus.yml"), String)
|
||||
@test occursin("coverage_script", cirrus)
|
||||
@test occursin("cirrusjl coverage", cirrus)
|
||||
rm(joinpath(pkg_dir, ".cirrus.yml"))
|
||||
|
||||
p = CirrusCI(; config_file=nothing)
|
||||
@test isempty(gen_plugin(p, t, test_pkg))
|
||||
@test !isfile(joinpath(pkg_dir, ".cirrus.yml"))
|
||||
end
|
||||
end
|
||||
|
||||
rm(pkg_dir; recursive=true)
|
@ -438,6 +438,7 @@ end
|
||||
include(joinpath("plugins", "travisci.jl"))
|
||||
include(joinpath("plugins", "appveyor.jl"))
|
||||
include(joinpath("plugins", "gitlabci.jl"))
|
||||
include(joinpath("plugins", "cirrusci.jl"))
|
||||
include(joinpath("plugins", "codecov.jl"))
|
||||
include(joinpath("plugins", "coveralls.jl"))
|
||||
include(joinpath("plugins", "githubpages.jl"))
|
||||
|
Loading…
Reference in New Issue
Block a user