From 1cb56bf90326d47c402af51537c9c669e9b08a24 Mon Sep 17 00:00:00 2001 From: Kenta Sato Date: Tue, 8 Feb 2022 19:32:17 +0900 Subject: [PATCH 01/66] Add slash to the end of docs URLs (#340) --- src/plugins/documenter.jl | 4 ++-- test/fixtures/DocumenterGitHubActions/README.md | 4 ++-- test/fixtures/DocumenterTravis/README.md | 4 ++-- test/fixtures/WackyOptions/README.md | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/documenter.jl b/src/plugins/documenter.jl index 2f321659..aad958ed 100644 --- a/src/plugins/documenter.jl +++ b/src/plugins/documenter.jl @@ -108,12 +108,12 @@ badges(::Documenter{<:GitHubPagesStyle}) = [ Badge( "Stable", "https://img.shields.io/badge/docs-stable-blue.svg", - "https://{{{USER}}}.github.io/{{{PKG}}}.jl/stable", + "https://{{{USER}}}.github.io/{{{PKG}}}.jl/stable/", ), Badge( "Dev", "https://img.shields.io/badge/docs-dev-blue.svg", - "https://{{{USER}}}.github.io/{{{PKG}}}.jl/dev", + "https://{{{USER}}}.github.io/{{{PKG}}}.jl/dev/", ), ] badges(::Documenter{GitLabCI}) = Badge( diff --git a/test/fixtures/DocumenterGitHubActions/README.md b/test/fixtures/DocumenterGitHubActions/README.md index 35b64030..8a9d1fcb 100644 --- a/test/fixtures/DocumenterGitHubActions/README.md +++ b/test/fixtures/DocumenterGitHubActions/README.md @@ -1,5 +1,5 @@ # DocumenterGitHubActions -[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://tester.github.io/DocumenterGitHubActions.jl/stable) -[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.github.io/DocumenterGitHubActions.jl/dev) +[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://tester.github.io/DocumenterGitHubActions.jl/stable/) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.github.io/DocumenterGitHubActions.jl/dev/) [![Build Status](https://github.com/tester/DocumenterGitHubActions.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/tester/DocumenterGitHubActions.jl/actions/workflows/CI.yml?query=branch%3Amain) diff --git a/test/fixtures/DocumenterTravis/README.md b/test/fixtures/DocumenterTravis/README.md index db585260..21f04c7a 100644 --- a/test/fixtures/DocumenterTravis/README.md +++ b/test/fixtures/DocumenterTravis/README.md @@ -1,5 +1,5 @@ # DocumenterTravis -[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://tester.github.io/DocumenterTravis.jl/stable) -[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.github.io/DocumenterTravis.jl/dev) +[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://tester.github.io/DocumenterTravis.jl/stable/) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.github.io/DocumenterTravis.jl/dev/) [![Build Status](https://travis-ci.com/tester/DocumenterTravis.jl.svg?branch=main)](https://travis-ci.com/tester/DocumenterTravis.jl) diff --git a/test/fixtures/WackyOptions/README.md b/test/fixtures/WackyOptions/README.md index 40276427..c0dfaec3 100644 --- a/test/fixtures/WackyOptions/README.md +++ b/test/fixtures/WackyOptions/README.md @@ -1,4 +1,4 @@ -# WackyOptions [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://tester.github.io/WackyOptions.jl/stable) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.github.io/WackyOptions.jl/dev) [![Build Status](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml/badge.svg?branch=whackybranch)](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml?query=branch%3Awhackybranch) [![Build Status](https://x.com/tester/WackyOptions.jl/badges/whackybranch/pipeline.svg)](https://x.com/tester/WackyOptions.jl/pipelines) [![Build Status](https://travis-ci.com/tester/WackyOptions.jl.svg?branch=whackybranch)](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://coveralls.io/repos/github/tester/WackyOptions.jl/badge.svg?branch=whackybranch)](https://coveralls.io/github/tester/WackyOptions.jl?branch=whackybranch) [![PkgEval](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/W/WackyOptions.svg)](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/report.html) +# WackyOptions [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://tester.github.io/WackyOptions.jl/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.github.io/WackyOptions.jl/dev/) [![Build Status](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml/badge.svg?branch=whackybranch)](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml?query=branch%3Awhackybranch) [![Build Status](https://x.com/tester/WackyOptions.jl/badges/whackybranch/pipeline.svg)](https://x.com/tester/WackyOptions.jl/pipelines) [![Build Status](https://travis-ci.com/tester/WackyOptions.jl.svg?branch=whackybranch)](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://coveralls.io/repos/github/tester/WackyOptions.jl/badge.svg?branch=whackybranch)](https://coveralls.io/github/tester/WackyOptions.jl?branch=whackybranch) [![PkgEval](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/W/WackyOptions.svg)](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/report.html) ## Citing From bb3b54d5b24ab458258241d34d3f1a3d331e3a68 Mon Sep 17 00:00:00 2001 From: Nick Robinson Date: Wed, 25 May 2022 16:37:02 +0100 Subject: [PATCH 02/66] Update reference tests to latest v1.7 release (#349) * Update reference tests to latest v1.7 release * Add comment about keeping branch protection rules up-to-date --- .github/workflows/CI.yml | 8 ++++++-- test/fixtures/AllPlugins/docs/Manifest.toml | 2 +- .../DocumenterGitHubActions/docs/Manifest.toml | 2 +- test/fixtures/DocumenterGitLabCI/docs/Manifest.toml | 2 +- test/fixtures/DocumenterTravis/docs/Manifest.toml | 2 +- test/fixtures/WackyOptions/docs/Manifest.toml | 2 +- test/fixtures/WackyOptions/test/Manifest.toml | 2 +- test/runtests.jl | 10 ++++++---- 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 33f0115a..f0595775 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -36,9 +36,13 @@ jobs: - os: windows-latest arch: x86 include: - # Add 1.7.1 to run the reference tests + # Add specific version used to run the reference tests. + # Must be kept in sync with version check in `test/runtests.jl`, + # and with the branch protection rules on the repository which + # require this specific job to pass on all PRs + # (see Settings > Branches > Branch protection rules). - os: ubuntu-latest - version: 1.7.1 + version: 1.7.2 arch: x64 steps: - uses: actions/checkout@v2 diff --git a/test/fixtures/AllPlugins/docs/Manifest.toml b/test/fixtures/AllPlugins/docs/Manifest.toml index 7a63bf23..464214e1 100644 --- a/test/fixtures/AllPlugins/docs/Manifest.toml +++ b/test/fixtures/AllPlugins/docs/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.7.1" +julia_version = "1.7.2" manifest_format = "2.0" [[deps.AllPlugins]] diff --git a/test/fixtures/DocumenterGitHubActions/docs/Manifest.toml b/test/fixtures/DocumenterGitHubActions/docs/Manifest.toml index d7ad9b76..b16c489e 100644 --- a/test/fixtures/DocumenterGitHubActions/docs/Manifest.toml +++ b/test/fixtures/DocumenterGitHubActions/docs/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.7.1" +julia_version = "1.7.2" manifest_format = "2.0" [[deps.ArgTools]] diff --git a/test/fixtures/DocumenterGitLabCI/docs/Manifest.toml b/test/fixtures/DocumenterGitLabCI/docs/Manifest.toml index 2a044a0f..4c9b6d9a 100644 --- a/test/fixtures/DocumenterGitLabCI/docs/Manifest.toml +++ b/test/fixtures/DocumenterGitLabCI/docs/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.7.1" +julia_version = "1.7.2" manifest_format = "2.0" [[deps.ArgTools]] diff --git a/test/fixtures/DocumenterTravis/docs/Manifest.toml b/test/fixtures/DocumenterTravis/docs/Manifest.toml index b8a9d965..70147d15 100644 --- a/test/fixtures/DocumenterTravis/docs/Manifest.toml +++ b/test/fixtures/DocumenterTravis/docs/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.7.1" +julia_version = "1.7.2" manifest_format = "2.0" [[deps.ArgTools]] diff --git a/test/fixtures/WackyOptions/docs/Manifest.toml b/test/fixtures/WackyOptions/docs/Manifest.toml index e9d524d8..bd100ee1 100644 --- a/test/fixtures/WackyOptions/docs/Manifest.toml +++ b/test/fixtures/WackyOptions/docs/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.7.1" +julia_version = "1.7.2" manifest_format = "2.0" [[deps.ArgTools]] diff --git a/test/fixtures/WackyOptions/test/Manifest.toml b/test/fixtures/WackyOptions/test/Manifest.toml index e07c83f5..189c0f39 100644 --- a/test/fixtures/WackyOptions/test/Manifest.toml +++ b/test/fixtures/WackyOptions/test/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.7.1" +julia_version = "1.7.2" manifest_format = "2.0" [[deps.Base64]] diff --git a/test/runtests.jl b/test/runtests.jl index e44a2af2..372b964e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -31,7 +31,7 @@ function with_pkg(f::Function, t::Template, pkg::AbstractString=pkgname()) patch = @patch uuid4() = UUID("c51a4d33-e9a4-4efb-a257-e0de888ecc28") @suppress apply(patch) do t(pkg) - end + end try f(pkg) finally @@ -101,8 +101,10 @@ mktempdir() do dir # Quite a bit of output depends on the Julia version, # and the test fixtures are made with Julia 1.7. - # TODO: Keep this on the latest stable Julia version. - if VERSION == v"1.7.1" + # TODO: Keep this on the latest stable Julia version, and update + # the version used by the corresponding CI job at the same time. + REFERENCE_VERSION = v"1.7.2" + if VERSION == REFERENCE_VERSION # Ideally we'd use `with_clean_gitconfig`, but it's way too slow. branch = LibGit2.getconfig( "init.defaultBranch", @@ -114,7 +116,7 @@ mktempdir() do dir "Skipping reference tests, init.defaultBranch is set" end else - @info "Skipping reference tests" VERSION + @info "Skipping reference tests (requiring $REFERENCE_VERSION)" VERSION end else @info "Git is not installed, skipping Git and reference tests" From b94c409aebf95bf8ddf1c1edb28071205251a1f8 Mon Sep 17 00:00:00 2001 From: Rik Huijzer Date: Thu, 26 May 2022 20:41:48 +0200 Subject: [PATCH 03/66] Set `permissions: contents: write` (#347) * Set `permissions: write-all` * Set `permissions: contents: write` * Put `COMPATHELPER_PRIV` back --- .github/workflows/CompatHelper.yml | 2 ++ Project.toml | 2 +- templates/github/workflows/CI.yml | 3 ++- templates/github/workflows/register.yml | 2 ++ test/fixtures/AllPlugins/.github/workflows/register.yml | 2 ++ test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml | 3 ++- test/fixtures/WackyOptions/.github/workflows/CI.yml | 3 ++- test/fixtures/WackyOptions/.github/workflows/register.yml | 2 ++ 8 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index 6c96707a..c988a3e7 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -6,6 +6,8 @@ on: jobs: CompatHelper: runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Pkg.add("CompatHelper") run: julia -e 'using Pkg; Pkg.add("CompatHelper")' diff --git a/Project.toml b/Project.toml index 59ee3cf3..0b0e1eb1 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.26" +version = "0.7.27" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/templates/github/workflows/CI.yml b/templates/github/workflows/CI.yml index 87c3fc99..f8431daa 100644 --- a/templates/github/workflows/CI.yml +++ b/templates/github/workflows/CI.yml @@ -65,6 +65,8 @@ jobs: docs: name: Documentation runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 @@ -74,7 +76,6 @@ jobs: - uses: julia-actions/julia-docdeploy@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} - run: | julia --project=docs -e ' using Documenter: DocMeta, doctest diff --git a/templates/github/workflows/register.yml b/templates/github/workflows/register.yml index 235e085c..86cc87c7 100644 --- a/templates/github/workflows/register.yml +++ b/templates/github/workflows/register.yml @@ -8,6 +8,8 @@ on: jobs: register: runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: julia-actions/RegisterAction@latest with: diff --git a/test/fixtures/AllPlugins/.github/workflows/register.yml b/test/fixtures/AllPlugins/.github/workflows/register.yml index 6e71f2f9..5b7cd3b3 100644 --- a/test/fixtures/AllPlugins/.github/workflows/register.yml +++ b/test/fixtures/AllPlugins/.github/workflows/register.yml @@ -8,6 +8,8 @@ on: jobs: register: runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: julia-actions/RegisterAction@latest with: diff --git a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml index 71432e3d..b13e4662 100644 --- a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml +++ b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml @@ -37,6 +37,8 @@ jobs: docs: name: Documentation runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 @@ -46,7 +48,6 @@ jobs: - uses: julia-actions/julia-docdeploy@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} - run: | julia --project=docs -e ' using Documenter: DocMeta, doctest diff --git a/test/fixtures/WackyOptions/.github/workflows/CI.yml b/test/fixtures/WackyOptions/.github/workflows/CI.yml index 5ff3c09d..faf35952 100644 --- a/test/fixtures/WackyOptions/.github/workflows/CI.yml +++ b/test/fixtures/WackyOptions/.github/workflows/CI.yml @@ -37,6 +37,8 @@ jobs: docs: name: Documentation runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 @@ -46,7 +48,6 @@ jobs: - uses: julia-actions/julia-docdeploy@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} - run: | julia --project=docs -e ' using Documenter: DocMeta, doctest diff --git a/test/fixtures/WackyOptions/.github/workflows/register.yml b/test/fixtures/WackyOptions/.github/workflows/register.yml index db2a328d..08ecd395 100644 --- a/test/fixtures/WackyOptions/.github/workflows/register.yml +++ b/test/fixtures/WackyOptions/.github/workflows/register.yml @@ -8,6 +8,8 @@ on: jobs: register: runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: julia-actions/RegisterAction@latest with: From bb6a83459c45c919ef38dbdd2c89f9ab229f77c5 Mon Sep 17 00:00:00 2001 From: Nick Robinson Date: Sat, 28 May 2022 00:18:20 +0100 Subject: [PATCH 04/66] Allow setting Documenter `edit_link` (#350) * Allow setting Documenter `edit_link` * Update navigation in test now we have an extra option * Fix and test passing Symbol interactively * Update src/interactive.jl Co-authored-by: Frames Catherine White Co-authored-by: Frames Catherine White --- src/interactive.jl | 10 ++++ src/plugins/documenter.jl | 47 +++++++++++++------ templates/docs/make.jl | 3 ++ test/fixtures/AllPlugins/docs/make.jl | 1 + .../DocumenterGitHubActions/docs/make.jl | 1 + test/fixtures/DocumenterGitLabCI/docs/make.jl | 1 + test/fixtures/DocumenterTravis/docs/make.jl | 1 + test/fixtures/WackyOptions/docs/make.jl | 1 + test/interactive.jl | 6 ++- test/reference.jl | 1 + 10 files changed, 56 insertions(+), 16 deletions(-) diff --git a/src/interactive.jl b/src/interactive.jl index f32c5189..ee44c701 100644 --- a/src/interactive.jl +++ b/src/interactive.jl @@ -92,6 +92,16 @@ function convert_input(P::Type, ::Type{Union{T, Nothing}}, s::AbstractString) wh return s == "nothing" ? nothing : convert_input(P, T, s) end +function convert_input(P::Type, ::Type{Union{T, Symbol, Nothing}}, s::AbstractString) where T + # Assume inputs starting with ':' char are intended as Symbols, if a plugin accept symbols. + # i.e. assume the set of valid Symbols the plugin expects can be spelt starting with ':'. + return if startswith(s, ":") + Symbol(chop(s, head=1, tail=0)) # remove ':' + else + convert_input(P, Union{T,Nothing}, s) + end +end + function convert_input(::Type, ::Type{Bool}, s::AbstractString) s = lowercase(s) return if startswith(s, 't') || startswith(s, 'y') diff --git a/src/plugins/documenter.jl b/src/plugins/documenter.jl index aad958ed..29b4adeb 100644 --- a/src/plugins/documenter.jl +++ b/src/plugins/documenter.jl @@ -28,7 +28,9 @@ end assets=String[], logo=Logo(), canonical_url=make_canonical(T), - makedocs_kwargs=Dict{Symbol, Any}(), + devbranch=nothing, + edit_link=:devbranch, + makedocs_kwargs=Dict{Symbol,Any}(), ) Sets up documentation generation via [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl). @@ -53,8 +55,13 @@ or `Nothing` to only support local documentation builds. The default value will compute GitHub Pages and GitLab Pages URLs for [`TravisCI`](@ref) and [`GitLabCI`](@ref), respectively. If set to `nothing`, no canonical URL is set. -- `makedocs_kwargs::Dict{Symbol}`: Extra keyword arguments to be inserted into `makedocs`. +- `edit_link::Union{AbstractString, Symbol, Nothing}`: Branch, tag or commit that the + "Edit on…" link will point to. Defaults to the branch identified by `devbranch`. + If `edit_link=:commit`, then the link will point to the latest commit when docs are built. + If `edit_link=nothing`, then the "Edit on…" link will be hidden altogether. - `devbranch::Union{AbstractString, Nothing}`: Branch that will trigger docs deployment. + If `nothing`, then the default branch according to the `Template` will be used. +- `makedocs_kwargs::Dict{Symbol,Any}`: Extra keyword arguments to be inserted into `makedocs`. !!! note If deploying documentation with Travis CI, don't forget to complete @@ -68,6 +75,7 @@ struct Documenter{T} <: Plugin make_jl::String index_md::String devbranch::Union{String, Nothing} + edit_link::Union{String, Symbol, Nothing} end # Can't use @plugin because we're implementing our own no-arguments constructor. @@ -78,7 +86,8 @@ function Documenter{T}(; canonical_url::Union{Function, Nothing}=make_canonical(T), make_jl::AbstractString=default_file("docs", "make.jl"), index_md::AbstractString=default_file("docs", "src", "index.md"), - devbranch::Union{String, Nothing}=nothing, + devbranch::Union{AbstractString, Nothing}=nothing, + edit_link::Union{AbstractString, Symbol, Nothing}=:devbranch, ) where {T} return Documenter{T}( assets, @@ -88,6 +97,7 @@ function Documenter{T}(; make_jl, index_md, devbranch, + edit_link, ) end @@ -99,6 +109,7 @@ defaultkw(::Type{<:Documenter}, ::Val{:logo}) = Logo() defaultkw(::Type{<:Documenter}, ::Val{:make_jl}) = default_file("docs", "make.jl") defaultkw(::Type{<:Documenter}, ::Val{:index_md}) = default_file("docs", "src", "index.md") defaultkw(::Type{<:Documenter}, ::Val{:devbranch}) = nothing +defaultkw(::Type{<:Documenter}, ::Val{:edit_link}) = :devbranch gitignore(::Documenter) = ["/docs/build/"] priority(::Documenter, ::Function) = DEFAULT_PRIORITY - 1 # We need SrcDir to go first. @@ -123,17 +134,25 @@ badges(::Documenter{GitLabCI}) = Badge( "https://{{{USER}}}.gitlab.io/{{{PKG}}}.jl/dev", ) -view(p::Documenter, t::Template, pkg::AbstractString) = Dict( - "ASSETS" => map(basename, p.assets), - "AUTHORS" => join(t.authors, ", "), - "CANONICAL" => p.canonical_url === nothing ? nothing : p.canonical_url(t, pkg), - "HAS_ASSETS" => !isempty(p.assets), - "MAKEDOCS_KWARGS" => map(((k, v),) -> k => repr(v), sort(collect(p.makedocs_kwargs), by=first)), - "PKG" => pkg, - "REPO" => "$(t.host)/$(t.user)/$pkg.jl", - "USER" => t.user, - "BRANCH" => p.devbranch === nothing ? default_branch(t) : p.devbranch, -) +function view(p::Documenter, t::Template, pkg::AbstractString) + devbranch = p.devbranch === nothing ? default_branch(t) : p.devbranch + return Dict( + "ASSETS" => map(basename, p.assets), + "AUTHORS" => join(t.authors, ", "), + "CANONICAL" => p.canonical_url === nothing ? nothing : p.canonical_url(t, pkg), + "HAS_ASSETS" => !isempty(p.assets), + "MAKEDOCS_KWARGS" => map(((k, v),) -> k => repr(v), sort(collect(p.makedocs_kwargs), by=first)), + "PKG" => pkg, + "REPO" => "$(t.host)/$(t.user)/$pkg.jl", + "USER" => t.user, + "BRANCH" => devbranch, + "EDIT_LINK" => p.edit_link == :devbranch ? _quoted(devbranch) : _quoted(p.edit_link), + ) +end + +# So both Symbol and Strings get interpolated correctly into `{{{s}}}`. +_quoted(s::AbstractString) = string('"', s, '"') +_quoted(s::Symbol) = repr(s) function view(p::Documenter{<:GitHubPagesStyle}, t::Template, pkg::AbstractString) base = invoke(view, Tuple{Documenter, Template, AbstractString}, p, t, pkg) diff --git a/templates/docs/make.jl b/templates/docs/make.jl index 6302f970..ac22ee18 100644 --- a/templates/docs/make.jl +++ b/templates/docs/make.jl @@ -13,6 +13,9 @@ makedocs(; {{#CANONICAL}} canonical="{{{CANONICAL}}}", {{/CANONICAL}} +{{#EDIT_LINK}} + edit_link={{{EDIT_LINK}}}, +{{/EDIT_LINK}} assets={{^HAS_ASSETS}}String{{/HAS_ASSETS}}[{{^HAS_ASSETS}}],{{/HAS_ASSETS}} {{#ASSETS}} "assets/{{{.}}}", diff --git a/test/fixtures/AllPlugins/docs/make.jl b/test/fixtures/AllPlugins/docs/make.jl index 04ae78d1..f064e783 100644 --- a/test/fixtures/AllPlugins/docs/make.jl +++ b/test/fixtures/AllPlugins/docs/make.jl @@ -10,6 +10,7 @@ makedocs(; sitename="AllPlugins.jl", format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", + edit_link="main", assets=String[], ), pages=[ diff --git a/test/fixtures/DocumenterGitHubActions/docs/make.jl b/test/fixtures/DocumenterGitHubActions/docs/make.jl index 1c1fc6c1..c48f4234 100644 --- a/test/fixtures/DocumenterGitHubActions/docs/make.jl +++ b/test/fixtures/DocumenterGitHubActions/docs/make.jl @@ -11,6 +11,7 @@ makedocs(; format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", canonical="https://tester.github.io/DocumenterGitHubActions.jl", + edit_link="main", assets=String[], ), pages=[ diff --git a/test/fixtures/DocumenterGitLabCI/docs/make.jl b/test/fixtures/DocumenterGitLabCI/docs/make.jl index 3344ea9c..1eee2ca8 100644 --- a/test/fixtures/DocumenterGitLabCI/docs/make.jl +++ b/test/fixtures/DocumenterGitLabCI/docs/make.jl @@ -11,6 +11,7 @@ makedocs(; format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", canonical="https://tester.gitlab.io/DocumenterGitLabCI.jl", + edit_link="main", assets=String[], ), pages=[ diff --git a/test/fixtures/DocumenterTravis/docs/make.jl b/test/fixtures/DocumenterTravis/docs/make.jl index 24089213..5891f6dd 100644 --- a/test/fixtures/DocumenterTravis/docs/make.jl +++ b/test/fixtures/DocumenterTravis/docs/make.jl @@ -11,6 +11,7 @@ makedocs(; format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", canonical="https://tester.github.io/DocumenterTravis.jl", + edit_link="main", assets=String[], ), pages=[ diff --git a/test/fixtures/WackyOptions/docs/make.jl b/test/fixtures/WackyOptions/docs/make.jl index fe151399..45cd0452 100644 --- a/test/fixtures/WackyOptions/docs/make.jl +++ b/test/fixtures/WackyOptions/docs/make.jl @@ -11,6 +11,7 @@ makedocs(; format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", canonical="http://example.com", + edit_link=:commit, assets=[ "assets/static.txt", ], diff --git a/test/interactive.jl b/test/interactive.jl index e7e30b42..8746f6af 100644 --- a/test/interactive.jl +++ b/test/interactive.jl @@ -169,10 +169,12 @@ end print( stdin.buffer, DOWN^2, CR, # Select GitLabCI - DOWN^2, CR, DONE, # Customize index_md + DOWN^2, CR, # Customize edit_link + DOWN, CR, DONE, # Customize index_md + ":commit", LF, # Enter edit_link "x.txt", LF, # Enter index file ) - @test PT.interactive(Documenter) == Documenter{GitLabCI}(; index_md="x.txt") + @test PT.interactive(Documenter) == Documenter{GitLabCI}(; edit_link=:commit, index_md="x.txt") print( stdin.buffer, diff --git a/test/reference.jl b/test/reference.jl index 69bcc8ed..baa42b36 100644 --- a/test/reference.jl +++ b/test/reference.jl @@ -125,6 +125,7 @@ end makedocs_kwargs=Dict(:foo => "bar", :bar => "baz"), canonical_url=(_t, _pkg) -> "http://example.com", devbranch="foobar", + edit_link=:commit, ), DroneCI(; amd64=false, arm=true, arm64=true, extra_versions=["1.3"]), Git(; ignore=["a", "b", "c"], manifest=true, branch="whackybranch"), From a548026ddbf2751dd9ebda0152babf3ca02da13e Mon Sep 17 00:00:00 2001 From: Nick Robinson Date: Sat, 28 May 2022 02:39:52 +0100 Subject: [PATCH 05/66] Bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 0b0e1eb1..73bbf16c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.27" +version = "0.7.28" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 47aa85f0247dc5d2a695f97efcc245c37e414325 Mon Sep 17 00:00:00 2001 From: Nick Robinson Date: Sun, 29 May 2022 13:10:11 +0100 Subject: [PATCH 06/66] Improve display of tips and defaults in interactive prompt (#351) * Only show expected type in prompt tips if it's not the default `String` * Show defaults as they would be entered interactively (don't quote strings) * Match appearance of prompt for default values --- src/interactive.jl | 18 +++++++++++++----- src/plugins/documenter.jl | 4 ++-- src/template.jl | 2 +- test/interactive.jl | 9 ++++++--- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/interactive.jl b/src/interactive.jl index ee44c701..a158052a 100644 --- a/src/interactive.jl +++ b/src/interactive.jl @@ -69,11 +69,14 @@ end Provide some extra tips to users on how to structure their input for the type `T`, for example if multiple delimited values are expected. """ -input_tips(::Type{Vector{T}}) where T = ["comma-delimited", input_tips(T)...] -input_tips(::Type{Nothing}) = String[] -input_tips(::Type{Union{T, Nothing}}) where T = ["'nothing' for nothing", input_tips(T)...] +input_tips(::Type{Vector{T}}) where T = [input_tips(T)..., "comma-delimited"] +input_tips(::Type{Union{T, Nothing}}) where T = [input_tips(T)..., input_tips(Nothing)...] +input_tips(::Type{Nothing}) = ["'nothing' for nothing"] input_tips(::Type{Secret}) = ["name only"] -input_tips(::Type) = String[] +# Show expected input type as a tip if it's anything other than `String` +input_tips(::Type{T}) where T = String[string(T)] +input_tips(::Type{String}) = String[] +input_tips(::Type{<:Signed}) = ["Int"] # Specific Int type likely not important """ convert_input(::Type{P}, ::Type{T}, s::AbstractString) -> T @@ -119,6 +122,11 @@ function convert_input(P::Type, T::Type{<:Vector}, s::AbstractString) return map(x -> convert_input(P, eltype(T), x), xs) end +# how would the user type `x` in interactive mode? +input_string(x) = string(x) +input_string(x::AbstractString) = isempty(x) ? repr(x) : String(x) +input_string(x::Symbol) = repr(x) + """ prompt(::Type{P}, ::Type{T}, ::Val{name::Symbol}) -> Any @@ -129,8 +137,8 @@ prompt(P::Type, T::Type, name::Symbol) = prompt(P, T, Val(name)) # The trailing `nothing` is a hack for `fallback_prompt` to use, ignore it. function prompt(P::Type, ::Type{T}, ::Val{name}, ::Nothing=nothing) where {T, name} - tips = join([T; input_tips(T); "default=$(repr(defaultkw(P, name)))"], ", ") default = defaultkw(P, name) + tips = join([input_tips(T); "default: $(input_string(default))"], ", ") input = Base.prompt(pretty_message("Enter value for '$name' ($tips)")) input === nothing && throw(InterruptException()) input = strip(input, '"') diff --git a/src/plugins/documenter.jl b/src/plugins/documenter.jl index 29b4adeb..07933b88 100644 --- a/src/plugins/documenter.jl +++ b/src/plugins/documenter.jl @@ -232,7 +232,7 @@ function interactive(::Type{Documenter}) end function prompt(::Type{<:Documenter}, ::Type{Logo}, ::Val{:logo}) - light = Base.prompt("Enter value for 'logo.light' (String, default=nothing)") - dark = Base.prompt("Enter value for 'logo.dark' (String, default=nothing)") + light = Base.prompt("Enter value for 'logo.light' (default: nothing)") + dark = Base.prompt("Enter value for 'logo.dark' (default: nothing)") return Logo(; light=light, dark=dark) end diff --git a/src/template.jl b/src/template.jl index cd5eebd5..f2ee0884 100644 --- a/src/template.jl +++ b/src/template.jl @@ -217,7 +217,7 @@ prompt(::Type{Template}, ::Type, ::Val{:pkg}) = Base.prompt("Package name") function prompt(::Type{Template}, ::Type, ::Val{:user}) return if isempty(@mock default_user()) - input = Base.prompt("Enter value for 'user' (String, required)") + input = Base.prompt("Enter value for 'user' (required)") input === nothing && throw(InterruptException()) return input else diff --git a/test/interactive.jl b/test/interactive.jl index 8746f6af..170fd664 100644 --- a/test/interactive.jl +++ b/test/interactive.jl @@ -47,13 +47,16 @@ end end @testset "input_tips" begin - @test isempty(PT.input_tips(Int)) + @test isempty(PT.input_tips(String)) + @test PT.input_tips(Int) == ["Int"] + @test PT.input_tips(Bool) == ["Bool"] + @test PT.input_tips(Symbol) == ["Symbol"] @test PT.input_tips(Vector{String}) == ["comma-delimited"] @test PT.input_tips(Union{Vector{String}, Nothing}) == - ["'nothing' for nothing", "comma-delimited"] + ["comma-delimited", "'nothing' for nothing"] @test PT.input_tips(Union{String, Nothing}) == ["'nothing' for nothing"] @test PT.input_tips(Union{Vector{Secret}, Nothing}) == - ["'nothing' for nothing", "comma-delimited", "name only"] + ["name only", "comma-delimited", "'nothing' for nothing"] end @testset "Interactive name/type pair collection" begin From 6adc79028c64c99ca7e3f1413237a1f8ac81fa89 Mon Sep 17 00:00:00 2001 From: Tom Gillam Date: Tue, 9 Aug 2022 23:25:08 +0100 Subject: [PATCH 07/66] github expects `tags` field to contain a list --- templates/github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/github/workflows/CI.yml b/templates/github/workflows/CI.yml index f8431daa..2f436894 100644 --- a/templates/github/workflows/CI.yml +++ b/templates/github/workflows/CI.yml @@ -5,7 +5,7 @@ on: <<#BRANCH>> - <> <> - tags: '*' + tags: ['*'] pull_request: concurrency: # Skip intermediate builds: always. From f6e10a926406c0b70727fbfca496fa92629640d3 Mon Sep 17 00:00:00 2001 From: Tom Gillam Date: Tue, 9 Aug 2022 23:26:24 +0100 Subject: [PATCH 08/66] Bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 73bbf16c..ca892896 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.28" +version = "0.7.29" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 894a43fa5b45622c1e29b781d7370c1b882bd6df Mon Sep 17 00:00:00 2001 From: Tom Gillam Date: Wed, 10 Aug 2022 01:09:24 +0100 Subject: [PATCH 09/66] Update test expectations --- test/fixtures/AllPlugins/.github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/AllPlugins/.github/workflows/CI.yml b/test/fixtures/AllPlugins/.github/workflows/CI.yml index 45988a26..60b21bea 100644 --- a/test/fixtures/AllPlugins/.github/workflows/CI.yml +++ b/test/fixtures/AllPlugins/.github/workflows/CI.yml @@ -3,7 +3,7 @@ on: push: branches: - main - tags: '*' + tags: ['*'] pull_request: concurrency: # Skip intermediate builds: always. From a8af9e53c9a4fc2d1b9f0b2d4c5eb6ec57e6a03d Mon Sep 17 00:00:00 2001 From: Tom Gillam Date: Wed, 10 Aug 2022 10:10:20 +0100 Subject: [PATCH 10/66] More test expectations update --- test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml index b13e4662..487df6c9 100644 --- a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml +++ b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml @@ -3,7 +3,7 @@ on: push: branches: - main - tags: '*' + tags: ['*'] pull_request: concurrency: # Skip intermediate builds: always. From 7b688a448e9ad0bdc7a27e78c9704f31f36127e7 Mon Sep 17 00:00:00 2001 From: Tom Gillam Date: Wed, 10 Aug 2022 10:11:13 +0100 Subject: [PATCH 11/66] Update test expectations --- test/fixtures/WackyOptions/.github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/WackyOptions/.github/workflows/CI.yml b/test/fixtures/WackyOptions/.github/workflows/CI.yml index faf35952..1d69c7be 100644 --- a/test/fixtures/WackyOptions/.github/workflows/CI.yml +++ b/test/fixtures/WackyOptions/.github/workflows/CI.yml @@ -3,7 +3,7 @@ on: push: branches: - whackybranch - tags: '*' + tags: ['*'] pull_request: concurrency: # Skip intermediate builds: always. From b2e31d7ec8f174007a3997f00344cdada0c6935d Mon Sep 17 00:00:00 2001 From: Eric Davies Date: Wed, 19 Oct 2022 10:01:46 -0500 Subject: [PATCH 12/66] Migrate links to JuliaCI/PkgTemplates.jl --- README.md | 12 ++++++------ docs/make.jl | 6 +++--- docs/src/developer.md | 2 +- docs/src/index.md | 2 +- docs/src/migrating.md | 4 ++-- docs/src/user.md | 2 +- src/plugins/license.jl | 2 +- test/plugin.jl | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 60c75b09..e566bd8a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # PkgTemplates -[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://invenia.github.io/PkgTemplates.jl/stable) -[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://invenia.github.io/PkgTemplates.jl/dev) -[![CI](https://github.com/invenia/PkgTemplates.jl/workflows/CI/badge.svg)](https://github.com/invenia/PkgTemplates.jl/actions?query=workflow%3ACI) -[![Codecov](https://codecov.io/gh/invenia/PkgTemplates.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/invenia/PkgTemplates.jl) +[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliaci.github.io/PkgTemplates.jl/stable) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliaci.github.io/PkgTemplates.jl/dev) +[![CI](https://github.com/JuliaCI/PkgTemplates.jl/workflows/CI/badge.svg)](https://github.com/JuliaCI/PkgTemplates.jl/actions?query=workflow%3ACI) +[![Codecov](https://codecov.io/gh/JuliaCI/PkgTemplates.jl/branch/master/graph/badge.svg?token=WsGRSymBmZ)](https://codecov.io/gh/JuliaCI/PkgTemplates.jl) [![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) [![ColPrac: Contributor Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor%20Guide-blueviolet)](https://github.com/SciML/ColPrac) @@ -69,10 +69,10 @@ tpl = Template(; --- -For a much more detailed overview, please see [the User Guide documentation](https://invenia.github.io/PkgTemplates.jl/stable/user/). +For a much more detailed overview, please see [the User Guide documentation](https://juliaci.github.io/PkgTemplates.jl/stable/user/). ## Contributing Issues and pull requests are welcome! New contributors should make sure to read the [ColPrac Contributor Guide](https://github.com/SciML/ColPrac). -For some more PkgTemplates-specific tips, see the [Developer Guide documentation](https://invenia.github.io/PkgTemplates.jl/stable/developer/). +For some more PkgTemplates-specific tips, see the [Developer Guide documentation](https://juliaci.github.io/PkgTemplates.jl/stable/developer/). diff --git a/docs/make.jl b/docs/make.jl index 5597ba0d..859ef206 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -4,11 +4,11 @@ using PkgTemplates: PkgTemplates makedocs(; modules=[PkgTemplates], authors="Chris de Graaf, Invenia Technical Computing Corporation", - repo="https://github.com/invenia/PkgTemplates.jl/blob/{commit}{path}#{line}", + repo="https://github.com/JuliaCI/PkgTemplates.jl/blob/{commit}{path}#{line}", sitename="PkgTemplates.jl", format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", - canonical="https://invenia.github.io/PkgTemplates.jl", + canonical="https://juliaci.github.io/PkgTemplates.jl", assets=String[], ), pages=[ @@ -20,5 +20,5 @@ makedocs(; ) deploydocs(; - repo="github.com/invenia/PkgTemplates.jl", + repo="github.com/JuliaCI/PkgTemplates.jl", ) diff --git a/docs/src/developer.md b/docs/src/developer.md index dd075522..1921d7d6 100644 --- a/docs/src/developer.md +++ b/docs/src/developer.md @@ -11,7 +11,7 @@ Pages = ["developer.md"] Issues and pull requests are welcome! New contributors should make sure to read the [ColPrac Contributor Guide](https://github.com/SciML/ColPrac). -[PkgTemplates](https://github.com/invenia/PkgTemplates.jl/) can be easily extended by adding new [`Plugin`](@ref)s. +[PkgTemplates](https://github.com/JuliaCI/PkgTemplates.jl/) can be easily extended by adding new [`Plugin`](@ref)s. There are three types of plugins: [`Plugin`](@ref), [`FilePlugin`](@ref), and [`BadgePlugin`](@ref). diff --git a/docs/src/index.md b/docs/src/index.md index 0e6e6c24..d3d7ace2 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -4,7 +4,7 @@ CurrentModule = PkgTemplates # PkgTemplates -**[PkgTemplates](https://github.com/invenia/PkgTemplates.jl/) creates new Julia packages in an easy, repeatable, and customizable way.** +**[PkgTemplates](https://github.com/JuliaCI/PkgTemplates.jl/) creates new Julia packages in an easy, repeatable, and customizable way.** ## Documentation diff --git a/docs/src/migrating.md b/docs/src/migrating.md index 7769ea60..28bf8729 100644 --- a/docs/src/migrating.md +++ b/docs/src/migrating.md @@ -55,8 +55,8 @@ Although it's unlikely that anyone used these. | Old | New | | :------------------: | :--------------------------------------------------------------------------------------------------: | -| `available_licenses` | [View licenses on GitHub](https://github.com/invenia/PkgTemplates.jl/tree/master/templates/licenses) | -| `show_license` | [View licenses on GitHub](https://github.com/invenia/PkgTemplates.jl/tree/master/templates/licenses) | +| `available_licenses` | [View licenses on GitHub](https://github.com/JuliaCI/PkgTemplates.jl/tree/master/templates/licenses) | +| `show_license` | [View licenses on GitHub](https://github.com/JuliaCI/PkgTemplates.jl/tree/master/templates/licenses) | ## Custom Plugins diff --git a/docs/src/user.md b/docs/src/user.md index 2ecc213b..8da19e1e 100644 --- a/docs/src/user.md +++ b/docs/src/user.md @@ -8,7 +8,7 @@ CurrentModule = PkgTemplates Pages = ["user.md"] ``` -Using [PkgTemplates](https://github.com/invenia/PkgTemplates.jl/) is straightforward. +Using [PkgTemplates](https://github.com/JuliaCI/PkgTemplates.jl/) is straightforward. Just create a [`Template`](@ref), and call it on a package name to generate that package: ```julia diff --git a/src/plugins/license.jl b/src/plugins/license.jl index 656fb16b..fd83e166 100644 --- a/src/plugins/license.jl +++ b/src/plugins/license.jl @@ -6,7 +6,7 @@ Creates a license file. ## Keyword Arguments - `name::AbstractString`: Name of a license supported by PkgTemplates. Available licenses can be seen - [here](https://github.com/invenia/PkgTemplates.jl/tree/master/templates/licenses). + [here](https://github.com/JuliaCI/PkgTemplates.jl/tree/master/templates/licenses). - `path::Union{AbstractString, Nothing}`: Path to a custom license file. This keyword takes priority over `name`. - `destination::AbstractString`: File destination, relative to the repository root. diff --git a/test/plugin.jl b/test/plugin.jl index 68dee38c..682518ce 100644 --- a/test/plugin.jl +++ b/test/plugin.jl @@ -88,7 +88,7 @@ PT.user_view(::FileTest, ::Template, ::AbstractString) = Dict("X" => 1, "Z" => 3 end end - # https://github.com/invenia/PkgTemplates.jl/issues/275 + # https://github.com/JuliaCI/PkgTemplates.jl/issues/275 @testset "makedocs_kwargs sort bug" begin p = Documenter(; makedocs_kwargs=Dict(:strict => true, :checkdocs => :exports)) t = tpl(; plugins=[p]) From 305aa36ec97e20d96a32c9992f057052bc9d4901 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Wed, 18 Jan 2023 16:33:39 +0100 Subject: [PATCH 13/66] Add `statuses: write` permission to GH token for docdeploy (#379) * Add `statuses: write` permission to GH token for docdeploy This is needed to post the GitHub status with preview links, see [Documenter.jl documentation](https://documenter.juliadocs.org/dev/man/hosting/#GitHub-Actions). * Fix tets --- templates/github/workflows/CI.yml | 1 + test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml | 1 + test/fixtures/WackyOptions/.github/workflows/CI.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/templates/github/workflows/CI.yml b/templates/github/workflows/CI.yml index 2f436894..22e92853 100644 --- a/templates/github/workflows/CI.yml +++ b/templates/github/workflows/CI.yml @@ -67,6 +67,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + statuses: write steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 diff --git a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml index 487df6c9..dca10651 100644 --- a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml +++ b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml @@ -39,6 +39,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + statuses: write steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 diff --git a/test/fixtures/WackyOptions/.github/workflows/CI.yml b/test/fixtures/WackyOptions/.github/workflows/CI.yml index 1d69c7be..838c5102 100644 --- a/test/fixtures/WackyOptions/.github/workflows/CI.yml +++ b/test/fixtures/WackyOptions/.github/workflows/CI.yml @@ -39,6 +39,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + statuses: write steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 From 3268a06b4f3e8b3e3c82f303c58136617b6cd9a5 Mon Sep 17 00:00:00 2001 From: Nick Robinson Date: Wed, 18 Jan 2023 15:34:46 +0000 Subject: [PATCH 14/66] Bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index ca892896..fd8157ac 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.29" +version = "0.7.30" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 26bca4c9b17d48a37c0066cc29c7f23fc4b399df Mon Sep 17 00:00:00 2001 From: Frames Catherine White Date: Wed, 8 Feb 2023 23:41:35 +0000 Subject: [PATCH 15/66] Only interactive tests pre-Julia 1.8 (#385) Co-authored-by: Frames White --- test/runtests.jl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 372b964e..cfa6b0ed 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -94,7 +94,14 @@ mktempdir() do dir include("template.jl") include("plugin.jl") include("show.jl") - include("interactive.jl") + + if VERSION < v"1.8" + # Interactive tests disabled on Julia Version >= 1.8 due to: + # https://github.com/JuliaCI/PkgTemplates.jl/issues/370 + include("interactive.jl") + else + @info "Skipping interactive tests (requiring Date: Wed, 8 Feb 2023 18:42:46 -0500 Subject: [PATCH 16/66] Fix a typo in docs of `render_file` (#377) --- src/plugin.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugin.jl b/src/plugin.jl index c6c6eed4..3439147a 100644 --- a/src/plugin.jl +++ b/src/plugin.jl @@ -316,7 +316,7 @@ function gen_file(file::AbstractString, text::AbstractString) end """ - render_file(file::AbstractString view::Dict{<:AbstractString}, tags=nothing) -> String + render_file(file::AbstractString, view::Dict{<:AbstractString}, tags=nothing) -> String Render a template file with the data in `view`. `tags` should be a tuple of two strings, which are the opening and closing delimiters, From 9224e4402f208b588723448b6e54fbbc59bd71a3 Mon Sep 17 00:00:00 2001 From: Frames White Date: Wed, 8 Feb 2023 19:27:58 +0000 Subject: [PATCH 17/66] Add CodeOwners Plugin --- src/PkgTemplates.jl | 1 + src/plugin.jl | 1 + src/plugins/codeowners.jl | 39 +++++++++++++++++++++++++++ test/fixtures/AllPlugins/CODEOWNERS | 1 + test/fixtures/WackyOptions/CODEOWNERS | 2 ++ test/reference.jl | 3 ++- 6 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/plugins/codeowners.jl create mode 100644 test/fixtures/AllPlugins/CODEOWNERS create mode 100644 test/fixtures/WackyOptions/CODEOWNERS diff --git a/src/PkgTemplates.jl b/src/PkgTemplates.jl index 83dea55f..8a839e5e 100644 --- a/src/PkgTemplates.jl +++ b/src/PkgTemplates.jl @@ -22,6 +22,7 @@ export CirrusCI, Citation, Codecov, + CodeOwners, ColPracBadge, CompatHelper, Coveralls, diff --git a/src/plugin.jl b/src/plugin.jl index 3439147a..9e4e81ef 100644 --- a/src/plugin.jl +++ b/src/plugin.jl @@ -355,6 +355,7 @@ include(joinpath("plugins", "git.jl")) include(joinpath("plugins", "tagbot.jl")) include(joinpath("plugins", "develop.jl")) include(joinpath("plugins", "coverage.jl")) +include(joinpath("plugins", "codeowners.jl")) include(joinpath("plugins", "ci.jl")) include(joinpath("plugins", "compat_helper.jl")) include(joinpath("plugins", "citation.jl")) diff --git a/src/plugins/codeowners.jl b/src/plugins/codeowners.jl new file mode 100644 index 00000000..fef44de6 --- /dev/null +++ b/src/plugins/codeowners.jl @@ -0,0 +1,39 @@ +""" + CodeOwners <: Plugin + CodeOwners(; fallback_owner) + +A plugin which created GitLab/GitHub compatible CODEOWNERS files. +owners should be a vector of patterns mapped to a vector of owner names. +For example: +`owners=["*"=>["@invenia"], "README.md"=>["@documentation","@oxinabox]]` +assigns general ownership over all files to the invenia group, +but assigns ownership of the readme to the documentation group and to the user oxinabox. + +By default, it creates an empty CODEOWNERS file. +""" +@plugin struct CodeOwners <: Plugin + owners::Vector{Pair{String,Vector{String}}} = Vector{Pair{String,Vector{String}}}() +end + +PkgTemplates.destination(::CodeOwners) = "CODEOWNERS" + +function render_plugin(p::CodeOwners) + join((pattern * " " * join(subowners, " ") for (pattern, subowners) in p.owners), "\n") +end + +function PkgTemplates.hook(p::CodeOwners, t::Template, pkg_dir::AbstractString) + pkg = basename(pkg_dir) + path = joinpath(pkg_dir, destination(p)) + text = render_plugin(p) + PkgTemplates.gen_file(path, text) +end + +function PkgTemplates.validate(p::CodeOwners, ::Template) + for (pattern, subowners) in p.owners + contains(pattern, r"\s") && throw(ArgumentError(("Pattern ($pattern) must not contain whitespace"))) + for subowner in subowners + contains(subowner, r"\s") && throw(ArgumentError("Owner name ($subowner) must not contain whitespace")) + startswith(subowner, "@") || throw(ArgumentError("Owner name ($subowner) must start with @")) + end + end +end \ No newline at end of file diff --git a/test/fixtures/AllPlugins/CODEOWNERS b/test/fixtures/AllPlugins/CODEOWNERS new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/fixtures/AllPlugins/CODEOWNERS @@ -0,0 +1 @@ + diff --git a/test/fixtures/WackyOptions/CODEOWNERS b/test/fixtures/WackyOptions/CODEOWNERS new file mode 100644 index 00000000..b0f50926 --- /dev/null +++ b/test/fixtures/WackyOptions/CODEOWNERS @@ -0,0 +1,2 @@ +* @invenia +README.md @documentation @oxinabox diff --git a/test/reference.jl b/test/reference.jl index baa42b36..7cfc94f8 100644 --- a/test/reference.jl +++ b/test/reference.jl @@ -88,7 +88,7 @@ end @testset "All plugins" begin test_all("AllPlugins"; authors=USER, plugins=[ - AppVeyor(), CirrusCI(), Citation(), Codecov(), CompatHelper(), Coveralls(), + AppVeyor(), CirrusCI(), Citation(), Codecov(), CompatHelper(), Coveralls(), CodeOwners(), Develop(), Documenter(), DroneCI(), GitHubActions(), GitLabCI(), TravisCI(), RegisterAction(), ]) end @@ -117,6 +117,7 @@ end CirrusCI(; image="freebsd-123", coverage=false, extra_versions=["1.3"]), Citation(; readme=true), Codecov(; file=STATIC_TXT), + CodeOwners(; owners=["*"=>["@invenia"], "README.md"=>["@documentation","@oxinabox"]]), CompatHelper(; cron="0 0 */3 * *"), Coveralls(; file=STATIC_TXT), Documenter{GitHubActions}(; From ce77d7a760d815a157def7c915d0847458036af1 Mon Sep 17 00:00:00 2001 From: Frames White Date: Wed, 8 Feb 2023 19:42:45 +0000 Subject: [PATCH 18/66] Allow emails --- src/plugins/codeowners.jl | 2 +- test/fixtures/WackyOptions/CODEOWNERS | 4 ++-- test/reference.jl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/codeowners.jl b/src/plugins/codeowners.jl index fef44de6..5a635472 100644 --- a/src/plugins/codeowners.jl +++ b/src/plugins/codeowners.jl @@ -33,7 +33,7 @@ function PkgTemplates.validate(p::CodeOwners, ::Template) contains(pattern, r"\s") && throw(ArgumentError(("Pattern ($pattern) must not contain whitespace"))) for subowner in subowners contains(subowner, r"\s") && throw(ArgumentError("Owner name ($subowner) must not contain whitespace")) - startswith(subowner, "@") || throw(ArgumentError("Owner name ($subowner) must start with @")) + '@' ∈ subowner || throw(ArgumentError("Owner name ($subowner) must be `@user` or `email@domain.com`")) end end end \ No newline at end of file diff --git a/test/fixtures/WackyOptions/CODEOWNERS b/test/fixtures/WackyOptions/CODEOWNERS index b0f50926..cd3588c0 100644 --- a/test/fixtures/WackyOptions/CODEOWNERS +++ b/test/fixtures/WackyOptions/CODEOWNERS @@ -1,2 +1,2 @@ -* @invenia -README.md @documentation @oxinabox +* @user +README.md @group user@example.com diff --git a/test/reference.jl b/test/reference.jl index 7cfc94f8..3bd503b8 100644 --- a/test/reference.jl +++ b/test/reference.jl @@ -117,7 +117,7 @@ end CirrusCI(; image="freebsd-123", coverage=false, extra_versions=["1.3"]), Citation(; readme=true), Codecov(; file=STATIC_TXT), - CodeOwners(; owners=["*"=>["@invenia"], "README.md"=>["@documentation","@oxinabox"]]), + CodeOwners(; owners=["*"=>["@user"], "README.md"=>["@group","user@example.com"]]), CompatHelper(; cron="0 0 */3 * *"), Coveralls(; file=STATIC_TXT), Documenter{GitHubActions}(; From 4dd96640867372611475ce1bc7afa25182be1fa5 Mon Sep 17 00:00:00 2001 From: Frames Catherine White Date: Thu, 9 Feb 2023 11:59:30 +0000 Subject: [PATCH 19/66] fix kwarg name --- src/plugins/codeowners.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/codeowners.jl b/src/plugins/codeowners.jl index 5a635472..3077f777 100644 --- a/src/plugins/codeowners.jl +++ b/src/plugins/codeowners.jl @@ -1,6 +1,6 @@ """ CodeOwners <: Plugin - CodeOwners(; fallback_owner) + CodeOwners(; owners) A plugin which created GitLab/GitHub compatible CODEOWNERS files. owners should be a vector of patterns mapped to a vector of owner names. From 63a9b5c5f34b7353ec487262f3716883fbfd4706 Mon Sep 17 00:00:00 2001 From: Frames White Date: Thu, 9 Feb 2023 17:41:40 +0000 Subject: [PATCH 20/66] bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index fd8157ac..568cd26b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.30" +version = "0.7.31" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 7d3a79fff11d67d789125b7349c0e502827b6be4 Mon Sep 17 00:00:00 2001 From: Frames White Date: Wed, 22 Feb 2023 21:13:59 +0800 Subject: [PATCH 21/66] Start from v1.0.0-DEV --- src/plugins/project_file.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/project_file.jl b/src/plugins/project_file.jl index 06be5a92..8e699cdd 100644 --- a/src/plugins/project_file.jl +++ b/src/plugins/project_file.jl @@ -1,5 +1,5 @@ """ - ProjectFile(; version=v"0.1.0") + ProjectFile(; version=v"1.0.0-DEV") Creates a `Project.toml`. @@ -7,7 +7,7 @@ Creates a `Project.toml`. - `version::VersionNumber`: The initial version of created packages. """ @plugin struct ProjectFile <: Plugin - version::VersionNumber = v"0.1.0" + version::VersionNumber = v"1.0.0-DEV" end # Other plugins like Tests will modify this file. From 272abaebf4b59a9a21e745ce79b5008349124fb9 Mon Sep 17 00:00:00 2001 From: Frames White Date: Thu, 23 Feb 2023 17:40:43 +0800 Subject: [PATCH 22/66] =update test references --- test/fixtures/AllPlugins/Project.toml | 2 +- test/fixtures/Basic/Project.toml | 2 +- test/fixtures/DocumenterGitHubActions/Project.toml | 2 +- test/fixtures/DocumenterGitLabCI/Project.toml | 2 +- test/fixtures/DocumenterTravis/Project.toml | 2 +- test/show.jl | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/fixtures/AllPlugins/Project.toml b/test/fixtures/AllPlugins/Project.toml index e49ecb13..b1fef764 100644 --- a/test/fixtures/AllPlugins/Project.toml +++ b/test/fixtures/AllPlugins/Project.toml @@ -1,7 +1,7 @@ name = "AllPlugins" uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28" authors = ["tester"] -version = "0.1.0" +version = "1.0.0-DEV" [compat] julia = "1" diff --git a/test/fixtures/Basic/Project.toml b/test/fixtures/Basic/Project.toml index 7d95c467..28973093 100644 --- a/test/fixtures/Basic/Project.toml +++ b/test/fixtures/Basic/Project.toml @@ -1,7 +1,7 @@ name = "Basic" uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28" authors = ["tester"] -version = "0.1.0" +version = "1.0.0-DEV" [compat] julia = "1" diff --git a/test/fixtures/DocumenterGitHubActions/Project.toml b/test/fixtures/DocumenterGitHubActions/Project.toml index 4963748a..f2102f5f 100644 --- a/test/fixtures/DocumenterGitHubActions/Project.toml +++ b/test/fixtures/DocumenterGitHubActions/Project.toml @@ -1,7 +1,7 @@ name = "DocumenterGitHubActions" uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28" authors = ["tester"] -version = "0.1.0" +version = "1.0.0-DEV" [compat] julia = "1" diff --git a/test/fixtures/DocumenterGitLabCI/Project.toml b/test/fixtures/DocumenterGitLabCI/Project.toml index c657f202..108a502a 100644 --- a/test/fixtures/DocumenterGitLabCI/Project.toml +++ b/test/fixtures/DocumenterGitLabCI/Project.toml @@ -1,7 +1,7 @@ name = "DocumenterGitLabCI" uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28" authors = ["tester"] -version = "0.1.0" +version = "1.0.0-DEV" [compat] julia = "1" diff --git a/test/fixtures/DocumenterTravis/Project.toml b/test/fixtures/DocumenterTravis/Project.toml index 9b1210d1..ed96f336 100644 --- a/test/fixtures/DocumenterTravis/Project.toml +++ b/test/fixtures/DocumenterTravis/Project.toml @@ -1,7 +1,7 @@ name = "DocumenterTravis" uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28" authors = ["tester"] -version = "0.1.0" +version = "1.0.0-DEV" [compat] julia = "1" diff --git a/test/show.jl b/test/show.jl index 7fcb60b6..bf028169 100644 --- a/test/show.jl +++ b/test/show.jl @@ -51,7 +51,7 @@ end path: "$(joinpath(LICENSES_DIR, "MIT"))" destination: "LICENSE" ProjectFile: - version: v"0.1.0" + version: v"1.0.0-DEV" Readme: file: "$(joinpath(TEMPLATES_DIR, "README.md"))" destination: "README.md" From d13ac3917c8908f46dbf9db74563603e8a3422e6 Mon Sep 17 00:00:00 2001 From: Frames White Date: Thu, 23 Feb 2023 17:51:28 +0800 Subject: [PATCH 23/66] =update manifests --- test/fixtures/AllPlugins/CITATION.bib | 2 +- test/fixtures/AllPlugins/docs/Manifest.toml | 2 +- test/fixtures/DocumenterGitHubActions/docs/Manifest.toml | 2 +- test/fixtures/DocumenterGitLabCI/docs/Manifest.toml | 2 +- test/fixtures/DocumenterTravis/docs/Manifest.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/fixtures/AllPlugins/CITATION.bib b/test/fixtures/AllPlugins/CITATION.bib index b39b28c2..f051f721 100644 --- a/test/fixtures/AllPlugins/CITATION.bib +++ b/test/fixtures/AllPlugins/CITATION.bib @@ -2,7 +2,7 @@ @misc{AllPlugins.jl author = {tester}, title = {AllPlugins.jl}, url = {https://github.com/tester/AllPlugins.jl}, - version = {v0.1.0}, + version = {v1.0.0-DEV}, year = {2019}, month = {8} } diff --git a/test/fixtures/AllPlugins/docs/Manifest.toml b/test/fixtures/AllPlugins/docs/Manifest.toml index 464214e1..40d6234b 100644 --- a/test/fixtures/AllPlugins/docs/Manifest.toml +++ b/test/fixtures/AllPlugins/docs/Manifest.toml @@ -6,7 +6,7 @@ manifest_format = "2.0" [[deps.AllPlugins]] path = ".." uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28" -version = "0.1.0" +version = "1.0.0-DEV" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" diff --git a/test/fixtures/DocumenterGitHubActions/docs/Manifest.toml b/test/fixtures/DocumenterGitHubActions/docs/Manifest.toml index b16c489e..cc06abd8 100644 --- a/test/fixtures/DocumenterGitHubActions/docs/Manifest.toml +++ b/test/fixtures/DocumenterGitHubActions/docs/Manifest.toml @@ -31,7 +31,7 @@ version = "0.24.2" [[deps.DocumenterGitHubActions]] path = ".." uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28" -version = "0.1.0" +version = "1.0.0-DEV" [[deps.Downloads]] deps = ["ArgTools", "LibCURL", "NetworkOptions"] diff --git a/test/fixtures/DocumenterGitLabCI/docs/Manifest.toml b/test/fixtures/DocumenterGitLabCI/docs/Manifest.toml index 4c9b6d9a..4f4f5145 100644 --- a/test/fixtures/DocumenterGitLabCI/docs/Manifest.toml +++ b/test/fixtures/DocumenterGitLabCI/docs/Manifest.toml @@ -31,7 +31,7 @@ version = "0.24.2" [[deps.DocumenterGitLabCI]] path = ".." uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28" -version = "0.1.0" +version = "1.0.0-DEV" [[deps.Downloads]] deps = ["ArgTools", "LibCURL", "NetworkOptions"] diff --git a/test/fixtures/DocumenterTravis/docs/Manifest.toml b/test/fixtures/DocumenterTravis/docs/Manifest.toml index 70147d15..a0b1e090 100644 --- a/test/fixtures/DocumenterTravis/docs/Manifest.toml +++ b/test/fixtures/DocumenterTravis/docs/Manifest.toml @@ -31,7 +31,7 @@ version = "0.24.2" [[deps.DocumenterTravis]] path = ".." uuid = "c51a4d33-e9a4-4efb-a257-e0de888ecc28" -version = "0.1.0" +version = "1.0.0-DEV" [[deps.Downloads]] deps = ["ArgTools", "LibCURL", "NetworkOptions"] From 07c8a305ab5ed27cc37ac874f3e76809e87c94a8 Mon Sep 17 00:00:00 2001 From: Frames White Date: Thu, 23 Feb 2023 18:45:05 +0800 Subject: [PATCH 24/66] =undo change to Citation file --- test/fixtures/AllPlugins/CITATION.bib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/AllPlugins/CITATION.bib b/test/fixtures/AllPlugins/CITATION.bib index f051f721..b39b28c2 100644 --- a/test/fixtures/AllPlugins/CITATION.bib +++ b/test/fixtures/AllPlugins/CITATION.bib @@ -2,7 +2,7 @@ @misc{AllPlugins.jl author = {tester}, title = {AllPlugins.jl}, url = {https://github.com/tester/AllPlugins.jl}, - version = {v1.0.0-DEV}, + version = {v0.1.0}, year = {2019}, month = {8} } From b2514c3c71eb106432ab3752c68ac77beafa76c1 Mon Sep 17 00:00:00 2001 From: Frames White Date: Thu, 23 Feb 2023 18:49:27 +0800 Subject: [PATCH 25/66] =change the Citation default also --- templates/CITATION.bib | 2 +- test/fixtures/AllPlugins/CITATION.bib | 2 +- test/fixtures/WackyOptions/CITATION.bib | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/CITATION.bib b/templates/CITATION.bib index 6579e314..cf0026f8 100644 --- a/templates/CITATION.bib +++ b/templates/CITATION.bib @@ -2,7 +2,7 @@ @misc{<<&PKG>>.jl author = {<<&AUTHORS>>}, title = {<<&PKG>>.jl}, url = {<<&URL>>}, - version = {v0.1.0}, + version = {v1.0.0-DEV}, year = {<<&YEAR>>}, month = {<<&MONTH>>} } diff --git a/test/fixtures/AllPlugins/CITATION.bib b/test/fixtures/AllPlugins/CITATION.bib index b39b28c2..f051f721 100644 --- a/test/fixtures/AllPlugins/CITATION.bib +++ b/test/fixtures/AllPlugins/CITATION.bib @@ -2,7 +2,7 @@ @misc{AllPlugins.jl author = {tester}, title = {AllPlugins.jl}, url = {https://github.com/tester/AllPlugins.jl}, - version = {v0.1.0}, + version = {v1.0.0-DEV}, year = {2019}, month = {8} } diff --git a/test/fixtures/WackyOptions/CITATION.bib b/test/fixtures/WackyOptions/CITATION.bib index 4a8709b7..f610268c 100644 --- a/test/fixtures/WackyOptions/CITATION.bib +++ b/test/fixtures/WackyOptions/CITATION.bib @@ -2,7 +2,7 @@ @misc{WackyOptions.jl author = {tester}, title = {WackyOptions.jl}, url = {https://x.com/tester/WackyOptions.jl}, - version = {v0.1.0}, + version = {v1.0.0-DEV}, year = {2019}, month = {8} } From 7256757971ef98abc3c21883e6874ceb1adb2e6d Mon Sep 17 00:00:00 2001 From: Frames White Date: Tue, 7 Mar 2023 23:19:53 +0800 Subject: [PATCH 26/66] Bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 568cd26b..0a95f0ac 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.31" +version = "0.7.32" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 73a143c7f46583722a552f43d1a8f542944d623b Mon Sep 17 00:00:00 2001 From: contradict Date: Fri, 19 Aug 2022 16:32:47 -0700 Subject: [PATCH 27/66] Typo (push->push!) and type fix ("None"->:none) --- src/template.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/template.jl b/src/template.jl index f2ee0884..5e3609cc 100644 --- a/src/template.jl +++ b/src/template.jl @@ -184,7 +184,7 @@ function interactive(::Type{Template}; kwargs...) # Make sure we don't try to show a menu with < 2 options. isempty(customizable) && return Template(; kwargs...) just_one = length(customizable) == 1 - just_one && push(customizable, "None") + just_one && push!(customizable, :none) try println("Template keywords to customize:") From 2748691b36a056eef7d6faae70fc338d73c824ce Mon Sep 17 00:00:00 2001 From: Frames White Date: Wed, 19 Apr 2023 15:12:55 +0800 Subject: [PATCH 28/66] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 0a95f0ac..0e8c6002 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.32" +version = "0.7.33" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 8da00f43da796de4674adaf7255fd4bb2d4a435e Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Wed, 19 Apr 2023 14:16:32 +0200 Subject: [PATCH 29/66] Create dependabot.yml --- .github/dependabot.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..700707ce --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" From 673fd39a4dce4f28d52b414a8769b64e1d4adec9 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Wed, 19 Apr 2023 14:47:53 +0200 Subject: [PATCH 30/66] add dependabot as default plugin --- docs/src/user.md | 7 ++++--- src/PkgTemplates.jl | 1 + src/plugin.jl | 1 + src/plugins/dependabot.jl | 16 ++++++++++++++++ src/template.jl | 1 + templates/github/dependabot.yml | 7 +++++++ test/reference.jl | 4 +++- 7 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 src/plugins/dependabot.jl create mode 100644 templates/github/dependabot.yml diff --git a/docs/src/user.md b/docs/src/user.md index 8da19e1e..aa0f58be 100644 --- a/docs/src/user.md +++ b/docs/src/user.md @@ -44,6 +44,7 @@ Git CompatHelper TagBot Secret +Dependabot ``` ### Continuous Integration (CI) @@ -97,7 +98,7 @@ Here are a few example templates that use the options and plugins explained abov This one includes plugins suitable for a project hosted on GitHub, and some other customizations: ```julia -Template(; +Template(; user="my-username", dir="~/code", authors="Acme Corp", @@ -130,7 +131,7 @@ Template(; !!! note "Templates vs Templating" This documentation refers plenty to [`Template`](@ref)s, the package's main type, but it also refers to "template files" and "text templating", which are plaintext files with placeholders to be filled with data, and the technique of filling those placeholders with data, respectively. - + These concepts should be familiar if you've used [Jinja](https://palletsprojects.com/p/jinja) or [Mustache](https://mustache.github.io) (Mustache is the particular flavour used by PkgTemplates, via [Mustache.jl](https://github.com/jverzani/Mustache.jl)). Please keep the difference between these two things in mind! @@ -144,7 +145,7 @@ Here's an example template file: Hello, {{{name}}}. {{#weather}} -It's {{{weather}}} outside. +It's {{{weather}}} outside. {{/weather}} {{^weather}} I don't know what the weather outside is. diff --git a/src/PkgTemplates.jl b/src/PkgTemplates.jl index 8a839e5e..f9ad9bd2 100644 --- a/src/PkgTemplates.jl +++ b/src/PkgTemplates.jl @@ -26,6 +26,7 @@ export ColPracBadge, CompatHelper, Coveralls, + Dependabot, Develop, Documenter, DroneCI, diff --git a/src/plugin.jl b/src/plugin.jl index 9e4e81ef..16833827 100644 --- a/src/plugin.jl +++ b/src/plugin.jl @@ -362,3 +362,4 @@ include(joinpath("plugins", "citation.jl")) include(joinpath("plugins", "documenter.jl")) include(joinpath("plugins", "badges.jl")) include(joinpath("plugins", "register.jl")) +include(joinpath("plugins", "dependabot.jl")) diff --git a/src/plugins/dependabot.jl b/src/plugins/dependabot.jl new file mode 100644 index 00000000..723a03db --- /dev/null +++ b/src/plugins/dependabot.jl @@ -0,0 +1,16 @@ +""" + Dependabot(; file="$(contractuser(default_file("github", "dependabot.yml")))") + +Setups Dependabot to create PRs whenever GitHub actions can be updated. +This is very similar to [`CompatHelper`](@ref), which performs the same task +for Julia package dependencies. + +## Keyword Arguments +- `file::AbstractString`: Template file for `dependabot.yml`. +""" +@plugin struct Dependabot <: FilePlugin + file::String = default_file("github", "dependabot.yml") +end + +source(p::Dependabot) = p.file +destination(::Dependabot) = joinpath(".github", "dependabot.yml") diff --git a/src/template.jl b/src/template.jl index 5e3609cc..c5eba17a 100644 --- a/src/template.jl +++ b/src/template.jl @@ -9,6 +9,7 @@ default_plugins() = [ Readme(), Tests(), TagBot(), + Dependabot(), ] function default_authors() diff --git a/templates/github/dependabot.yml b/templates/github/dependabot.yml new file mode 100644 index 00000000..700707ce --- /dev/null +++ b/templates/github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/test/reference.jl b/test/reference.jl index 3bd503b8..6c769fe3 100644 --- a/test/reference.jl +++ b/test/reference.jl @@ -89,7 +89,8 @@ end @testset "All plugins" begin test_all("AllPlugins"; authors=USER, plugins=[ AppVeyor(), CirrusCI(), Citation(), Codecov(), CompatHelper(), Coveralls(), CodeOwners(), - Develop(), Documenter(), DroneCI(), GitHubActions(), GitLabCI(), TravisCI(), RegisterAction(), + Dependabot(), Develop(), Documenter(), DroneCI(), GitHubActions(), GitLabCI(), TravisCI(), + RegisterAction(), ]) end @@ -120,6 +121,7 @@ end CodeOwners(; owners=["*"=>["@user"], "README.md"=>["@group","user@example.com"]]), CompatHelper(; cron="0 0 */3 * *"), Coveralls(; file=STATIC_TXT), + Dependabot(), Documenter{GitHubActions}(; assets=[STATIC_TXT], logo=Logo(; light=STATIC_PNG), From 0029d0e7c7683d78044ee7ab13f715cee05940f3 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Thu, 20 Apr 2023 10:40:56 +0200 Subject: [PATCH 31/66] move Dependatob not a default plugin --- docs/src/user.md | 2 +- src/template.jl | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/src/user.md b/docs/src/user.md index aa0f58be..29eb30ff 100644 --- a/docs/src/user.md +++ b/docs/src/user.md @@ -44,7 +44,6 @@ Git CompatHelper TagBot Secret -Dependabot ``` ### Continuous Integration (CI) @@ -56,6 +55,7 @@ AppVeyor CirrusCI DroneCI GitHubActions +Dependabot GitLabCI TravisCI ``` diff --git a/src/template.jl b/src/template.jl index c5eba17a..5e3609cc 100644 --- a/src/template.jl +++ b/src/template.jl @@ -9,7 +9,6 @@ default_plugins() = [ Readme(), Tests(), TagBot(), - Dependabot(), ] function default_authors() From b88b1aa821c65c7eb8d0b17fa2c6c7a99584a1ba Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Mon, 24 Apr 2023 07:59:27 +0200 Subject: [PATCH 32/66] explicit note about package ecosystems --- src/plugins/dependabot.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/dependabot.jl b/src/plugins/dependabot.jl index 723a03db..89ef73dc 100644 --- a/src/plugins/dependabot.jl +++ b/src/plugins/dependabot.jl @@ -5,6 +5,13 @@ Setups Dependabot to create PRs whenever GitHub actions can be updated. This is very similar to [`CompatHelper`](@ref), which performs the same task for Julia package dependencies. +!!! note "Only for GitHub actions" + Currently, this plugin is configured to setup Dependabot only for the + GitHub actions package ecosystem. For example, it will create PRs whenever + GitHub actions such as `uses: actions/checkout@v2` can be updated to + `uses: actions/checkout@v3`. If you want to configure Dependabot to update + other package ecosystems, please modify the resulting file yourself. + ## Keyword Arguments - `file::AbstractString`: Template file for `dependabot.yml`. """ From 70f01d0fd045c809dfffd003e3d33f1c0a396c4e Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Mon, 24 Apr 2023 08:00:06 +0200 Subject: [PATCH 33/66] move Dependabot to misc section of the docs --- docs/src/user.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/user.md b/docs/src/user.md index 29eb30ff..fd102437 100644 --- a/docs/src/user.md +++ b/docs/src/user.md @@ -55,7 +55,6 @@ AppVeyor CirrusCI DroneCI GitHubActions -Dependabot GitLabCI TravisCI ``` @@ -86,6 +85,7 @@ PkgEvalBadge ### Miscellaneous ```@docs +Dependabot Develop Citation RegisterAction From 829b10dea6ba2dd215fe6bc7b1641e20b2a8ba25 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Mon, 24 Apr 2023 08:01:26 +0200 Subject: [PATCH 34/66] add reference files for tests --- test/fixtures/AllPlugins/.github/dependabot.yml | 7 +++++++ test/fixtures/WackyOptions/.github/dependabot.yml | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 test/fixtures/AllPlugins/.github/dependabot.yml create mode 100644 test/fixtures/WackyOptions/.github/dependabot.yml diff --git a/test/fixtures/AllPlugins/.github/dependabot.yml b/test/fixtures/AllPlugins/.github/dependabot.yml new file mode 100644 index 00000000..700707ce --- /dev/null +++ b/test/fixtures/AllPlugins/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/test/fixtures/WackyOptions/.github/dependabot.yml b/test/fixtures/WackyOptions/.github/dependabot.yml new file mode 100644 index 00000000..700707ce --- /dev/null +++ b/test/fixtures/WackyOptions/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" From 5cc1711e8a931e035f3e54859af2619ea2eb6421 Mon Sep 17 00:00:00 2001 From: Frames White Date: Mon, 24 Apr 2023 16:47:41 +0800 Subject: [PATCH 35/66] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 0e8c6002..8abd70d5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.33" +version = "0.7.34" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 05c6e7cc272167ade1617b84b7b729411c01fbce Mon Sep 17 00:00:00 2001 From: Nathan Musoke Date: Tue, 9 May 2023 10:20:01 -0400 Subject: [PATCH 36/66] github & travis: dev package before building docs The Documenter.jl docs say to dev the package before building the docs. - https://github.com/JuliaDocs/Documenter.jl/blob/233a7822d670b063e894f62aea00729bcb3a28dd/docs/src/man/hosting.md?plain=1#L201-L202 The gitlab-ci script already does this, so this commit increases consistency. --- src/plugins/documenter.jl | 2 +- templates/github/workflows/CI.yml | 6 ++++++ templates/travis.yml | 8 +++++++- test/fixtures/AllPlugins/.gitignore | 1 + .../DocumenterGitHubActions/.github/workflows/CI.yml | 6 ++++++ test/fixtures/DocumenterGitHubActions/.gitignore | 1 + test/fixtures/DocumenterGitLabCI/.gitignore | 1 + test/fixtures/DocumenterTravis/.gitignore | 1 + test/fixtures/DocumenterTravis/.travis.yml | 8 +++++++- test/fixtures/WackyOptions/.github/workflows/CI.yml | 6 ++++++ test/fixtures/WackyOptions/.gitignore | 1 + 11 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/plugins/documenter.jl b/src/plugins/documenter.jl index 07933b88..6f032bc9 100644 --- a/src/plugins/documenter.jl +++ b/src/plugins/documenter.jl @@ -111,7 +111,7 @@ defaultkw(::Type{<:Documenter}, ::Val{:index_md}) = default_file("docs", "src", defaultkw(::Type{<:Documenter}, ::Val{:devbranch}) = nothing defaultkw(::Type{<:Documenter}, ::Val{:edit_link}) = :devbranch -gitignore(::Documenter) = ["/docs/build/"] +gitignore(::Documenter) = ["/docs/build/", "/docs/Manifest.toml"] priority(::Documenter, ::Function) = DEFAULT_PRIORITY - 1 # We need SrcDir to go first. badges(::Documenter) = Badge[] diff --git a/templates/github/workflows/CI.yml b/templates/github/workflows/CI.yml index 22e92853..4e036ae1 100644 --- a/templates/github/workflows/CI.yml +++ b/templates/github/workflows/CI.yml @@ -73,6 +73,12 @@ jobs: - uses: julia-actions/setup-julia@v1 with: version: '1' + - name: Configure doc environment + run: | + julia --project=docs/ -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-docdeploy@v1 env: diff --git a/templates/travis.yml b/templates/travis.yml index e982a2ce..fef5a18d 100644 --- a/templates/travis.yml +++ b/templates/travis.yml @@ -41,7 +41,13 @@ jobs: include: - stage: Documentation julia: 1 - script: | + script: + - | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' + - | julia --project=docs -e ' using Pkg Pkg.develop(PackageSpec(path=pwd())) diff --git a/test/fixtures/AllPlugins/.gitignore b/test/fixtures/AllPlugins/.gitignore index 20fe29d1..95731a59 100644 --- a/test/fixtures/AllPlugins/.gitignore +++ b/test/fixtures/AllPlugins/.gitignore @@ -2,4 +2,5 @@ *.jl.cov *.jl.mem /Manifest.toml +/docs/Manifest.toml /docs/build/ diff --git a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml index dca10651..66c9efc1 100644 --- a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml +++ b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml @@ -45,6 +45,12 @@ jobs: - uses: julia-actions/setup-julia@v1 with: version: '1' + - name: Configure doc environment + run: | + julia --project=docs/ -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-docdeploy@v1 env: diff --git a/test/fixtures/DocumenterGitHubActions/.gitignore b/test/fixtures/DocumenterGitHubActions/.gitignore index d6b4b1c0..5a16984f 100644 --- a/test/fixtures/DocumenterGitHubActions/.gitignore +++ b/test/fixtures/DocumenterGitHubActions/.gitignore @@ -1,2 +1,3 @@ /Manifest.toml +/docs/Manifest.toml /docs/build/ diff --git a/test/fixtures/DocumenterGitLabCI/.gitignore b/test/fixtures/DocumenterGitLabCI/.gitignore index 20fe29d1..95731a59 100644 --- a/test/fixtures/DocumenterGitLabCI/.gitignore +++ b/test/fixtures/DocumenterGitLabCI/.gitignore @@ -2,4 +2,5 @@ *.jl.cov *.jl.mem /Manifest.toml +/docs/Manifest.toml /docs/build/ diff --git a/test/fixtures/DocumenterTravis/.gitignore b/test/fixtures/DocumenterTravis/.gitignore index d6b4b1c0..5a16984f 100644 --- a/test/fixtures/DocumenterTravis/.gitignore +++ b/test/fixtures/DocumenterTravis/.gitignore @@ -1,2 +1,3 @@ /Manifest.toml +/docs/Manifest.toml /docs/build/ diff --git a/test/fixtures/DocumenterTravis/.travis.yml b/test/fixtures/DocumenterTravis/.travis.yml index 298a2edb..96fe4c74 100644 --- a/test/fixtures/DocumenterTravis/.travis.yml +++ b/test/fixtures/DocumenterTravis/.travis.yml @@ -20,7 +20,13 @@ jobs: include: - stage: Documentation julia: 1 - script: | + script: + - | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' + - | julia --project=docs -e ' using Pkg Pkg.develop(PackageSpec(path=pwd())) diff --git a/test/fixtures/WackyOptions/.github/workflows/CI.yml b/test/fixtures/WackyOptions/.github/workflows/CI.yml index 838c5102..3778055d 100644 --- a/test/fixtures/WackyOptions/.github/workflows/CI.yml +++ b/test/fixtures/WackyOptions/.github/workflows/CI.yml @@ -45,6 +45,12 @@ jobs: - uses: julia-actions/setup-julia@v1 with: version: '1' + - name: Configure doc environment + run: | + julia --project=docs/ -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-docdeploy@v1 env: diff --git a/test/fixtures/WackyOptions/.gitignore b/test/fixtures/WackyOptions/.gitignore index 739bc26e..9925671a 100644 --- a/test/fixtures/WackyOptions/.gitignore +++ b/test/fixtures/WackyOptions/.gitignore @@ -1,6 +1,7 @@ *.jl.*.cov *.jl.cov *.jl.mem +/docs/Manifest.toml /docs/build/ a b From 9324496f9db9075e9aad172d4e1cdf6248d232c8 Mon Sep 17 00:00:00 2001 From: Nathan Musoke Date: Fri, 12 May 2023 01:47:58 -0400 Subject: [PATCH 37/66] make GitHubActions a default plugin Fixes https://github.com/JuliaCI/PkgTemplates.jl/issues/357 --- docs/src/user.md | 2 +- src/template.jl | 1 + test/fixtures/Basic/.github/workflows/CI.yml | 36 +++++++++++++++++++ test/fixtures/Basic/README.md | 2 ++ .../.github/workflows/CI.yml | 36 +++++++++++++++++++ test/fixtures/DocumenterGitLabCI/README.md | 1 + .../DocumenterTravis/.github/workflows/CI.yml | 36 +++++++++++++++++++ test/fixtures/DocumenterTravis/README.md | 1 + test/interactive.jl | 2 +- test/show.jl | 10 ++++++ test/template.jl | 4 +-- 11 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 test/fixtures/Basic/.github/workflows/CI.yml create mode 100644 test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml create mode 100644 test/fixtures/DocumenterTravis/.github/workflows/CI.yml diff --git a/docs/src/user.md b/docs/src/user.md index fd102437..b8582df3 100644 --- a/docs/src/user.md +++ b/docs/src/user.md @@ -41,6 +41,7 @@ Tests Readme License Git +GitHubActions CompatHelper TagBot Secret @@ -54,7 +55,6 @@ These plugins will create the configuration files of common CI services for you. AppVeyor CirrusCI DroneCI -GitHubActions GitLabCI TravisCI ``` diff --git a/src/template.jl b/src/template.jl index 5e3609cc..361b2da5 100644 --- a/src/template.jl +++ b/src/template.jl @@ -9,6 +9,7 @@ default_plugins() = [ Readme(), Tests(), TagBot(), + GitHubActions(), ] function default_authors() diff --git a/test/fixtures/Basic/.github/workflows/CI.yml b/test/fixtures/Basic/.github/workflows/CI.yml new file mode 100644 index 00000000..074e12e7 --- /dev/null +++ b/test/fixtures/Basic/.github/workflows/CI.yml @@ -0,0 +1,36 @@ +name: CI +on: + push: + branches: + - main + tags: ['*'] + pull_request: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - '1.0' + - '1.7' + - 'nightly' + os: + - ubuntu-latest + arch: + - x64 + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: julia-actions/cache@v1 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 diff --git a/test/fixtures/Basic/README.md b/test/fixtures/Basic/README.md index 0b51bff1..b5907a15 100644 --- a/test/fixtures/Basic/README.md +++ b/test/fixtures/Basic/README.md @@ -1 +1,3 @@ # Basic + +[![Build Status](https://github.com/tester/Basic.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/tester/Basic.jl/actions/workflows/CI.yml?query=branch%3Amain) diff --git a/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml b/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml new file mode 100644 index 00000000..074e12e7 --- /dev/null +++ b/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml @@ -0,0 +1,36 @@ +name: CI +on: + push: + branches: + - main + tags: ['*'] + pull_request: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - '1.0' + - '1.7' + - 'nightly' + os: + - ubuntu-latest + arch: + - x64 + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: julia-actions/cache@v1 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 diff --git a/test/fixtures/DocumenterGitLabCI/README.md b/test/fixtures/DocumenterGitLabCI/README.md index a564a188..fb9c2983 100644 --- a/test/fixtures/DocumenterGitLabCI/README.md +++ b/test/fixtures/DocumenterGitLabCI/README.md @@ -1,5 +1,6 @@ # DocumenterGitLabCI [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.gitlab.io/DocumenterGitLabCI.jl/dev) +[![Build Status](https://github.com/tester/DocumenterGitLabCI.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/tester/DocumenterGitLabCI.jl/actions/workflows/CI.yml?query=branch%3Amain) [![Build Status](https://github.com/tester/DocumenterGitLabCI.jl/badges/main/pipeline.svg)](https://github.com/tester/DocumenterGitLabCI.jl/pipelines) [![Coverage](https://github.com/tester/DocumenterGitLabCI.jl/badges/main/coverage.svg)](https://github.com/tester/DocumenterGitLabCI.jl/commits/main) diff --git a/test/fixtures/DocumenterTravis/.github/workflows/CI.yml b/test/fixtures/DocumenterTravis/.github/workflows/CI.yml new file mode 100644 index 00000000..074e12e7 --- /dev/null +++ b/test/fixtures/DocumenterTravis/.github/workflows/CI.yml @@ -0,0 +1,36 @@ +name: CI +on: + push: + branches: + - main + tags: ['*'] + pull_request: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - '1.0' + - '1.7' + - 'nightly' + os: + - ubuntu-latest + arch: + - x64 + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: julia-actions/cache@v1 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 diff --git a/test/fixtures/DocumenterTravis/README.md b/test/fixtures/DocumenterTravis/README.md index 21f04c7a..36b63906 100644 --- a/test/fixtures/DocumenterTravis/README.md +++ b/test/fixtures/DocumenterTravis/README.md @@ -2,4 +2,5 @@ [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://tester.github.io/DocumenterTravis.jl/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.github.io/DocumenterTravis.jl/dev/) +[![Build Status](https://github.com/tester/DocumenterTravis.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/tester/DocumenterTravis.jl/actions/workflows/CI.yml?query=branch%3Amain) [![Build Status](https://travis-ci.com/tester/DocumenterTravis.jl.svg?branch=main)](https://travis-ci.com/tester/DocumenterTravis.jl) diff --git a/test/interactive.jl b/test/interactive.jl index 170fd664..2769eb15 100644 --- a/test/interactive.jl +++ b/test/interactive.jl @@ -133,7 +133,7 @@ end CR, DOWN^5, CR, DONE, # Customize user and plugins USER, LF, # Enter user SELECT_DEFAULTS, # Pre-select default plugins - UP, CR, UP^2, CR, DONE, # Disable TagBot and Readme + UP^2, CR, UP^2, CR, DONE,# Disable TagBot and Readme DONE^(NDEFAULTS - 2), # Don't customize plugins ) @test Template(; interactive=true) == Template(; diff --git a/test/show.jl b/test/show.jl index bf028169..bda117d9 100644 --- a/test/show.jl +++ b/test/show.jl @@ -47,6 +47,16 @@ end jl: true manifest: false gpgsign: false + GitHubActions: + file: \"~/.julia/dev/PkgTemplates/templates/github/workflows/CI.yml\" + destination: \"CI.yml\" + linux: true + osx: false + windows: false + x64: true + x86: false + coverage: true + extra_versions: [\"1.0\", \"1.7\", \"nightly\"] License: path: "$(joinpath(LICENSES_DIR, "MIT"))" destination: "LICENSE" diff --git a/test/template.jl b/test/template.jl index 538f8557..ccc556a0 100644 --- a/test/template.jl +++ b/test/template.jl @@ -9,7 +9,7 @@ patch = @patch PkgTemplates.getkw!(kwargs, k) = "" apply(patch) do @test_throws PT.MissingUserException Template() - @test isempty(Template(; plugins=[!Git]).user) + @test isempty(Template(; plugins=[!Git, !GitHubActions]).user) end patch = @patch PkgTemplates.getkw!(kwargs, k) = "username" @@ -78,7 +78,7 @@ @testset "validate" begin foreach((GitHubActions, TravisCI, GitLabCI)) do T - @test_throws ArgumentError tpl(; plugins=[Documenter{T}()]) + @test_throws ArgumentError tpl(; plugins=[!GitHubActions, Documenter{T}()]) end patch = @patch LibGit2.getconfig(r, n) = "" From 4f3920ec36823ece244fa7789c3104e0bf017f34 Mon Sep 17 00:00:00 2001 From: Nathan Musoke Date: Fri, 12 May 2023 02:32:57 -0400 Subject: [PATCH 38/66] fixup environment dependent tests of defaults --- test/show.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/show.jl b/test/show.jl index bda117d9..1154ae52 100644 --- a/test/show.jl +++ b/test/show.jl @@ -48,7 +48,7 @@ end manifest: false gpgsign: false GitHubActions: - file: \"~/.julia/dev/PkgTemplates/templates/github/workflows/CI.yml\" + file: "$(joinpath(TEMPLATES_DIR, "github", "workflows", "CI.yml"))" destination: \"CI.yml\" linux: true osx: false @@ -56,7 +56,7 @@ end x64: true x86: false coverage: true - extra_versions: [\"1.0\", \"1.7\", \"nightly\"] + extra_versions: [\"1.0\", \"$(VERSION.major).$(VERSION.minor)\", \"nightly\"] License: path: "$(joinpath(LICENSES_DIR, "MIT"))" destination: "LICENSE" From aea39ebdd4554a0f48cd662ac1c4c81d9c13a56b Mon Sep 17 00:00:00 2001 From: Frames White Date: Mon, 15 May 2023 11:40:07 +0800 Subject: [PATCH 39/66] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 8abd70d5..21b1c01f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.34" +version = "0.7.35" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 75bfffe356c4cde8cd2cc2119f46e2546ea2e056 Mon Sep 17 00:00:00 2001 From: Frames White Date: Mon, 15 May 2023 11:44:20 +0800 Subject: [PATCH 40/66] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 21b1c01f..4c422c86 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.35" +version = "0.7.36" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 35c3eed124a5a09b23d01b71665e1eb3cffc599c Mon Sep 17 00:00:00 2001 From: Gabriel Wu Date: Tue, 16 May 2023 17:52:19 +0800 Subject: [PATCH 41/66] Upgrade checkout and codecov action versions (#402) * Upgrade checkout and codecov action versions * update other positions --- .github/workflows/CI.yml | 6 +++--- .github/workflows/JuliaNightly.yml | 4 ++-- templates/github/workflows/CI.yml | 6 +++--- test/fixtures/AllPlugins/.github/workflows/CI.yml | 4 ++-- test/fixtures/Basic/.github/workflows/CI.yml | 2 +- .../DocumenterGitHubActions/.github/workflows/CI.yml | 4 ++-- test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml | 2 +- test/fixtures/DocumenterTravis/.github/workflows/CI.yml | 2 +- test/fixtures/WackyOptions/.github/workflows/CI.yml | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f0595775..8e7399d1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -45,7 +45,7 @@ jobs: version: 1.7.2 arch: x64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} @@ -67,7 +67,7 @@ jobs: git config --global user.email te@st.er - uses: julia-actions/julia-runtest@latest - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v3 with: files: lcov.info @@ -91,7 +91,7 @@ jobs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: '1' diff --git a/.github/workflows/JuliaNightly.yml b/.github/workflows/JuliaNightly.yml index f521f610..6df402af 100644 --- a/.github/workflows/JuliaNightly.yml +++ b/.github/workflows/JuliaNightly.yml @@ -8,7 +8,7 @@ jobs: name: Julia Nightly - Ubuntu - x64 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: nightly @@ -27,6 +27,6 @@ jobs: git config --global user.email te@st.er - uses: julia-actions/julia-runtest@latest - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v3 with: files: lcov.info diff --git a/templates/github/workflows/CI.yml b/templates/github/workflows/CI.yml index 4e036ae1..38b172ea 100644 --- a/templates/github/workflows/CI.yml +++ b/templates/github/workflows/CI.yml @@ -42,7 +42,7 @@ jobs: <> <> steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} @@ -52,7 +52,7 @@ jobs: - uses: julia-actions/julia-runtest@v1 <<#HAS_CODECOV>> - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v3 with: files: lcov.info <> @@ -69,7 +69,7 @@ jobs: contents: write statuses: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: '1' diff --git a/test/fixtures/AllPlugins/.github/workflows/CI.yml b/test/fixtures/AllPlugins/.github/workflows/CI.yml index 60b21bea..fdfb2a92 100644 --- a/test/fixtures/AllPlugins/.github/workflows/CI.yml +++ b/test/fixtures/AllPlugins/.github/workflows/CI.yml @@ -26,7 +26,7 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} @@ -35,7 +35,7 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v3 with: files: lcov.info - uses: julia-actions/julia-uploadcoveralls@v1 diff --git a/test/fixtures/Basic/.github/workflows/CI.yml b/test/fixtures/Basic/.github/workflows/CI.yml index 074e12e7..3833ee10 100644 --- a/test/fixtures/Basic/.github/workflows/CI.yml +++ b/test/fixtures/Basic/.github/workflows/CI.yml @@ -26,7 +26,7 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} diff --git a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml index 66c9efc1..e4337fe1 100644 --- a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml +++ b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml @@ -26,7 +26,7 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} @@ -41,7 +41,7 @@ jobs: contents: write statuses: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: '1' diff --git a/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml b/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml index 074e12e7..3833ee10 100644 --- a/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml +++ b/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml @@ -26,7 +26,7 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} diff --git a/test/fixtures/DocumenterTravis/.github/workflows/CI.yml b/test/fixtures/DocumenterTravis/.github/workflows/CI.yml index 074e12e7..3833ee10 100644 --- a/test/fixtures/DocumenterTravis/.github/workflows/CI.yml +++ b/test/fixtures/DocumenterTravis/.github/workflows/CI.yml @@ -26,7 +26,7 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} diff --git a/test/fixtures/WackyOptions/.github/workflows/CI.yml b/test/fixtures/WackyOptions/.github/workflows/CI.yml index 3778055d..f3d4ee01 100644 --- a/test/fixtures/WackyOptions/.github/workflows/CI.yml +++ b/test/fixtures/WackyOptions/.github/workflows/CI.yml @@ -26,7 +26,7 @@ jobs: - x64 - x86 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} @@ -41,7 +41,7 @@ jobs: contents: write statuses: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1 with: version: '1' From 5da8b6974fcef9003f46449003b236c2d57f41da Mon Sep 17 00:00:00 2001 From: Frames White Date: Wed, 17 May 2023 19:59:11 +0800 Subject: [PATCH 42/66] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 4c422c86..21b1c01f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.36" +version = "0.7.35" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From efe82947d170ecdf0790d371805e0de86719e805 Mon Sep 17 00:00:00 2001 From: Frames White Date: Wed, 17 May 2023 20:10:56 +0800 Subject: [PATCH 43/66] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 21b1c01f..4c422c86 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.35" +version = "0.7.36" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 7ad99c1d964b22804de3110de9951f45720cc83b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 May 2023 06:39:07 +0000 Subject: [PATCH 44/66] Bump actions/cache from 2 to 3 Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/CI.yml | 2 +- .github/workflows/JuliaNightly.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8e7399d1..76d7116f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -50,7 +50,7 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v2 + - uses: actions/cache@v3 env: cache-name: cache-artifacts with: diff --git a/.github/workflows/JuliaNightly.yml b/.github/workflows/JuliaNightly.yml index 6df402af..f56d39e9 100644 --- a/.github/workflows/JuliaNightly.yml +++ b/.github/workflows/JuliaNightly.yml @@ -13,7 +13,7 @@ jobs: with: version: nightly arch: x64 - - uses: actions/cache@v2 + - uses: actions/cache@v3 env: cache-name: julia-nightly-cache-artifacts with: From a3dc66242b7b6883eaf9c81be3980fa392f95709 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 May 2023 06:39:13 +0000 Subject: [PATCH 45/66] Bump voxmedia/github-action-slack-notify-build from 1 to 2 Bumps [voxmedia/github-action-slack-notify-build](https://github.com/voxmedia/github-action-slack-notify-build) from 1 to 2. - [Release notes](https://github.com/voxmedia/github-action-slack-notify-build/releases) - [Changelog](https://github.com/voxmedia/github-action-slack-notify-build/blob/main/CHANGELOG.md) - [Commits](https://github.com/voxmedia/github-action-slack-notify-build/compare/v1...v2) --- updated-dependencies: - dependency-name: voxmedia/github-action-slack-notify-build dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8e7399d1..cd3d60c8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -78,7 +78,7 @@ jobs: if: always() && github.event_name == 'schedule' steps: - uses: technote-space/workflow-conclusion-action@v2 - - uses: voxmedia/github-action-slack-notify-build@v1 + - uses: voxmedia/github-action-slack-notify-build@v2 if: env.WORKFLOW_CONCLUSION == 'failure' with: channel: nightly-dev From bbe678d62ef2f79503f9ab9833143b3b18dfc6bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 May 2023 07:21:15 +0000 Subject: [PATCH 46/66] Bump technote-space/workflow-conclusion-action from 2 to 3 Bumps [technote-space/workflow-conclusion-action](https://github.com/technote-space/workflow-conclusion-action) from 2 to 3. - [Release notes](https://github.com/technote-space/workflow-conclusion-action/releases) - [Changelog](https://github.com/technote-space/workflow-conclusion-action/blob/main/.releasegarc) - [Commits](https://github.com/technote-space/workflow-conclusion-action/compare/v2...v3) --- updated-dependencies: - dependency-name: technote-space/workflow-conclusion-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2dff0daa..c618687d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -77,7 +77,7 @@ jobs: runs-on: ubuntu-latest if: always() && github.event_name == 'schedule' steps: - - uses: technote-space/workflow-conclusion-action@v2 + - uses: technote-space/workflow-conclusion-action@v3 - uses: voxmedia/github-action-slack-notify-build@v2 if: env.WORKFLOW_CONCLUSION == 'failure' with: From 0286e61c22391e054f5b06610f1aa5093f4e5774 Mon Sep 17 00:00:00 2001 From: Simon Avery Date: Fri, 26 May 2023 08:44:53 -0700 Subject: [PATCH 47/66] Update TagBot template --- templates/github/workflows/TagBot.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/templates/github/workflows/TagBot.yml b/templates/github/workflows/TagBot.yml index 464b9ea4..0736b446 100644 --- a/templates/github/workflows/TagBot.yml +++ b/templates/github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: 3 +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == '{{{TRIGGER}}}' From 5465a91ab3912fb209e4896bdee9a75aca749bbe Mon Sep 17 00:00:00 2001 From: Simon Avery Date: Sun, 4 Jun 2023 22:29:51 -0700 Subject: [PATCH 48/66] Update test references to the new TagBot template --- .../AllPlugins/.github/workflows/TagBot.yml | 16 ++++++++++++++++ test/fixtures/Basic/.github/workflows/TagBot.yml | 16 ++++++++++++++++ .../.github/workflows/TagBot.yml | 16 ++++++++++++++++ .../.github/workflows/TagBot.yml | 16 ++++++++++++++++ .../.github/workflows/TagBot.yml | 16 ++++++++++++++++ .../WackyOptions/.github/workflows/TagBot.yml | 16 ++++++++++++++++ 6 files changed, 96 insertions(+) diff --git a/test/fixtures/AllPlugins/.github/workflows/TagBot.yml b/test/fixtures/AllPlugins/.github/workflows/TagBot.yml index f49313b6..2bacdb87 100644 --- a/test/fixtures/AllPlugins/.github/workflows/TagBot.yml +++ b/test/fixtures/AllPlugins/.github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: 3 +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' diff --git a/test/fixtures/Basic/.github/workflows/TagBot.yml b/test/fixtures/Basic/.github/workflows/TagBot.yml index f49313b6..2bacdb87 100644 --- a/test/fixtures/Basic/.github/workflows/TagBot.yml +++ b/test/fixtures/Basic/.github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: 3 +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' diff --git a/test/fixtures/DocumenterGitHubActions/.github/workflows/TagBot.yml b/test/fixtures/DocumenterGitHubActions/.github/workflows/TagBot.yml index f49313b6..2bacdb87 100644 --- a/test/fixtures/DocumenterGitHubActions/.github/workflows/TagBot.yml +++ b/test/fixtures/DocumenterGitHubActions/.github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: 3 +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' diff --git a/test/fixtures/DocumenterGitLabCI/.github/workflows/TagBot.yml b/test/fixtures/DocumenterGitLabCI/.github/workflows/TagBot.yml index f49313b6..2bacdb87 100644 --- a/test/fixtures/DocumenterGitLabCI/.github/workflows/TagBot.yml +++ b/test/fixtures/DocumenterGitLabCI/.github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: 3 +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' diff --git a/test/fixtures/DocumenterTravis/.github/workflows/TagBot.yml b/test/fixtures/DocumenterTravis/.github/workflows/TagBot.yml index f49313b6..2bacdb87 100644 --- a/test/fixtures/DocumenterTravis/.github/workflows/TagBot.yml +++ b/test/fixtures/DocumenterTravis/.github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: 3 +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' diff --git a/test/fixtures/WackyOptions/.github/workflows/TagBot.yml b/test/fixtures/WackyOptions/.github/workflows/TagBot.yml index c6aa1ae3..e2fc876d 100644 --- a/test/fixtures/WackyOptions/.github/workflows/TagBot.yml +++ b/test/fixtures/WackyOptions/.github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: 3 +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'OtherUser' From 0a6e300e5d7664eeb8b2f1b4a1697a4007bf1b6d Mon Sep 17 00:00:00 2001 From: Frames White Date: Tue, 6 Jun 2023 11:29:10 +0800 Subject: [PATCH 49/66] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 4c422c86..846ba38d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.36" +version = "0.7.37" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 4be0815e9e37897fa01d4cc7298690da9085921a Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Tue, 13 Jun 2023 14:58:43 -0300 Subject: [PATCH 50/66] Make PkgEval badge link to this package's evaluation --- src/plugins/badges.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/badges.jl b/src/plugins/badges.jl index 06d3b814..075a24fe 100644 --- a/src/plugins/badges.jl +++ b/src/plugins/badges.jl @@ -46,7 +46,7 @@ function badges(::PkgEvalBadge) return Badge( "PkgEval", "https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/{{{PKG1}}}/{{{PKG}}}.svg", - "https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/report.html" + "https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/{{{PKG1}}}/{{{PKG}}}.html" ) end From 418e6012d3c6d7e70d52f234209d1e9d5582f63c Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Tue, 13 Jun 2023 15:15:33 -0300 Subject: [PATCH 51/66] Update WackyOptions fixture --- test/fixtures/WackyOptions/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/WackyOptions/README.md b/test/fixtures/WackyOptions/README.md index c0dfaec3..50b5ff57 100644 --- a/test/fixtures/WackyOptions/README.md +++ b/test/fixtures/WackyOptions/README.md @@ -1,4 +1,4 @@ -# WackyOptions [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://tester.github.io/WackyOptions.jl/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.github.io/WackyOptions.jl/dev/) [![Build Status](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml/badge.svg?branch=whackybranch)](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml?query=branch%3Awhackybranch) [![Build Status](https://x.com/tester/WackyOptions.jl/badges/whackybranch/pipeline.svg)](https://x.com/tester/WackyOptions.jl/pipelines) [![Build Status](https://travis-ci.com/tester/WackyOptions.jl.svg?branch=whackybranch)](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://coveralls.io/repos/github/tester/WackyOptions.jl/badge.svg?branch=whackybranch)](https://coveralls.io/github/tester/WackyOptions.jl?branch=whackybranch) [![PkgEval](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/W/WackyOptions.svg)](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/report.html) +# WackyOptions [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://tester.github.io/WackyOptions.jl/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.github.io/WackyOptions.jl/dev/) [![Build Status](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml/badge.svg?branch=whackybranch)](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml?query=branch%3Awhackybranch) [![Build Status](https://x.com/tester/WackyOptions.jl/badges/whackybranch/pipeline.svg)](https://x.com/tester/WackyOptions.jl/pipelines) [![Build Status](https://travis-ci.com/tester/WackyOptions.jl.svg?branch=whackybranch)](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://coveralls.io/repos/github/tester/WackyOptions.jl/badge.svg?branch=whackybranch)](https://coveralls.io/github/tester/WackyOptions.jl?branch=whackybranch) [![PkgEval](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/W/WackyOptions.svg)](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/W/WackyOptions.html) ## Citing From 82fade6c2ab44e81a94f84a5364e1742d3cd6201 Mon Sep 17 00:00:00 2001 From: Frames White Date: Wed, 14 Jun 2023 10:23:58 +0800 Subject: [PATCH 52/66] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 846ba38d..69a5f638 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.37" +version = "0.7.38" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 0f1b9904acae5bd5654e700be80865c5d1af54be Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Mon, 7 Aug 2023 10:46:45 +0200 Subject: [PATCH 53/66] Explain reference Julia version for tests (#414) * Explain reference Julia version for tests * Trigger CI again --- docs/src/developer.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/src/developer.md b/docs/src/developer.md index 1921d7d6..9299157a 100644 --- a/docs/src/developer.md +++ b/docs/src/developer.md @@ -385,6 +385,18 @@ Check them to make sure that they contain exactly what you would expect! For changes to existing plugins, update the plugin options appropriately in the "Wacky options" test set. Failing tests will give you the option to review and accept changes to the fixtures, updating the files automatically for you. +### Running reference tests locally + +In the file `test/runtests.jl`, there is a variable called `REFERENCE_JULIA_VERSION`, currently set to `v"1.7.2"`. +If you use any other Julia version (even the latest stable one) to launch the test suite, the reference tests mentioned above will not run, and you will miss a crucial correctness check for your code. +Therefore, we strongly suggest you test PkgTemplates locally against Julia 1.7.2. +This version can be easily installed and started with [juliaup](https://github.com/JuliaLang/juliaup): + +```bash +juliaup add 1.7.2 +julia +1.7.2 +``` + ### Updating "Show" Tests Depending on what you've changed, the tests in `test/show.jl` might fail. From ecdeffe0de07ba4afd03808ad5cacc60ffa0d1a7 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Mon, 7 Aug 2023 15:03:05 +0200 Subject: [PATCH 54/66] Add JuliaFormatter plugin (#412) * Add JuliaFormatter plugin * Add newlines at the end of each .JuliaFormatter.toml * Add default option for empty style * Add style validation and radio menu * Replace JuliaFormatter with Formatter * Patch version bump --- Project.toml | 2 +- src/PkgTemplates.jl | 1 + src/plugin.jl | 1 + src/plugins/formatter.jl | 45 +++++++++++++++++++ templates/.JuliaFormatter.toml | 2 + test/fixtures/AllPlugins/.JuliaFormatter.toml | 1 + .../WackyOptions/.JuliaFormatter.toml | 2 + test/reference.jl | 18 +++++++- 8 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 src/plugins/formatter.jl create mode 100644 templates/.JuliaFormatter.toml create mode 100644 test/fixtures/AllPlugins/.JuliaFormatter.toml create mode 100644 test/fixtures/WackyOptions/.JuliaFormatter.toml diff --git a/Project.toml b/Project.toml index 69a5f638..2cec472c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.38" +version = "0.7.39" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/PkgTemplates.jl b/src/PkgTemplates.jl index f9ad9bd2..b400d293 100644 --- a/src/PkgTemplates.jl +++ b/src/PkgTemplates.jl @@ -30,6 +30,7 @@ export Develop, Documenter, DroneCI, + Formatter, Git, GitHubActions, GitLabCI, diff --git a/src/plugin.jl b/src/plugin.jl index 16833827..ff13fda7 100644 --- a/src/plugin.jl +++ b/src/plugin.jl @@ -363,3 +363,4 @@ include(joinpath("plugins", "documenter.jl")) include(joinpath("plugins", "badges.jl")) include(joinpath("plugins", "register.jl")) include(joinpath("plugins", "dependabot.jl")) +include(joinpath("plugins", "formatter.jl")) diff --git a/src/plugins/formatter.jl b/src/plugins/formatter.jl new file mode 100644 index 00000000..afaace9f --- /dev/null +++ b/src/plugins/formatter.jl @@ -0,0 +1,45 @@ +""" + Formatter(; + file="$(contractuser(default_file(".JuliaFormatter.toml")))", + style="nostyle" + ) + +Create a `.JuliaFormatter.toml` file, used by [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) and the Julia VSCode extension to configure automatic code formatting. + +This file can be entirely customized by the user, see the [JuliaFormatter.jl docs](https://domluna.github.io/JuliaFormatter.jl/stable/). + +## Keyword Arguments +- `file::String`: Template file for `.JuliaFormatter.toml`. +- `style::String`: Style name, defaults to `"nostyle"` for an empty style but can also be one of `("sciml", "blue", "yas")` for a fully preconfigured style. +""" +@plugin struct Formatter <: FilePlugin + file::String = default_file(".JuliaFormatter.toml") + style::String = "nostyle" +end + +function validate(p::Formatter, t::Template) + if p.style ∉ ("nostyle", "blue", "sciml", "yas") + throw(ArgumentError("""JuliaFormatter style must be either "nostyle", "blue", "sciml" or "yas".""")) + end +end + +source(p::Formatter) = p.file +destination(::Formatter) = ".JuliaFormatter.toml" + +function view(p::Formatter, t::Template, pkg::AbstractString) + d = Dict{String,String}() + if p.style == "nostyle" + d["STYLE"] = "" + else + d["STYLE"] = """style = \"$(p.style)\"""" + end + return d +end + +function prompt(::Type{Formatter}, ::Type{String}, ::Val{:style}) + options = ["nostyle", "blue", "sciml", "yas"] + menu = RadioMenu(options; pagesize=length(options)) + println("Select a JuliaFormatter style:") + idx = request(menu) + return options[idx] +end diff --git a/templates/.JuliaFormatter.toml b/templates/.JuliaFormatter.toml new file mode 100644 index 00000000..5b99bbec --- /dev/null +++ b/templates/.JuliaFormatter.toml @@ -0,0 +1,2 @@ +# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options +{{{STYLE}}} diff --git a/test/fixtures/AllPlugins/.JuliaFormatter.toml b/test/fixtures/AllPlugins/.JuliaFormatter.toml new file mode 100644 index 00000000..01bfab9b --- /dev/null +++ b/test/fixtures/AllPlugins/.JuliaFormatter.toml @@ -0,0 +1 @@ +# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options diff --git a/test/fixtures/WackyOptions/.JuliaFormatter.toml b/test/fixtures/WackyOptions/.JuliaFormatter.toml new file mode 100644 index 00000000..d808d229 --- /dev/null +++ b/test/fixtures/WackyOptions/.JuliaFormatter.toml @@ -0,0 +1,2 @@ +# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options +style = "blue" diff --git a/test/reference.jl b/test/reference.jl index 6c769fe3..db82a6e4 100644 --- a/test/reference.jl +++ b/test/reference.jl @@ -88,9 +88,22 @@ end @testset "All plugins" begin test_all("AllPlugins"; authors=USER, plugins=[ - AppVeyor(), CirrusCI(), Citation(), Codecov(), CompatHelper(), Coveralls(), CodeOwners(), - Dependabot(), Develop(), Documenter(), DroneCI(), GitHubActions(), GitLabCI(), TravisCI(), + AppVeyor(), + CirrusCI(), + Citation(), + CodeOwners(), + Codecov(), + CompatHelper(), + Coveralls(), + Dependabot(), + Develop(), + Documenter(), + DroneCI(), + Formatter(), + GitHubActions(), + GitLabCI(), RegisterAction(), + TravisCI(), ]) end @@ -131,6 +144,7 @@ end edit_link=:commit, ), DroneCI(; amd64=false, arm=true, arm64=true, extra_versions=["1.3"]), + Formatter(; style="blue"), Git(; ignore=["a", "b", "c"], manifest=true, branch="whackybranch"), GitHubActions(; x86=true, linux=false, coverage=false), GitLabCI(; coverage=false, extra_versions=[v"0.6"]), From 9b6b59d86ffa27f6aa3d1bacb6b17d01454a630f Mon Sep 17 00:00:00 2001 From: cossio Date: Tue, 8 Aug 2023 11:07:50 +0200 Subject: [PATCH 55/66] plugin docs (#420) --- src/plugin.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugin.jl b/src/plugin.jl index ff13fda7..86197571 100644 --- a/src/plugin.jl +++ b/src/plugin.jl @@ -11,8 +11,8 @@ For details on the general syntax, see There are a few extra restrictions: -- Before using this macro, you must have imported `@with_kw_noshow` - via `using PkgTemplates: @with_kw_noshow` +- Before using this macro, you must have imported `@with_kw_noshow` and `PkgTemplates` must + be in scope: `using PkgTemplates: PkgTemplates, @with_kw_noshow, @plugin`. - The type must be a subtype of [`Plugin`](@ref) (or one of its abstract subtypes) - The type cannot be parametric - All fields must have default values @@ -20,7 +20,7 @@ There are a few extra restrictions: ## Example ```julia -using PkgTemplates: @plugin, @with_kw_noshow, Plugin +using PkgTemplates: PkgTemplates, @plugin, @with_kw_noshow, Plugin @plugin struct MyPlugin <: Plugin x::String = "hello!" y::Union{Int, Nothing} = nothing From fd9aedf96c704baa8849b0a164edc94a75259f75 Mon Sep 17 00:00:00 2001 From: Hannah Robertson Date: Tue, 8 Aug 2023 10:03:13 -0400 Subject: [PATCH 56/66] Support duplicate plugins (#419) * add tests for duplicated plugins * Do not filter out duplicate plugins Co-authored-by: nickrobinson251 * bump patch version * bump patch version --- Project.toml | 2 +- src/template.jl | 9 ++++++--- test/template.jl | 11 +++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 2cec472c..5a94c497 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.39" +version = "0.7.40" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/template.jl b/src/template.jl index 361b2da5..39e682bb 100644 --- a/src/template.jl +++ b/src/template.jl @@ -93,12 +93,15 @@ function Template(::Val{false}; kwargs...) authors = getkw!(kwargs, :authors) authors isa Vector || (authors = map(strip, split(authors, ","))) - # User-supplied plugins come first, so that deduping the list will remove the defaults. plugins = Vector{Any}(collect(getkw!(kwargs, :plugins))) disabled = map(d -> first(typeof(d).parameters), filter(p -> p isa Disabled, plugins)) filter!(p -> p isa Plugin, plugins) - append!(plugins, filter(p -> !(typeof(p) in disabled), default_plugins())) - plugins = Vector{Plugin}(sort(unique(typeof, plugins); by=string)) + # Remove a default if the user has specified (or disabled) a plugin of that type. + defaults = filter(default_plugins()) do p + !(typeof(p) in vcat(typeof.(plugins), disabled)) + end + append!(plugins, defaults) + plugins = Vector{Plugin}(sort(plugins; by=string)) if isempty(user) foreach(plugins) do p diff --git a/test/template.jl b/test/template.jl index ccc556a0..b3c69a4f 100644 --- a/test/template.jl +++ b/test/template.jl @@ -44,12 +44,23 @@ defaults = PT.default_plugins() test_plugins([], defaults) test_plugins([Citation()], union(defaults, [Citation()])) + # Overriding a default plugin. default_g = defaults[findfirst(p -> p isa Git, defaults)] g = Git(; ssh=true) test_plugins([g], union(setdiff(defaults, [default_g]), [g])) + # Disabling a default plugin. test_plugins([!Git], setdiff(defaults, [default_g])) + + # Duplicated default plugins are supported + g2 = Git(; branch="foo") + test_plugins([g, g2], union(setdiff(defaults, [default_g]), [g, g2])) + + # Duplicated non-default plugins are supported + c1 = Citation() + c2 = Citation() + test_plugins([c1, c2], vcat(defaults, [c1, c2])) end @testset "Unsupported keywords warning" begin From 2c1b52693243168c0d21349a6d05821fec615fd0 Mon Sep 17 00:00:00 2001 From: Hannah Robertson Date: Tue, 29 Aug 2023 09:28:22 -0400 Subject: [PATCH 57/66] Do not truncate ".jl" from generated package directory (#421) * wip allow pkg_dir to end in .jl * remove test fails locally * Update reference tests to test both packages with and with *.jl suffix * bump patch version * add tests * cleanup * rename pkg_name_from_pkg_dir to pkg_name --- Project.toml | 2 +- docs/src/developer.md | 10 +++++----- src/plugin.jl | 18 +++++++++++++++--- src/plugins/codeowners.jl | 5 ++--- src/plugins/documenter.jl | 2 +- src/plugins/git.jl | 2 +- src/plugins/project_file.jl | 2 +- src/plugins/src_dir.jl | 4 ++-- src/template.jl | 1 - test/plugin.jl | 9 +++++++++ test/reference.jl | 19 ++++++++++++------- 11 files changed, 49 insertions(+), 25 deletions(-) diff --git a/Project.toml b/Project.toml index 5a94c497..72bed032 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.40" +version = "0.7.41" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/docs/src/developer.md b/docs/src/developer.md index 9299157a..a6149d23 100644 --- a/docs/src/developer.md +++ b/docs/src/developer.md @@ -107,12 +107,12 @@ view(p::Documenter, t::Template, pkg::AbstractString) = Dict( ) function hook(p::Documenter, t::Template, pkg_dir::AbstractString) - pkg = basename(pkg_dir) + pkg = pkg_name(pkg_dir) docs_dir = joinpath(pkg_dir, "docs") make = render_file(p.make_jl, combined_view(p, t, pkg), tags(p)) gen_file(joinpath(docs_dir, "make.jl"), make) - + index = render_file(p.index_md, combined_view(p, t, pkg), tags(p)) gen_file(joinpath(docs_dir, "src", "index.md"), index) @@ -186,7 +186,7 @@ end function prehook(::Git, t::Template, pkg_dir::AbstractString) LibGit2.with(LibGit2.init(pkg_dir)) do repo LibGit2.commit(repo, "Initial commit") - pkg = basename(pkg_dir) + pkg = pkg_name(pkg_dir) url = "https://$(t.host)/$(t.user)/$pkg.jl" close(GitRemote(repo, "origin", url)) end @@ -287,7 +287,7 @@ end function hook(p::FilePlugin, t::Template, pkg_dir::AbstractString) source(p) === nothing && return - pkg = basename(pkg_dir) + pkg = pkg_name(pkg_dir) path = joinpath(pkg_dir, destination(p)) text = render_plugin(p, t, pkg) gen_file(path, text) @@ -375,7 +375,7 @@ Here are some testing tips to ensure that your PR goes through as smoothly as po ### Updating Reference Tests & Fixtures If you've added or modified plugins, you should update the reference tests and the associated test fixtures. -In `test/reference.jl`, you'll find a "Reference tests" test set that basically generates a bunch of packages, and then checks each file against a reference file, which is stored somewhere in `test/fixtures`. +In `test/reference.jl`, you'll find a "Reference tests" test set that basically generates a bunch of packages, and then checks each file against a reference file, which is stored somewhere in `test/fixtures`. Note the reference tests only run on one specific version of Julia; check `test/runtests.jl` to see the current version used. For new plugins, you should add an instance of your plugin to the "All plugins" and "Wacky options" test sets, then run the tests with `Pkg.test`. diff --git a/src/plugin.jl b/src/plugin.jl index 86197571..ba5b0c1d 100644 --- a/src/plugin.jl +++ b/src/plugin.jl @@ -267,8 +267,8 @@ prehook(::Plugin, ::Template, ::AbstractString) = nothing Stage 2 of the package generation pipeline (the "main" stage, in general). At this point, the [`prehook`](@ref)s have run, but not the [`posthook`](@ref)s. -`pkg_dir` is the directory in which the package is being generated -(so `basename(pkg_dir)` is the package name). +`pkg_dir` is the directory in which the package is being generated; [`pkg_name`](@ref)` +will return the package name. !!! note You usually shouldn't implement this function for [`FilePlugin`](@ref)s. @@ -293,7 +293,7 @@ end function hook(p::FilePlugin, t::Template, pkg_dir::AbstractString) source(p) === nothing && return - pkg = basename(pkg_dir) + pkg = pkg_name(pkg_dir) path = joinpath(pkg_dir, destination(p)) text = render_plugin(p, t, pkg) gen_file(path, text) @@ -346,6 +346,18 @@ you should implement this function and return `true`. """ needs_username(::Plugin) = false +""" + pkg_name(pkg_dir::AbstractString) + +Return package name of package at `pkg_dir`, i.e., `basename(pkg_dir)` excluding any +`.jl` suffix, if present. For example, `foo/bar/Whee.jl` and `foo/bar/Whee` both +return `Whee`. +""" +function pkg_name(pkg_dir::AbstractString) + pkg = basename(pkg_dir) + return endswith(pkg, ".jl") ? pkg[1:end-3] : pkg +end + include(joinpath("plugins", "project_file.jl")) include(joinpath("plugins", "src_dir.jl")) include(joinpath("plugins", "tests.jl")) diff --git a/src/plugins/codeowners.jl b/src/plugins/codeowners.jl index 3077f777..44244f8d 100644 --- a/src/plugins/codeowners.jl +++ b/src/plugins/codeowners.jl @@ -21,8 +21,7 @@ function render_plugin(p::CodeOwners) join((pattern * " " * join(subowners, " ") for (pattern, subowners) in p.owners), "\n") end -function PkgTemplates.hook(p::CodeOwners, t::Template, pkg_dir::AbstractString) - pkg = basename(pkg_dir) +function PkgTemplates.hook(p::CodeOwners, ::Template, pkg_dir::AbstractString) path = joinpath(pkg_dir, destination(p)) text = render_plugin(p) PkgTemplates.gen_file(path, text) @@ -36,4 +35,4 @@ function PkgTemplates.validate(p::CodeOwners, ::Template) '@' ∈ subowner || throw(ArgumentError("Owner name ($subowner) must be `@user` or `email@domain.com`")) end end -end \ No newline at end of file +end diff --git a/src/plugins/documenter.jl b/src/plugins/documenter.jl index 6f032bc9..30abdf5b 100644 --- a/src/plugins/documenter.jl +++ b/src/plugins/documenter.jl @@ -181,7 +181,7 @@ function validate(p::Documenter{T}, t::Template) where T <: YesDeploy end function hook(p::Documenter, t::Template, pkg_dir::AbstractString) - pkg = basename(pkg_dir) + pkg = pkg_name(pkg_dir) docs_dir = joinpath(pkg_dir, "docs") # Generate files. diff --git a/src/plugins/git.jl b/src/plugins/git.jl index cee95f98..326611c3 100644 --- a/src/plugins/git.jl +++ b/src/plugins/git.jl @@ -66,7 +66,7 @@ function prehook(p::Git, t::Template, pkg_dir::AbstractString) end end commit(p, repo, pkg_dir, "Initial commit") - pkg = basename(pkg_dir) + pkg = pkg_name(pkg_dir) suffix = p.jl ? ".jl" : "" url = if p.ssh "git@$(t.host):$(t.user)/$pkg$suffix.git" diff --git a/src/plugins/project_file.jl b/src/plugins/project_file.jl index 8e699cdd..63041414 100644 --- a/src/plugins/project_file.jl +++ b/src/plugins/project_file.jl @@ -15,7 +15,7 @@ priority(::ProjectFile, ::typeof(hook)) = typemax(Int) - 5 function hook(p::ProjectFile, t::Template, pkg_dir::AbstractString) toml = Dict( - "name" => basename(pkg_dir), + "name" => pkg_name(pkg_dir), "uuid" => string(@mock uuid4()), "authors" => t.authors, "version" => string(p.version), diff --git a/src/plugins/src_dir.jl b/src/plugins/src_dir.jl index e6004e08..d5ddbe5b 100644 --- a/src/plugins/src_dir.jl +++ b/src/plugins/src_dir.jl @@ -26,6 +26,6 @@ view(::SrcDir, ::Template, pkg::AbstractString) = Dict("PKG" => pkg) # Update the destination now that we know the package name. # Kind of hacky, but oh well. -function prehook(p::SrcDir, t::Template, pkg_dir::AbstractString) - p.destination = joinpath("src", basename(pkg_dir) * ".jl") +function prehook(p::SrcDir, ::Template, pkg_dir::AbstractString) + p.destination = joinpath("src", pkg_name(pkg_dir) * ".jl") end diff --git a/src/template.jl b/src/template.jl index 39e682bb..603e9960 100644 --- a/src/template.jl +++ b/src/template.jl @@ -124,7 +124,6 @@ end Generate a package named `pkg` from a [`Template`](@ref). """ function (t::Template)(pkg::AbstractString) - endswith(pkg, ".jl") && (pkg = pkg[1:end-3]) pkg_dir = joinpath(t.dir, pkg) ispath(pkg_dir) && throw(ArgumentError("$pkg_dir already exists")) mkpath(pkg_dir) diff --git a/test/plugin.jl b/test/plugin.jl index 682518ce..a0d3cb1d 100644 --- a/test/plugin.jl +++ b/test/plugin.jl @@ -98,4 +98,13 @@ PT.user_view(::FileTest, ::Template, ::AbstractString) = Dict("X" => 1, "Z" => 3 @test isdir(joinpath(pkg_dir, "docs")) end end + + @testset "`pkg_name`" begin + using PkgTemplates: pkg_name + @test pkg_name("foo/bar/Whee.jl") == "Whee" + @test pkg_name("foo/bar/Whee") == "Whee" + @test pkg_name("Whee") == "Whee" + # Only the final suffix is removed---we don't correct for user error + @test pkg_name("Whee.jl.jl") == "Whee.jl" + end end diff --git a/test/reference.jl b/test/reference.jl index db82a6e4..6e94d8bb 100644 --- a/test/reference.jl +++ b/test/reference.jl @@ -70,13 +70,18 @@ end function test_all(pkg::AbstractString; kwargs...) t = tpl(; kwargs...) - with_pkg(t, pkg) do pkg - pkg_dir = joinpath(t.dir, pkg) - PT.hasplugin(t, Documenter) && pin_documenter(joinpath(pkg_dir, "docs")) - foreach(readlines(`git -C $pkg_dir ls-files`)) do f - reference = joinpath(@__DIR__, "fixtures", pkg, f) - comparison = joinpath(pkg_dir, f) - test_reference(reference, comparison) + + # Ensure that the same output is generated (with the exception of the generated directory) + # regardless of whether the user passes in Foo.jl or Foo + for pkg_name in [pkg, pkg * ".jl"] + with_pkg(t, pkg_name) do pkg_name + pkg_dir = joinpath(t.dir, pkg_name) + PT.hasplugin(t, Documenter) && pin_documenter(joinpath(pkg_dir, "docs")) + foreach(readlines(`git -C $pkg_dir ls-files`)) do f + reference = joinpath(@__DIR__, "fixtures", pkg, f) + comparison = joinpath(pkg_dir, f) + test_reference(reference, comparison) + end end end end From 16c0a7352663943e1d6c8768783eed34b6eaa6fd Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Fri, 1 Sep 2023 11:09:33 +0200 Subject: [PATCH 58/66] Remove Manifests from reference tests (#422) * Remove Manifests from reference tests * Only discard test manifest * Compare docs Manifest but not test Manifest * Reduce differences * Fix formatting diff --- .gitignore | 1 + test/fixtures/WackyOptions/test/Manifest.toml | 32 ------------------- test/reference.jl | 9 ++++-- 3 files changed, 7 insertions(+), 35 deletions(-) delete mode 100644 test/fixtures/WackyOptions/test/Manifest.toml diff --git a/.gitignore b/.gitignore index e4cd38a3..448b3b3e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.jl.cov *.jl.mem /Manifest.toml +/test/fixtures/*/test/Manifest.toml \ No newline at end of file diff --git a/test/fixtures/WackyOptions/test/Manifest.toml b/test/fixtures/WackyOptions/test/Manifest.toml deleted file mode 100644 index 189c0f39..00000000 --- a/test/fixtures/WackyOptions/test/Manifest.toml +++ /dev/null @@ -1,32 +0,0 @@ -# This file is machine-generated - editing it directly is not advised - -julia_version = "1.7.2" -manifest_format = "2.0" - -[[deps.Base64]] -uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" - -[[deps.InteractiveUtils]] -deps = ["Markdown"] -uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" - -[[deps.Logging]] -uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" - -[[deps.Markdown]] -deps = ["Base64"] -uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" - -[[deps.Random]] -deps = ["SHA", "Serialization"] -uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" - -[[deps.SHA]] -uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" - -[[deps.Serialization]] -uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" - -[[deps.Test]] -deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] -uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/reference.jl b/test/reference.jl index 6e94d8bb..b7e45ad0 100644 --- a/test/reference.jl +++ b/test/reference.jl @@ -78,9 +78,12 @@ function test_all(pkg::AbstractString; kwargs...) pkg_dir = joinpath(t.dir, pkg_name) PT.hasplugin(t, Documenter) && pin_documenter(joinpath(pkg_dir, "docs")) foreach(readlines(`git -C $pkg_dir ls-files`)) do f - reference = joinpath(@__DIR__, "fixtures", pkg, f) - comparison = joinpath(pkg_dir, f) - test_reference(reference, comparison) + # Don't check test Manifest: versions of dependencies may vary + if !contains(f, joinpath("test", "Manifest.toml")) + reference = joinpath(@__DIR__, "fixtures", pkg, f) + comparison = joinpath(pkg_dir, f) + test_reference(reference, comparison) + end end end end From e11a25b695edf669e94d51ddcdb39320741bdd12 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Fri, 1 Sep 2023 17:11:32 +0200 Subject: [PATCH 59/66] Add Aqua to the Tests plugin (#415) * Add Aqua to the Tests plugin * Fix show tests * Remove begin index in string * Add configurable Aqua kwargs * Add Aqua version * Fix CI on 1.0? * Revert Aqua to versionless --- src/plugins/tests.jl | 95 +++++++++++++++++--- templates/test/runtests.jl | 4 +- test/fixtures/WackyOptions/README.md | 2 +- test/fixtures/WackyOptions/test/Project.toml | 1 + test/fixtures/WackyOptions/test/runtests.jl | 4 + test/reference.jl | 6 +- test/show.jl | 2 + 7 files changed, 98 insertions(+), 16 deletions(-) diff --git a/src/plugins/tests.jl b/src/plugins/tests.jl index 6b21a631..b5a78c81 100644 --- a/src/plugins/tests.jl +++ b/src/plugins/tests.jl @@ -1,16 +1,26 @@ const TEST_UUID = "8dfed614-e22c-5e08-85e1-65c5234f0b40" const TEST_DEP = PackageSpec(; name="Test", uuid=TEST_UUID) +const AQUA_UUID = "4c88cf16-eb10-579e-8560-4a9242c79595" +const AQUA_DEP = PackageSpec(; name="Aqua", uuid=AQUA_UUID) + """ - Tests(; file="$(contractuser(default_file("test", "runtests.jl")))", project=false) + Tests(; + file="$(contractuser(default_file("test", "runtests.jl")))", + project=false, + aqua=false, + aqua_kwargs=NamedTuple(), + ) Sets up testing for packages. ## Keyword Arguments - `file::AbstractString`: Template file for `runtests.jl`. - `project::Bool`: Whether or not to create a new project for tests (`test/Project.toml`). - See [here](https://julialang.github.io/Pkg.jl/v1/creating-packages/#Test-specific-dependencies-in-Julia-1.2-and-above-1) + See [the Pkg docs](https://julialang.github.io/Pkg.jl/v1/creating-packages/#Test-specific-dependencies-in-Julia-1.2-and-above-1) for more details. +- `aqua::Bool`: Controls whether or not to add quality tests with [Aqua.jl](https://github.com/JuliaTesting/Aqua.jl). +- `aqua_kwargs::NamedTuple`: Which keyword arguments to supply to Aqua tests (many people use `ambiguities=false` for example) !!! note Managing test dependencies with `test/Project.toml` is only supported @@ -19,44 +29,105 @@ Sets up testing for packages. @plugin struct Tests <: FilePlugin file::String = default_file("test", "runtests.jl") project::Bool = false + aqua::Bool = false + aqua_kwargs::NamedTuple = NamedTuple() end source(p::Tests) = p.file destination(::Tests) = joinpath("test", "runtests.jl") -view(::Tests, ::Template, pkg::AbstractString) = Dict("PKG" => pkg) + +function view(p::Tests, ::Template, pkg::AbstractString) + d = Dict("PKG" => pkg) + if p.aqua + if isempty(p.aqua_kwargs) + kwargs_str = "" + else + kwargs_str = "; " * strip(string(p.aqua_kwargs), ['(', ')']) + end + d["AQUA_IMPORT"] = "\nusing Aqua" + d["AQUA_TESTSET"] = """ + @testset "Code quality (Aqua.jl)" begin + Aqua.test_all($pkg$kwargs_str) + end + """ + else + d["AQUA_IMPORT"] = "" + d["AQUA_TESTSET"] = "" + end + return d +end function validate(p::Tests, t::Template) - invoke(validate, Tuple{FilePlugin, Template}, p, t) + invoke(validate, Tuple{FilePlugin,Template}, p, t) p.project && t.julia < v"1.2" && @warn string( - "Tests: The project option is set to create a project (supported in Julia 1.2 and later) ", - "but a Julia version older than 1.2 ($(t.julia)) is supported by the template", + "Tests: The project option is set to create a project (supported in Julia 1.2 and later) ", + "but a Julia version older than 1.2 ($(t.julia)) is supported by the template", + ) + aqua_kwargs_names = ( + :ambiguities, + :unbound_args, + :undefined_exports, + :piracy, + :project_extras, + :stale_deps, + :deps_compat, + :project_toml_formatting, ) + for (key, val) in pairs(p.aqua_kwargs) + if !(val isa Bool) + throw(ArgumentError("Aqua keyword arguments must have boolean values")) + elseif !(key in aqua_kwargs_names) + throw(ArgumentError("Aqua keyword arguments must belong to $aqua_kwargnames")) + end + end end function hook(p::Tests, t::Template, pkg_dir::AbstractString) # Do the normal FilePlugin behaviour to create the test script. - invoke(hook, Tuple{FilePlugin, Template, AbstractString}, p, t, pkg_dir) + invoke(hook, Tuple{FilePlugin,Template,AbstractString}, p, t, pkg_dir) # Then set up the test depdendency in the chosen way. - f = p.project ? make_test_project : add_test_dependency - f(pkg_dir) + if p.project + make_test_project(p, pkg_dir) + else + add_test_dependency(p, pkg_dir) + end end # Create a new test project. -function make_test_project(pkg_dir::AbstractString) +function make_test_project(p::Tests, pkg_dir::AbstractString) with_project(() -> Pkg.add(TEST_DEP), joinpath(pkg_dir, "test")) + if p.aqua + with_project(() -> Pkg.add(AQUA_DEP), joinpath(pkg_dir, "test")) + end end # Add Test as a test-only dependency. -function add_test_dependency(pkg_dir::AbstractString) +function add_test_dependency(p::Tests, pkg_dir::AbstractString) # Add the dependency manually since there's no programmatic way to add to [extras]. path = joinpath(pkg_dir, "Project.toml") toml = TOML.parsefile(path) get!(toml, "extras", Dict())["Test"] = TEST_UUID - get!(toml, "targets", Dict())["test"] = ["Test"] + if p.aqua + get!(toml, "extras", Dict())["Aqua"] = AQUA_UUID + end + get!(toml, "targets", Dict())["test"] = p.aqua ? ["Aqua", "Test"] : ["Test"] write_project(path, toml) # Generate the manifest by updating the project. touch(joinpath(pkg_dir, "Manifest.toml")) # File must exist to be modified by Pkg. with_project(Pkg.update, pkg_dir) end + +function badges(p::Tests) + bs = Badge[] + if p.aqua + b = Badge( + "Aqua", + "https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg", + "https://github.com/JuliaTesting/Aqua.jl", + ) + push!(bs, b) + end + return bs +end diff --git a/templates/test/runtests.jl b/templates/test/runtests.jl index 7cc1ecbe..1c9697fc 100644 --- a/templates/test/runtests.jl +++ b/templates/test/runtests.jl @@ -1,6 +1,6 @@ using {{{PKG}}} -using Test +using Test{{{AQUA_IMPORT}}} @testset "{{{PKG}}}.jl" begin - # Write your tests here. + {{{AQUA_TESTSET}}}# Write your tests here. end diff --git a/test/fixtures/WackyOptions/README.md b/test/fixtures/WackyOptions/README.md index 50b5ff57..a9d75957 100644 --- a/test/fixtures/WackyOptions/README.md +++ b/test/fixtures/WackyOptions/README.md @@ -1,4 +1,4 @@ -# WackyOptions [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://tester.github.io/WackyOptions.jl/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.github.io/WackyOptions.jl/dev/) [![Build Status](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml/badge.svg?branch=whackybranch)](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml?query=branch%3Awhackybranch) [![Build Status](https://x.com/tester/WackyOptions.jl/badges/whackybranch/pipeline.svg)](https://x.com/tester/WackyOptions.jl/pipelines) [![Build Status](https://travis-ci.com/tester/WackyOptions.jl.svg?branch=whackybranch)](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://coveralls.io/repos/github/tester/WackyOptions.jl/badge.svg?branch=whackybranch)](https://coveralls.io/github/tester/WackyOptions.jl?branch=whackybranch) [![PkgEval](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/W/WackyOptions.svg)](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/W/WackyOptions.html) +# WackyOptions [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://tester.github.io/WackyOptions.jl/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tester.github.io/WackyOptions.jl/dev/) [![Build Status](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml/badge.svg?branch=whackybranch)](https://github.com/tester/WackyOptions.jl/actions/workflows/CI.yml?query=branch%3Awhackybranch) [![Build Status](https://x.com/tester/WackyOptions.jl/badges/whackybranch/pipeline.svg)](https://x.com/tester/WackyOptions.jl/pipelines) [![Build Status](https://travis-ci.com/tester/WackyOptions.jl.svg?branch=whackybranch)](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://coveralls.io/repos/github/tester/WackyOptions.jl/badge.svg?branch=whackybranch)](https://coveralls.io/github/tester/WackyOptions.jl?branch=whackybranch) [![PkgEval](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/W/WackyOptions.svg)](https://JuliaCI.github.io/NanosoldierReports/pkgeval_badges/W/WackyOptions.html) [![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl) ## Citing diff --git a/test/fixtures/WackyOptions/test/Project.toml b/test/fixtures/WackyOptions/test/Project.toml index 0c363327..b35b5edd 100644 --- a/test/fixtures/WackyOptions/test/Project.toml +++ b/test/fixtures/WackyOptions/test/Project.toml @@ -1,2 +1,3 @@ [deps] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/fixtures/WackyOptions/test/runtests.jl b/test/fixtures/WackyOptions/test/runtests.jl index 730cd5aa..d4e55b5c 100644 --- a/test/fixtures/WackyOptions/test/runtests.jl +++ b/test/fixtures/WackyOptions/test/runtests.jl @@ -1,6 +1,10 @@ using WackyOptions using Test +using Aqua @testset "WackyOptions.jl" begin + @testset "Code quality (Aqua.jl)" begin + Aqua.test_all(WackyOptions; ambiguities = false, unbound_args = true) + end # Write your tests here. end diff --git a/test/reference.jl b/test/reference.jl index b7e45ad0..dd4acc4d 100644 --- a/test/reference.jl +++ b/test/reference.jl @@ -175,7 +175,11 @@ end dispatch=true, dispatch_delay=20, ), - Tests(; project=true), + Tests(; + project=true, + aqua=true, + aqua_kwargs=(; ambiguities=false, unbound_args=true), + ), TravisCI(; coverage=false, windows=false, diff --git a/test/show.jl b/test/show.jl index 1154ae52..47c3bcb6 100644 --- a/test/show.jl +++ b/test/show.jl @@ -88,6 +88,8 @@ end Tests: file: "$(joinpath(TEMPLATES_DIR, "test", "runtests.jl"))" project: false + aqua: false + aqua_kwargs: NamedTuple() """ # `with_clean_gitconfig` requires Git to be installed, but if Git is not installed, # then we probably don't need to worry about any conflicting Git config files. From c6df058891d8c557946b1e7dc4b53e632f4abff5 Mon Sep 17 00:00:00 2001 From: Nick Robinson Date: Fri, 1 Sep 2023 17:54:20 +0100 Subject: [PATCH 60/66] Update version in Project.toml (#424) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 72bed032..7e925cf1 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.41" +version = "0.7.42" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From f62c304f976e4712137ab1108c75411c61e88844 Mon Sep 17 00:00:00 2001 From: cossio Date: Sat, 2 Sep 2023 16:02:48 +0200 Subject: [PATCH 61/66] Don't create empty Manifest.toml (v2) (#425) * manifest * bump version --- Project.toml | 2 +- src/plugins/tests.jl | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 7e925cf1..f01c7a1e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.42" +version = "0.7.43" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/plugins/tests.jl b/src/plugins/tests.jl index b5a78c81..b54d3c1e 100644 --- a/src/plugins/tests.jl +++ b/src/plugins/tests.jl @@ -19,7 +19,7 @@ Sets up testing for packages. - `project::Bool`: Whether or not to create a new project for tests (`test/Project.toml`). See [the Pkg docs](https://julialang.github.io/Pkg.jl/v1/creating-packages/#Test-specific-dependencies-in-Julia-1.2-and-above-1) for more details. -- `aqua::Bool`: Controls whether or not to add quality tests with [Aqua.jl](https://github.com/JuliaTesting/Aqua.jl). +- `aqua::Bool`: Controls whether or not to add quality tests with [Aqua.jl](https://github.com/JuliaTesting/Aqua.jl). - `aqua_kwargs::NamedTuple`: Which keyword arguments to supply to Aqua tests (many people use `ambiguities=false` for example) !!! note @@ -115,7 +115,6 @@ function add_test_dependency(p::Tests, pkg_dir::AbstractString) write_project(path, toml) # Generate the manifest by updating the project. - touch(joinpath(pkg_dir, "Manifest.toml")) # File must exist to be modified by Pkg. with_project(Pkg.update, pkg_dir) end From 367c3693f2c11490d74dc8ff30219cb43bc6505a Mon Sep 17 00:00:00 2001 From: cossio Date: Sun, 3 Sep 2023 13:00:39 +0200 Subject: [PATCH 62/66] Don't create empty Manifest.toml (again) (#426) * manifest2 * bump version * should fix ref test --- Project.toml | 2 +- src/plugins/git.jl | 1 - test/fixtures/WackyOptions/Manifest.toml | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index f01c7a1e..5513647e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.43" +version = "0.7.44" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/plugins/git.jl b/src/plugins/git.jl index 326611c3..69d92a65 100644 --- a/src/plugins/git.jl +++ b/src/plugins/git.jl @@ -103,7 +103,6 @@ function posthook(p::Git, ::Template, pkg_dir::AbstractString) # Ensure that the manifest exists if it's going to be committed. manifest = joinpath(pkg_dir, "Manifest.toml") if p.manifest && !isfile(manifest) - touch(manifest) with_project(Pkg.update, pkg_dir) end diff --git a/test/fixtures/WackyOptions/Manifest.toml b/test/fixtures/WackyOptions/Manifest.toml index f45eecff..03876ef5 100644 --- a/test/fixtures/WackyOptions/Manifest.toml +++ b/test/fixtures/WackyOptions/Manifest.toml @@ -1,2 +1,6 @@ # This file is machine-generated - editing it directly is not advised +julia_version = "1.7.2" +manifest_format = "2.0" + +[deps] From 9fc9e9af82e618dd2adbf810fcc0b36e0a08d103 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 13:57:24 +0000 Subject: [PATCH 63/66] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/CI.yml | 4 ++-- .github/workflows/JuliaNightly.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c618687d..4443b99e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -45,7 +45,7 @@ jobs: version: 1.7.2 arch: x64 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} @@ -91,7 +91,7 @@ jobs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: '1' diff --git a/.github/workflows/JuliaNightly.yml b/.github/workflows/JuliaNightly.yml index f56d39e9..cdc29ff9 100644 --- a/.github/workflows/JuliaNightly.yml +++ b/.github/workflows/JuliaNightly.yml @@ -8,7 +8,7 @@ jobs: name: Julia Nightly - Ubuntu - x64 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: nightly From cd21de562e7e9f7e64d24f3b949b3303d28708b5 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 8 Sep 2023 15:03:35 -0300 Subject: [PATCH 64/66] Add workflow_dispatch trigger to CI template --- templates/github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/github/workflows/CI.yml b/templates/github/workflows/CI.yml index 38b172ea..b83f3a13 100644 --- a/templates/github/workflows/CI.yml +++ b/templates/github/workflows/CI.yml @@ -7,6 +7,7 @@ on: <> tags: ['*'] pull_request: + workflow_dispatch: concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. From f764a8c76983dc56e63f5069bfbf20a810fd491e Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 8 Sep 2023 15:28:28 -0300 Subject: [PATCH 65/66] Update test fixtures --- test/fixtures/AllPlugins/.github/workflows/CI.yml | 1 + test/fixtures/Basic/.github/workflows/CI.yml | 1 + test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml | 1 + test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml | 1 + test/fixtures/DocumenterTravis/.github/workflows/CI.yml | 1 + test/fixtures/WackyOptions/.github/workflows/CI.yml | 1 + 6 files changed, 6 insertions(+) diff --git a/test/fixtures/AllPlugins/.github/workflows/CI.yml b/test/fixtures/AllPlugins/.github/workflows/CI.yml index fdfb2a92..8d0bd7d9 100644 --- a/test/fixtures/AllPlugins/.github/workflows/CI.yml +++ b/test/fixtures/AllPlugins/.github/workflows/CI.yml @@ -5,6 +5,7 @@ on: - main tags: ['*'] pull_request: + workflow_dispatch: concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. diff --git a/test/fixtures/Basic/.github/workflows/CI.yml b/test/fixtures/Basic/.github/workflows/CI.yml index 3833ee10..10203d74 100644 --- a/test/fixtures/Basic/.github/workflows/CI.yml +++ b/test/fixtures/Basic/.github/workflows/CI.yml @@ -5,6 +5,7 @@ on: - main tags: ['*'] pull_request: + workflow_dispatch: concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. diff --git a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml index e4337fe1..6daf88dd 100644 --- a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml +++ b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml @@ -5,6 +5,7 @@ on: - main tags: ['*'] pull_request: + workflow_dispatch: concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. diff --git a/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml b/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml index 3833ee10..10203d74 100644 --- a/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml +++ b/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml @@ -5,6 +5,7 @@ on: - main tags: ['*'] pull_request: + workflow_dispatch: concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. diff --git a/test/fixtures/DocumenterTravis/.github/workflows/CI.yml b/test/fixtures/DocumenterTravis/.github/workflows/CI.yml index 3833ee10..10203d74 100644 --- a/test/fixtures/DocumenterTravis/.github/workflows/CI.yml +++ b/test/fixtures/DocumenterTravis/.github/workflows/CI.yml @@ -5,6 +5,7 @@ on: - main tags: ['*'] pull_request: + workflow_dispatch: concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. diff --git a/test/fixtures/WackyOptions/.github/workflows/CI.yml b/test/fixtures/WackyOptions/.github/workflows/CI.yml index f3d4ee01..2e28d05d 100644 --- a/test/fixtures/WackyOptions/.github/workflows/CI.yml +++ b/test/fixtures/WackyOptions/.github/workflows/CI.yml @@ -5,6 +5,7 @@ on: - whackybranch tags: ['*'] pull_request: + workflow_dispatch: concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. From 774f9fdf876509dee8ce62e31f777ccd11630179 Mon Sep 17 00:00:00 2001 From: Frames White Date: Tue, 12 Sep 2023 17:16:51 +0800 Subject: [PATCH 66/66] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 5513647e..f38e814c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PkgTemplates" uuid = "14b8a8f1-9102-5b29-a752-f990bacb7fe1" authors = ["Chris de Graaf", "Invenia Technical Computing Corporation"] -version = "0.7.44" +version = "0.7.45" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"