Add DroneCI plugin for new PkgTemplates

This commit is contained in:
Chris de Graaf 2019-10-06 15:13:37 +07:00
parent 5e9ff16cbe
commit ad8e78d87e
No known key found for this signature in database
GPG Key ID: 150FFDD9B0073C7B
9 changed files with 144 additions and 4 deletions

View File

@ -49,6 +49,7 @@ These plugins will create the configuration files of common CI services for you.
```@docs
AppVeyor
CirrusCI
DroneCI
GitLabCI
TravisCI
```

View File

@ -253,6 +253,61 @@ function view(p::GitLabCI, t::Template, pkg::AbstractString)
)
end
"""
DroneCI(;
file="$(contractuser(default_file("drone.star")))",
amd64=true,
arm=false,
arm64=false,
extra_versions=$DEFAULT_CI_VERSIONS_NO_NIGHTLY,
)
Integrates your packages with [Drone CI](https://drone.io).
## Keyword Arguments
- `file::AbstractString`: Template file for `.drone.star`.
- `destination::AbstractString`: File destination, relative to the repository root.
For example, you might want to generate a `.drone.yml` instead of the default Starlark file.
- `amd64::Bool`: Whether or not to run builds on AMD64.
- `arm::Bool`: Whether or not to run builds on ARM (32-bit).
- `arm::Bool`: Whether or not to run builds on ARM64.
$EXTRA_VERSIONS_DOC
!!! note
Nightly Julia is not supported.
"""
@with_kw_noshow struct DroneCI <: BasicPlugin
file::String = default_file("drone.star")
destination::String = ".drone.star"
amd64::Bool = true
arm::Bool = false
arm64::Bool = false
extra_versions::Vector = DEFAULT_CI_VERSIONS_NO_NIGHTLY
end
source(p::DroneCI) = p.file
destination(p::DroneCI) = p.destination
badges(::DroneCI) = Badge(
"Build Status",
"https://cloud.drone.io/api/badges/{{{USER}}}/{{{PKG}}}.jl/status.svg",
"https://cloud.drone.io/{{{USER}}}/{{{PKG}}}.jl",
)
function view(p::DroneCI, t::Template, pkg::AbstractString)
arches = String[]
p.amd64 && push!(arches, "amd64")
p.arm && push!(arches, "arm")
p.arm64 && push!(arches, "arm64")
return Dict(
"ARCHES" => join(map(repr, arches), ", "),
"PKG" => pkg,
"USER" => t.user,
"VERSIONS" => join(map(repr, collect_versions(t, p.extra_versions)), ", "),
)
end
"""
is_ci(::Plugin) -> Bool
@ -260,6 +315,6 @@ Determine whether or not a plugin is a CI plugin.
If you are adding a CI plugin, you should implement this function and return `true`.
"""
is_ci(::Plugin) = false
is_ci(::Union{AppVeyor, TravisCI, CirrusCI, GitLabCI}) = true
is_ci(::Union{AppVeyor, TravisCI, CirrusCI, GitLabCI, DroneCI}) = true
needs_username(::Union{AppVeyor, TravisCI, CirrusCI, GitLabCI}) = true
needs_username(::Union{AppVeyor, TravisCI, CirrusCI, GitLabCI, DroneCI}) = true

View File

@ -51,6 +51,7 @@ badge_order() = [
GitLabCI,
TravisCI,
AppVeyor,
DroneCI,
CirrusCI,
Codecov,
Coveralls,

27
templates/drone.star Normal file
View File

@ -0,0 +1,27 @@
def main(ctx):
pipelines = []
for arch in [{{{ARCHES}}}]:
for julia in [{{{VERSIONS}}}]:
pipelines.append(pipeline(arch, julia))
return pipelines
def pipeline(arch, julia):
return {
"kind": "pipeline",
"type": "docker",
"name": "Julia %s - %s" % (julia, arch),
"platform": {
"os": "linux",
"arch": arch,
},
"steps": [
{
"name": "test",
"image": "julia:%s" % julia,
"commands": [
"julia -e 'using InteractiveUtils; versioninfo()'",
"julia --project=@. -e 'using Pkg; Pkg.instantiate(); Pkg.build(); Pkg.test();'",
],
},
],
}

27
test/fixtures/AllPlugins/.drone.star vendored Normal file
View File

@ -0,0 +1,27 @@
def main(ctx):
pipelines = []
for arch in ["amd64"]:
for julia in ["1.0", "1.2"]:
pipelines.append(pipeline(arch, julia))
return pipelines
def pipeline(arch, julia):
return {
"kind": "pipeline",
"type": "docker",
"name": "Julia %s - %s" % (julia, arch),
"platform": {
"os": "linux",
"arch": arch,
},
"steps": [
{
"name": "test",
"image": "julia:%s" % julia,
"commands": [
"julia -e 'using InteractiveUtils; versioninfo()'",
"julia --project=@. -e 'using Pkg; Pkg.instantiate(); Pkg.build(); Pkg.test();'",
],
},
],
}

View File

@ -4,6 +4,7 @@
[![Coverage](https://gitlab.com/tester/AllPlugins.jl/badges/master/coverage.svg)](https://gitlab.com/tester/AllPlugins.jl/commits/master)
[![Build Status](https://travis-ci.com/tester/AllPlugins.jl.svg?branch=master)](https://travis-ci.com/tester/AllPlugins.jl)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/tester/AllPlugins.jl?svg=true)](https://ci.appveyor.com/project/tester/AllPlugins-jl)
[![Build Status](https://cloud.drone.io/api/badges/tester/AllPlugins.jl/status.svg)](https://cloud.drone.io/tester/AllPlugins.jl)
[![Build Status](https://api.cirrus-ci.com/github/tester/AllPlugins.jl.svg)](https://cirrus-ci.com/github/tester/AllPlugins.jl)
[![Coverage](https://codecov.io/gh//.jl/branch/master/graph/badge.svg)](https://codecov.io/gh//.jl)
[![Coverage](https://coveralls.io/repos/github//.jl/badge.svg?branch=master)](https://coveralls.io/github//.jl?branch=master)

27
test/fixtures/WackyOptions/.drone.star vendored Normal file
View File

@ -0,0 +1,27 @@
def main(ctx):
pipelines = []
for arch in ["arm", "arm64"]:
for julia in ["1.1", "1.2"]:
pipelines.append(pipeline(arch, julia))
return pipelines
def pipeline(arch, julia):
return {
"kind": "pipeline",
"type": "docker",
"name": "Julia %s - %s" % (julia, arch),
"platform": {
"os": "linux",
"arch": arch,
},
"steps": [
{
"name": "test",
"image": "julia:%s" % julia,
"commands": [
"julia -e 'using InteractiveUtils; versioninfo()'",
"julia --project=@. -e 'using Pkg; Pkg.instantiate(); Pkg.build(); Pkg.test();'",
],
},
],
}

View File

@ -1,4 +1,4 @@
# WackyOptions [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.gitlab.io/WackyOptions.jl/dev) [![Build Status](https://gitlab.com/tester/WackyOptions.jl/badges/master/build.svg)](https://gitlab.com/tester/WackyOptions.jl/pipelines) [![Build Status](https://travis-ci.com/tester/WackyOptions.jl.svg?branch=master)](https://travis-ci.com/tester/WackyOptions.jl) [![Build Status](https://ci.appveyor.com/api/projects/status/github/tester/WackyOptions.jl?svg=true)](https://ci.appveyor.com/project/tester/WackyOptions-jl) [![Build Status](https://api.cirrus-ci.com/github/tester/WackyOptions.jl.svg)](https://cirrus-ci.com/github/tester/WackyOptions.jl) [![Coverage](https://codecov.io/gh//.jl/branch/master/graph/badge.svg)](https://codecov.io/gh//.jl) [![Coverage](https://coveralls.io/repos/github//.jl/badge.svg?branch=master)](https://coveralls.io/github//.jl?branch=master)
# WackyOptions [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.gitlab.io/WackyOptions.jl/dev) [![Build Status](https://gitlab.com/tester/WackyOptions.jl/badges/master/build.svg)](https://gitlab.com/tester/WackyOptions.jl/pipelines) [![Build Status](https://travis-ci.com/tester/WackyOptions.jl.svg?branch=master)](https://travis-ci.com/tester/WackyOptions.jl) [![Build Status](https://ci.appveyor.com/api/projects/status/github/tester/WackyOptions.jl?svg=true)](https://ci.appveyor.com/project/tester/WackyOptions-jl) [![Build Status](https://cloud.drone.io/api/badges/tester/WackyOptions.jl/status.svg)](https://cloud.drone.io/tester/WackyOptions.jl) [![Build Status](https://api.cirrus-ci.com/github/tester/WackyOptions.jl.svg)](https://cirrus-ci.com/github/tester/WackyOptions.jl) [![Coverage](https://codecov.io/gh//.jl/branch/master/graph/badge.svg)](https://codecov.io/gh//.jl) [![Coverage](https://coveralls.io/repos/github//.jl/badge.svg?branch=master)](https://coveralls.io/github//.jl?branch=master)
## Citing

View File

@ -23,7 +23,7 @@ end
@testset "All plugins" begin
test_all("AllPlugins"; authors=USER, plugins=[
AppVeyor(), CirrusCI(), Citation(), Codecov(), Coveralls(),
Develop(), Documenter(), GitLabCI(), TravisCI(),
Develop(), Documenter(), DroneCI(), GitLabCI(), TravisCI(),
])
end
@ -39,6 +39,7 @@ end
makedocs_kwargs=Dict(:foo => "bar", :bar => "baz"),
canonical_url=(_t, _pkg) -> "http://example.com",
),
DroneCI(; amd64=false, arm=true, arm64=true, extra_versions=["1.1"]),
Git(; ignore=["a", "b", "c"], manifest=true),
GitLabCI(; coverage=false, extra_versions=[v"0.6"]),
License(; name="ISC"),