Add a CompatHelper plugin
TODO: Handle the Manifest.toml updating stuff.
This commit is contained in:
parent
a79c087010
commit
1f653ec04b
@ -75,6 +75,7 @@ Documenter
|
||||
|
||||
```@docs
|
||||
Develop
|
||||
CompatHelper
|
||||
Citation
|
||||
```
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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"))
|
||||
|
@ -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"
|
||||
|
||||
|
25
src/plugins/compat_helper.jl
Normal file
25
src/plugins/compat_helper.jl
Normal 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
|
17
templates/github/workflows/CompatHelper.yml
Normal file
17
templates/github/workflows/CompatHelper.yml
Normal 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 }}
|
17
test/fixtures/AllPlugins/.github/workflows/CompatHelper.yml
vendored
Normal file
17
test/fixtures/AllPlugins/.github/workflows/CompatHelper.yml
vendored
Normal 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 }}
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user