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

Add plugins for TagBot and CompatHelper #107

Merged
merged 9 commits into from
Dec 18, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[compat]
Mustache = ">= 0.5.13"
Mustache = "1"
Parameters = "0.12"
julia = "1"

[extras]
Expand Down
2 changes: 2 additions & 0 deletions docs/src/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Tests
Readme
License
Git
TagBot
```

### Continuous Integration (CI)
Expand Down Expand Up @@ -74,6 +75,7 @@ Documenter

```@docs
Develop
CompatHelper
Citation
```

Expand Down
5 changes: 3 additions & 2 deletions src/PkgTemplates.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module PkgTemplates

using Base: active_project
using Base.Filesystem: contractuser
using Base: active_project, contractuser

using Dates: month, today, year
using LibGit2: LibGit2, GitRemote, GitRepo
Expand All @@ -18,6 +17,7 @@ export
Citation,
DroneCI,
Codecov,
CompatHelper,
Coveralls,
Develop,
Documenter,
Expand All @@ -28,6 +28,7 @@ export
ProjectFile,
Readme,
SrcDir,
TagBot,
Tests,
TravisCI

Expand Down
2 changes: 2 additions & 0 deletions src/plugin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ include(joinpath("plugins", "tests.jl"))
include(joinpath("plugins", "readme.jl"))
include(joinpath("plugins", "license.jl"))
include(joinpath("plugins", "git.jl"))
include(joinpath("plugins", "tagbot.jl"))
include(joinpath("plugins", "develop.jl"))
include(joinpath("plugins", "coverage.jl"))
include(joinpath("plugins", "ci.jl"))
include(joinpath("plugins", "compat_helper.jl"))
include(joinpath("plugins", "citation.jl"))
include(joinpath("plugins", "documenter.jl"))
4 changes: 1 addition & 3 deletions src/plugins/ci.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Integrates your packages with [GitHub Actions](https://github.com/features/actio

## Keyword Arguments
- `file::AbstractString`: Template file for the workflow file.
- `destination::AbstractString`: Destination of the worflow file,
- `destination::AbstractString`: Destination of the workflow file,
relative to `.github/workflows`.
- `linux::Bool`: Whether or not to run builds on Linux.
- `osx::Bool`: Whether or not to run builds on OSX (MacOS).
Expand Down Expand Up @@ -61,7 +61,6 @@ end

source(p::GitHubActions) = p.file
destination(p::GitHubActions) = joinpath(".github", "workflows", p.destination)

tags(::GitHubActions) = "<<", ">>"

badges(p::GitHubActions) = Badge(
Expand Down Expand Up @@ -305,7 +304,6 @@ See [`Documenter`](@ref) for more information.
end

gitignore(p::GitLabCI) = p.coverage ? COVERAGE_GITIGNORE : String[]

source(p::GitLabCI) = p.file
destination(::GitLabCI) = ".gitlab-ci.yml"

Expand Down
25 changes: 25 additions & 0 deletions src/plugins/compat_helper.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
CompatHelper(;
file="$(contractuser(default_file("github", "workflows", "CompatHelper.yml")))",
destination="CompatHelper.yml",
)

Integrates your packages with [CompatHelper](https://github.com/bcbi/CompatHelper.jl) via GitHub Actions.

## Keyword Arguments
- `file::AbstractString`: Template file for the workflow file.
- `destination::AbstractString`: Destination of the workflow file,
relative to `.github/workflows`.
"""
@with_kw_noshow struct CompatHelper <: BasicPlugin
file::String = default_file("github", "workflows", "CompatHelper.yml")
destination::String = "CompatHelper.yml"
end

source(p::CompatHelper) = p.file
destination(p::CompatHelper) = joinpath(".github", "workflows", p.destination)
tags(::CompatHelper) = "<<", ">>"

view(p::CompatHelper, t::Template, ::AbstractString) = Dict(
"VERSION" => format_version(max(v"1.2", t.julia)),
)
25 changes: 25 additions & 0 deletions src/plugins/tagbot.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
TagBot(; destination="TagBot.yml", registry=nothing, dispatch=false)

Adds GitHub release support via [TagBot](https://github.com/JuliaRegistries/TagBot).

## Keyword Arguments
- `destination::AbstractString`: Destination of the workflow file,
relative to `.github/workflows`.
- `registry::Union{AbstractString, Nothing}`: Custom registry, in the format `owner/repo`.
- `dispatch::Bool`: Whether or not to enable the `dispatch` option.
"""
@with_kw_noshow struct TagBot <: BasicPlugin
destination::String = "TagBot.yml"
registry::Union{String, Nothing} = nothing
dispatch::Bool = false
end

source(::TagBot) = default_file("github", "workflows", "TagBot.yml")
destination(p::TagBot) = joinpath(".github", "workflows", p.destination)
tags(::TagBot) = "<<", ">>"

view(p::TagBot, ::Template, ::AbstractString) = Dict(
"HAS_DISPATCH" => p.dispatch,
"REGISTRY" => p.registry,
)
11 changes: 10 additions & 1 deletion src/template.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
default_plugins() = [ProjectFile(), SrcDir(), Git(), License(), Readme(), Tests()]
default_user() = LibGit2.getconfig("github.user", "")
default_version() = VersionNumber(VERSION.major)
default_plugins() = [
CompatHelper(),
ProjectFile(),
SrcDir(),
Git(),
License(),
Readme(),
Tests(),
TagBot(),
]

function default_authors()
name = LibGit2.getconfig("user.name", "")
Expand Down
17 changes: 17 additions & 0 deletions templates/github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CompatHelper
on:
schedule:
- cron: 0 * * * *
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: <<&VERSION>>
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
run: julia -e 'using CompatHelper; CompatHelper.main()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions templates/github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
<<#REGISTRY>>
registry: <<&REGISTRY>>
<</REGISTRY>>
<<#HAS_DISPATCH>>
dispatch: true
<</HAS_DISPATCH>>
17 changes: 17 additions & 0 deletions test/fixtures/AllPlugins/.github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CompatHelper
on:
schedule:
- cron: 0 * * * *
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: 1.2
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
run: julia -e 'using CompatHelper; CompatHelper.main()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions test/fixtures/AllPlugins/.github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
12 changes: 6 additions & 6 deletions test/fixtures/AllPlugins/docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[DocStringExtensions]]
deps = ["LibGit2", "Markdown", "Pkg", "Test"]
git-tree-sha1 = "0513f1a8991e9d83255e0140aace0d0fc4486600"
git-tree-sha1 = "88bb0edb352b16608036faadcc071adda068582a"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.0"
version = "0.8.1"

[[Documenter]]
deps = ["Base64", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
git-tree-sha1 = "1b6ae3796f60311e39cd1770566140d2c056e87f"
git-tree-sha1 = "d45c163c7a3ae293c15361acc52882c0f853f97c"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "0.23.3"
version = "0.23.4"

[[InteractiveUtils]]
deps = ["Markdown"]
Expand All @@ -48,9 +48,9 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804"

[[Parsers]]
deps = ["Dates", "Test"]
git-tree-sha1 = "ef0af6c8601db18c282d092ccbd2f01f3f0cd70b"
git-tree-sha1 = "c56ecb484f286639f161e712b8311f5ab77e8d32"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "0.3.7"
version = "0.3.8"

[[Pkg]]
deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
Expand Down
17 changes: 17 additions & 0 deletions test/fixtures/Basic/.github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CompatHelper
on:
schedule:
- cron: 0 * * * *
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: 1.2
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
run: julia -e 'using CompatHelper; CompatHelper.main()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions test/fixtures/Basic/.github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CompatHelper
on:
schedule:
- cron: 0 * * * *
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: 1.2
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
run: julia -e 'using CompatHelper; CompatHelper.main()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions test/fixtures/DocumenterGitHubActions/.github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions test/fixtures/DocumenterTravis/.github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CompatHelper
on:
schedule:
- cron: 0 * * * *
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: 1.2
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
run: julia -e 'using CompatHelper; CompatHelper.main()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions test/fixtures/DocumenterTravis/.github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions test/fixtures/WackyOptions/.github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CompatHelper
on:
schedule:
- cron: 0 * * * *
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: 1.2
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
run: julia -e 'using CompatHelper; CompatHelper.main()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions test/fixtures/WackyOptions/.github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
registry: Foo/Bar
dispatch: true
Loading