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"
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 33f0115a..4443b99e 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -36,17 +36,21 @@ 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
+ - uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- - uses: actions/cache@v2
+ - uses: actions/cache@v3
env:
cache-name: cache-artifacts
with:
@@ -63,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
@@ -73,8 +77,8 @@ jobs:
runs-on: ubuntu-latest
if: always() && github.event_name == 'schedule'
steps:
- - uses: technote-space/workflow-conclusion-action@v2
- - uses: voxmedia/github-action-slack-notify-build@v1
+ - uses: technote-space/workflow-conclusion-action@v3
+ - uses: voxmedia/github-action-slack-notify-build@v2
if: env.WORKFLOW_CONCLUSION == 'failure'
with:
channel: nightly-dev
@@ -87,7 +91,7 @@ jobs:
name: Documentation
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: '1'
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/.github/workflows/JuliaNightly.yml b/.github/workflows/JuliaNightly.yml
index f521f610..cdc29ff9 100644
--- a/.github/workflows/JuliaNightly.yml
+++ b/.github/workflows/JuliaNightly.yml
@@ -8,12 +8,12 @@ jobs:
name: Julia Nightly - Ubuntu - x64
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: nightly
arch: x64
- - uses: actions/cache@v2
+ - uses: actions/cache@v3
env:
cache-name: julia-nightly-cache-artifacts
with:
@@ -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/.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/Project.toml b/Project.toml
index 59ee3cf3..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.26"
+version = "0.7.45"
[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
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..a6149d23 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).
@@ -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`.
@@ -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.
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..b8582df3 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
@@ -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
```
@@ -85,6 +85,7 @@ PkgEvalBadge
### Miscellaneous
```@docs
+Dependabot
Develop
Citation
RegisterAction
@@ -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 83dea55f..b400d293 100644
--- a/src/PkgTemplates.jl
+++ b/src/PkgTemplates.jl
@@ -22,12 +22,15 @@ export
CirrusCI,
Citation,
Codecov,
+ CodeOwners,
ColPracBadge,
CompatHelper,
Coveralls,
+ Dependabot,
Develop,
Documenter,
DroneCI,
+ Formatter,
Git,
GitHubActions,
GitLabCI,
diff --git a/src/interactive.jl b/src/interactive.jl
index f32c5189..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
@@ -92,6 +95,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')
@@ -109,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
@@ -119,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/plugin.jl b/src/plugin.jl
index c6c6eed4..ba5b0c1d 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
@@ -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)
@@ -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,
@@ -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"))
@@ -355,9 +367,12 @@ 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"))
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/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
diff --git a/src/plugins/codeowners.jl b/src/plugins/codeowners.jl
new file mode 100644
index 00000000..44244f8d
--- /dev/null
+++ b/src/plugins/codeowners.jl
@@ -0,0 +1,38 @@
+"""
+ CodeOwners <: Plugin
+ 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.
+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, ::Template, pkg_dir::AbstractString)
+ 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"))
+ '@' ∈ subowner || throw(ArgumentError("Owner name ($subowner) must be `@user` or `email@domain.com`"))
+ end
+ end
+end
diff --git a/src/plugins/dependabot.jl b/src/plugins/dependabot.jl
new file mode 100644
index 00000000..89ef73dc
--- /dev/null
+++ b/src/plugins/dependabot.jl
@@ -0,0 +1,23 @@
+"""
+ 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.
+
+!!! 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`.
+"""
+@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/plugins/documenter.jl b/src/plugins/documenter.jl
index 2f321659..30abdf5b 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,8 +109,9 @@ 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/"]
+gitignore(::Documenter) = ["/docs/build/", "/docs/Manifest.toml"]
priority(::Documenter, ::Function) = DEFAULT_PRIORITY - 1 # We need SrcDir to go first.
badges(::Documenter) = Badge[]
@@ -108,12 +119,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(
@@ -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)
@@ -162,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.
@@ -213,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/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/src/plugins/git.jl b/src/plugins/git.jl
index cee95f98..69d92a65 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"
@@ -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/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/src/plugins/project_file.jl b/src/plugins/project_file.jl
index 06be5a92..63041414 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.
@@ -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/plugins/tests.jl b/src/plugins/tests.jl
index 6b21a631..b54d3c1e 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,104 @@ 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/src/template.jl b/src/template.jl
index cd5eebd5..603e9960 100644
--- a/src/template.jl
+++ b/src/template.jl
@@ -9,6 +9,7 @@ default_plugins() = [
Readme(),
Tests(),
TagBot(),
+ GitHubActions(),
]
function default_authors()
@@ -92,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
@@ -120,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)
@@ -184,7 +187,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:")
@@ -217,7 +220,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/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/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/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/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/templates/github/workflows/CI.yml b/templates/github/workflows/CI.yml
index 87c3fc99..b83f3a13 100644
--- a/templates/github/workflows/CI.yml
+++ b/templates/github/workflows/CI.yml
@@ -5,8 +5,9 @@ on:
<<#BRANCH>>
- <>
<>
- tags: '*'
+ tags: ['*']
pull_request:
+ workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
@@ -42,7 +43,7 @@ jobs:
<>
<>
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
@@ -52,7 +53,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
<>
@@ -65,16 +66,24 @@ jobs:
docs:
name: Documentation
runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ statuses: write
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- 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:
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/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}}}'
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/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/.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/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/AllPlugins/.github/workflows/CI.yml b/test/fixtures/AllPlugins/.github/workflows/CI.yml
index 45988a26..8d0bd7d9 100644
--- a/test/fixtures/AllPlugins/.github/workflows/CI.yml
+++ b/test/fixtures/AllPlugins/.github/workflows/CI.yml
@@ -3,8 +3,9 @@ on:
push:
branches:
- main
- tags: '*'
+ tags: ['*']
pull_request:
+ workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
@@ -26,7 +27,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 +36,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/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/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/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/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/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/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/AllPlugins/docs/Manifest.toml b/test/fixtures/AllPlugins/docs/Manifest.toml
index 7a63bf23..40d6234b 100644
--- a/test/fixtures/AllPlugins/docs/Manifest.toml
+++ b/test/fixtures/AllPlugins/docs/Manifest.toml
@@ -1,12 +1,12 @@
# 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]]
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/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/Basic/.github/workflows/CI.yml b/test/fixtures/Basic/.github/workflows/CI.yml
new file mode 100644
index 00000000..10203d74
--- /dev/null
+++ b/test/fixtures/Basic/.github/workflows/CI.yml
@@ -0,0 +1,37 @@
+name: CI
+on:
+ push:
+ branches:
+ - main
+ tags: ['*']
+ pull_request:
+ workflow_dispatch:
+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@v3
+ - 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/.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/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/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/DocumenterGitHubActions/.github/workflows/CI.yml b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml
index 71432e3d..6daf88dd 100644
--- a/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml
+++ b/test/fixtures/DocumenterGitHubActions/.github/workflows/CI.yml
@@ -3,8 +3,9 @@ on:
push:
branches:
- main
- tags: '*'
+ tags: ['*']
pull_request:
+ workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
@@ -26,7 +27,7 @@ jobs:
arch:
- x64
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
@@ -37,16 +38,24 @@ jobs:
docs:
name: Documentation
runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ statuses: write
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- 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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
- run: |
julia --project=docs -e '
using Documenter: DocMeta, doctest
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/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/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/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/DocumenterGitHubActions/docs/Manifest.toml b/test/fixtures/DocumenterGitHubActions/docs/Manifest.toml
index d7ad9b76..cc06abd8 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]]
@@ -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/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/.github/workflows/CI.yml b/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml
new file mode 100644
index 00000000..10203d74
--- /dev/null
+++ b/test/fixtures/DocumenterGitLabCI/.github/workflows/CI.yml
@@ -0,0 +1,37 @@
+name: CI
+on:
+ push:
+ branches:
+ - main
+ tags: ['*']
+ pull_request:
+ workflow_dispatch:
+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@v3
+ - 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/.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/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/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/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/DocumenterGitLabCI/docs/Manifest.toml b/test/fixtures/DocumenterGitLabCI/docs/Manifest.toml
index 2a044a0f..4f4f5145 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]]
@@ -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/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/.github/workflows/CI.yml b/test/fixtures/DocumenterTravis/.github/workflows/CI.yml
new file mode 100644
index 00000000..10203d74
--- /dev/null
+++ b/test/fixtures/DocumenterTravis/.github/workflows/CI.yml
@@ -0,0 +1,37 @@
+name: CI
+on:
+ push:
+ branches:
+ - main
+ tags: ['*']
+ pull_request:
+ workflow_dispatch:
+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@v3
+ - 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/.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/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/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/fixtures/DocumenterTravis/README.md b/test/fixtures/DocumenterTravis/README.md
index db585260..36b63906 100644
--- a/test/fixtures/DocumenterTravis/README.md
+++ b/test/fixtures/DocumenterTravis/README.md
@@ -1,5 +1,6 @@
# 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://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/fixtures/DocumenterTravis/docs/Manifest.toml b/test/fixtures/DocumenterTravis/docs/Manifest.toml
index b8a9d965..a0b1e090 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]]
@@ -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"]
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/.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/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"
diff --git a/test/fixtures/WackyOptions/.github/workflows/CI.yml b/test/fixtures/WackyOptions/.github/workflows/CI.yml
index 5ff3c09d..2e28d05d 100644
--- a/test/fixtures/WackyOptions/.github/workflows/CI.yml
+++ b/test/fixtures/WackyOptions/.github/workflows/CI.yml
@@ -3,8 +3,9 @@ on:
push:
branches:
- whackybranch
- tags: '*'
+ tags: ['*']
pull_request:
+ workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
@@ -26,7 +27,7 @@ jobs:
- x64
- x86
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
@@ -37,16 +38,24 @@ jobs:
docs:
name: Documentation
runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ statuses: write
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- 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:
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:
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'
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
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}
}
diff --git a/test/fixtures/WackyOptions/CODEOWNERS b/test/fixtures/WackyOptions/CODEOWNERS
new file mode 100644
index 00000000..cd3588c0
--- /dev/null
+++ b/test/fixtures/WackyOptions/CODEOWNERS
@@ -0,0 +1,2 @@
+* @user
+README.md @group user@example.com
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]
diff --git a/test/fixtures/WackyOptions/README.md b/test/fixtures/WackyOptions/README.md
index 40276427..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/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) [![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
## Citing
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/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/fixtures/WackyOptions/test/Manifest.toml b/test/fixtures/WackyOptions/test/Manifest.toml
deleted file mode 100644
index e07c83f5..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.1"
-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/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/interactive.jl b/test/interactive.jl
index e7e30b42..2769eb15 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
@@ -130,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(;
@@ -169,10 +172,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/plugin.jl b/test/plugin.jl
index 68dee38c..a0d3cb1d 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])
@@ -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 69bcc8ed..dd4acc4d 100644
--- a/test/reference.jl
+++ b/test/reference.jl
@@ -70,13 +70,21 @@ 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
+ # 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
end
@@ -88,8 +96,22 @@ end
@testset "All plugins" begin
test_all("AllPlugins"; authors=USER, plugins=[
- AppVeyor(), CirrusCI(), Citation(), Codecov(), CompatHelper(), Coveralls(),
- Develop(), Documenter(), DroneCI(), GitHubActions(), GitLabCI(), TravisCI(), RegisterAction(),
+ AppVeyor(),
+ CirrusCI(),
+ Citation(),
+ CodeOwners(),
+ Codecov(),
+ CompatHelper(),
+ Coveralls(),
+ Dependabot(),
+ Develop(),
+ Documenter(),
+ DroneCI(),
+ Formatter(),
+ GitHubActions(),
+ GitLabCI(),
+ RegisterAction(),
+ TravisCI(),
])
end
@@ -117,16 +139,20 @@ end
CirrusCI(; image="freebsd-123", coverage=false, extra_versions=["1.3"]),
Citation(; readme=true),
Codecov(; file=STATIC_TXT),
+ 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),
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"]),
+ 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"]),
@@ -149,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/runtests.jl b/test/runtests.jl
index e44a2af2..cfa6b0ed 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
@@ -94,15 +94,24 @@ 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 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
@@ -78,7 +89,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) = ""