diff --git a/Project.toml b/Project.toml index 6dda7af..2cfe698 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ITensorPkgSkeleton" uuid = "3d388ab1-018a-49f4-ae50-18094d5f71ea" authors = ["ITensor developers and contributors"] -version = "0.3.21" +version = "0.3.22" [deps] DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" diff --git a/README.md b/README.md index fb8532c..aad6508 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,11 @@ This step is only required once. ```julia julia> using Pkg: Pkg -julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry") +julia> Pkg.Registry.add(url = "https://github.com/ITensor/ITensorRegistry") ``` or: ```julia -julia> Pkg.Registry.add(url="git@github.com:ITensor/ITensorRegistry.git") +julia> Pkg.Registry.add(url = "git@github.com:ITensor/ITensorRegistry.git") ``` if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages. diff --git a/examples/README.jl b/examples/README.jl index b665edf..138faa7 100644 --- a/examples/README.jl +++ b/examples/README.jl @@ -22,13 +22,13 @@ ```julia julia> using Pkg: Pkg -julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry") +julia> Pkg.Registry.add(url = "https://github.com/ITensor/ITensorRegistry") ``` =# # or: #= ```julia -julia> Pkg.Registry.add(url="git@github.com:ITensor/ITensorRegistry.git") +julia> Pkg.Registry.add(url = "git@github.com:ITensor/ITensorRegistry.git") ``` =# # if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages. diff --git a/src/ITensorPkgSkeleton.jl b/src/ITensorPkgSkeleton.jl index a2aee3e..2e75eef 100644 --- a/src/ITensorPkgSkeleton.jl +++ b/src/ITensorPkgSkeleton.jl @@ -155,11 +155,11 @@ function pkg_registration_message(; pkgname, path) ```julia julia> using Pkg: Pkg - julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry") + julia> Pkg.Registry.add(url = "https://github.com/ITensor/ITensorRegistry") ``` or: ```julia - julia> Pkg.Registry.add(url="git@github.com:ITensor/ITensorRegistry.git") + julia> Pkg.Registry.add(url = "git@github.com:ITensor/ITensorRegistry.git") ``` if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages. diff --git a/templates/docs/README.md b/templates/docs/README.md index fe20209..598090c 100644 --- a/templates/docs/README.md +++ b/templates/docs/README.md @@ -25,11 +25,11 @@ This step is only required once. ```julia julia> using Pkg: Pkg -julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry") +julia> Pkg.Registry.add(url = "https://github.com/ITensor/ITensorRegistry") ``` or: ```julia -julia> Pkg.Registry.add(url="git@github.com:ITensor/ITensorRegistry.git") +julia> Pkg.Registry.add(url = "git@github.com:ITensor/ITensorRegistry.git") ``` if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages. diff --git a/templates/test/test/runtests.jl b/templates/test/test/runtests.jl index 0008050..2124a45 100644 --- a/templates/test/test/runtests.jl +++ b/templates/test/test/runtests.jl @@ -7,29 +7,32 @@ const pat = r"(?:--group=)(\w+)" arg_id = findfirst(contains(pat), ARGS) const GROUP = uppercase( if isnothing(arg_id) - get(ENV, "GROUP", "ALL") + arg = get(ENV, "GROUP", "ALL") + # For some reason `ENV["GROUP"]` is set to `""` + # when running via GitHub Actions, so handle that case: + arg == "" ? "ALL" : arg else only(match(pat, ARGS[arg_id]).captures) end, ) "match files of the form `test_*.jl`, but exclude `*setup*.jl`" -function istestfile(fn) +function istestfile(path) + fn = basename(path) return endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup") end "match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`" -function isexamplefile(fn) +function isexamplefile(path) + fn = basename(path) return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup") end @time begin # tests in groups based on folder structure - for testgroup in filter(isdir, readdir(@__DIR__)) - if GROUP == "ALL" || GROUP == uppercase(testgroup) - groupdir = joinpath(@__DIR__, testgroup) - for file in filter(istestfile, readdir(groupdir)) - filename = joinpath(groupdir, file) - @eval @safetestset $file begin + for testgroup in filter(isdir, readdir(@__DIR__; join = true)) + if GROUP == "ALL" || GROUP == uppercase(basename(testgroup)) + for filename in filter(istestfile, readdir(testgroup; join = true)) + @eval @safetestset $(basename(filename)) begin include($filename) end end @@ -37,9 +40,9 @@ end end # single files in top folder - for file in filter(istestfile, readdir(@__DIR__)) - (file == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion - @eval @safetestset $file begin + for file in filter(istestfile, readdir(@__DIR__; join = true)) + (basename(file) == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion + @eval @safetestset $(basename(file)) begin include($file) end end diff --git a/test/test_basics.jl b/test/basics/test_basics.jl similarity index 100% rename from test/test_basics.jl rename to test/basics/test_basics.jl diff --git a/test/runtests.jl b/test/runtests.jl index 0008050..2124a45 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -7,29 +7,32 @@ const pat = r"(?:--group=)(\w+)" arg_id = findfirst(contains(pat), ARGS) const GROUP = uppercase( if isnothing(arg_id) - get(ENV, "GROUP", "ALL") + arg = get(ENV, "GROUP", "ALL") + # For some reason `ENV["GROUP"]` is set to `""` + # when running via GitHub Actions, so handle that case: + arg == "" ? "ALL" : arg else only(match(pat, ARGS[arg_id]).captures) end, ) "match files of the form `test_*.jl`, but exclude `*setup*.jl`" -function istestfile(fn) +function istestfile(path) + fn = basename(path) return endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup") end "match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`" -function isexamplefile(fn) +function isexamplefile(path) + fn = basename(path) return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup") end @time begin # tests in groups based on folder structure - for testgroup in filter(isdir, readdir(@__DIR__)) - if GROUP == "ALL" || GROUP == uppercase(testgroup) - groupdir = joinpath(@__DIR__, testgroup) - for file in filter(istestfile, readdir(groupdir)) - filename = joinpath(groupdir, file) - @eval @safetestset $file begin + for testgroup in filter(isdir, readdir(@__DIR__; join = true)) + if GROUP == "ALL" || GROUP == uppercase(basename(testgroup)) + for filename in filter(istestfile, readdir(testgroup; join = true)) + @eval @safetestset $(basename(filename)) begin include($filename) end end @@ -37,9 +40,9 @@ end end # single files in top folder - for file in filter(istestfile, readdir(@__DIR__)) - (file == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion - @eval @safetestset $file begin + for file in filter(istestfile, readdir(@__DIR__; join = true)) + (basename(file) == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion + @eval @safetestset $(basename(file)) begin include($file) end end