Add a CompatHelper plugin

TODO: Handle the Manifest.toml updating stuff.
This commit is contained in:
Chris de Graaf 2019-11-10 11:54:08 +07:00
parent a79c087010
commit 1f653ec04b
No known key found for this signature in database
GPG Key ID: 150FFDD9B0073C7B
9 changed files with 67 additions and 7 deletions

View File

@ -75,6 +75,7 @@ Documenter
```@docs
Develop
CompatHelper
Citation
```

View File

@ -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
@ -18,6 +17,7 @@ export
Citation,
DroneCI,
Codecov,
CompatHelper,
Coveralls,
Develop,
Documenter,

View File

@ -261,5 +261,6 @@ 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"))

View File

@ -61,7 +61,6 @@ end
source(p::GitHubActions) = p.file
destination(p::GitHubActions) = joinpath(".github", "workflows", p.destination)
tags(::GitHubActions) = "<<", ">>"
badges(p::GitHubActions) = Badge(
@ -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"

View File

@ -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 worflow 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) = "<<", ">>"
function view(p::CompatHelper, t::Template, ::AbstractString)
return Dict("VERSION" => format_version(max(v"1.2", t.julia)))
end

View File

@ -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 }}

View File

@ -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 }}

View File

@ -39,8 +39,8 @@ end
@testset "All plugins" begin
test_all("AllPlugins"; authors=USER, plugins=[
AppVeyor(), CirrusCI(), Citation(), Codecov(), Coveralls(), Develop(),
Documenter(), DroneCI(), GitHubActions(), GitLabCI(), TravisCI(),
AppVeyor(), CirrusCI(), Citation(), Codecov(), CompatHelper(), Coveralls(),
Develop(), Documenter(), DroneCI(), GitHubActions(), GitLabCI(), TravisCI(),
])
end

View File

@ -1,4 +1,5 @@
using Base.Filesystem: contractuser, path_separator
using Base: contractuser
using Base.Filesystem: path_separator
using LibGit2: LibGit2, GitCommit, GitRemote, GitRepo
using Pkg: Pkg, PackageSpec, TOML