From cd204640d30552242864f298c0c6a1ff29190102 Mon Sep 17 00:00:00 2001 From: Chris de Graaf Date: Tue, 17 Dec 2019 13:21:03 +0700 Subject: [PATCH] Fix some typos, make CompatHelper a default plugin --- src/plugins/ci.jl | 2 +- src/plugins/compat_helper.jl | 8 ++++---- src/plugins/tagbot.jl | 2 +- src/template.jl | 11 ++++++++++- .../Basic/.github/workflows/CompatHelper.yml | 17 +++++++++++++++++ .../.github/workflows/CompatHelper.yml | 17 +++++++++++++++++ .../.github/workflows/CompatHelper.yml | 17 +++++++++++++++++ .../.github/workflows/CompatHelper.yml | 17 +++++++++++++++++ test/show.jl | 3 +++ 9 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 test/fixtures/Basic/.github/workflows/CompatHelper.yml create mode 100644 test/fixtures/DocumenterGitHubActions/.github/workflows/CompatHelper.yml create mode 100644 test/fixtures/DocumenterTravis/.github/workflows/CompatHelper.yml create mode 100644 test/fixtures/WackyOptions/.github/workflows/CompatHelper.yml diff --git a/src/plugins/ci.jl b/src/plugins/ci.jl index b203b48..21fe487 100644 --- a/src/plugins/ci.jl +++ b/src/plugins/ci.jl @@ -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). diff --git a/src/plugins/compat_helper.jl b/src/plugins/compat_helper.jl index 43dc85e..fd23144 100644 --- a/src/plugins/compat_helper.jl +++ b/src/plugins/compat_helper.jl @@ -8,7 +8,7 @@ Integrates your packages with [CompatHelper](https://github.com/bcbi/CompatHelpe ## 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`. """ @with_kw_noshow struct CompatHelper <: BasicPlugin @@ -20,6 +20,6 @@ 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(p::CompatHelper, t::Template, ::AbstractString) = Dict( + "VERSION" => format_version(max(v"1.2", t.julia)), +) diff --git a/src/plugins/tagbot.jl b/src/plugins/tagbot.jl index 43d639b..be418b5 100644 --- a/src/plugins/tagbot.jl +++ b/src/plugins/tagbot.jl @@ -4,7 +4,7 @@ Adds GitHub release support via [TagBot](https://github.com/JuliaRegistries/TagBot). ## Keyword Arguments -- `destination::AbstractString`: Destination of the worflow file, +- `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. diff --git a/src/template.jl b/src/template.jl index 5a920f5..363b7d3 100644 --- a/src/template.jl +++ b/src/template.jl @@ -1,6 +1,15 @@ -default_plugins() = [ProjectFile(), SrcDir(), Git(), License(), Readme(), Tests(), TagBot()] 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", "") diff --git a/test/fixtures/Basic/.github/workflows/CompatHelper.yml b/test/fixtures/Basic/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..e78623d --- /dev/null +++ b/test/fixtures/Basic/.github/workflows/CompatHelper.yml @@ -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 }} diff --git a/test/fixtures/DocumenterGitHubActions/.github/workflows/CompatHelper.yml b/test/fixtures/DocumenterGitHubActions/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..e78623d --- /dev/null +++ b/test/fixtures/DocumenterGitHubActions/.github/workflows/CompatHelper.yml @@ -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 }} diff --git a/test/fixtures/DocumenterTravis/.github/workflows/CompatHelper.yml b/test/fixtures/DocumenterTravis/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..e78623d --- /dev/null +++ b/test/fixtures/DocumenterTravis/.github/workflows/CompatHelper.yml @@ -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 }} diff --git a/test/fixtures/WackyOptions/.github/workflows/CompatHelper.yml b/test/fixtures/WackyOptions/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..e78623d --- /dev/null +++ b/test/fixtures/WackyOptions/.github/workflows/CompatHelper.yml @@ -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 }} diff --git a/test/show.jl b/test/show.jl index ccaca3f..8fbff6c 100644 --- a/test/show.jl +++ b/test/show.jl @@ -30,6 +30,9 @@ const LICENSES_DIR = joinpath(TEMPLATES_DIR, "licenses") julia: v"1.0.0" user: "$USER" plugins: + CompatHelper: + file: "$(joinpath(TEMPLATES_DIR, "github", "workflows", "CompatHelper.yml"))" + destination: "CompatHelper.yml" Git: ignore: String[] ssh: false