More reference tests, fix a bug or two
This commit is contained in:
parent
c8bc144653
commit
439ad33513
@ -114,7 +114,7 @@ badges(::CirrusCI) = Badge(
|
||||
"https://cirrus-ci.com/github/{{USER}}/{{PKG}}.jl",
|
||||
)
|
||||
|
||||
function view(p::CirrusCI, t::Template, ::AbstractString)
|
||||
function view(p::CirrusCI, t::Template, pkg::AbstractString)
|
||||
return Dict(
|
||||
"HAS_CODECOV" => hasplugin(t, Codecov),
|
||||
"HAS_COVERALLS" => hasplugin(t, Coveralls),
|
||||
@ -135,7 +135,7 @@ end
|
||||
|
||||
gitignore(p::GitLabCI) = p.coverage ? COVERAGE_GITIGNORE : String[]
|
||||
|
||||
source(p::GitLabCI) = p.source
|
||||
source(p::GitLabCI) = p.file
|
||||
destination(::GitLabCI) = ".gitlab-ci.yml"
|
||||
|
||||
function badges(p::GitLabCI)
|
||||
@ -152,7 +152,7 @@ function badges(p::GitLabCI)
|
||||
return p.coverage ? [ci, cov] : [ci]
|
||||
end
|
||||
|
||||
function view(p::GitLabCI, t::Template, ::AbstractString)
|
||||
function view(p::GitLabCI, t::Template, pkg::AbstractString)
|
||||
return Dict(
|
||||
"HAS_COVERAGE" => p.coverage,
|
||||
"HAS_DOCUMENTER" => hasplugin(t, Documenter{GitLabCI}),
|
||||
|
@ -83,6 +83,7 @@ function view(p::Documenter{TravisCI}, t::Template, pkg::AbstractString)
|
||||
end
|
||||
|
||||
function gen_plugin(p::Documenter, t::Template, pkg_dir::AbstractString)
|
||||
pkg = basename(pkg_dir)
|
||||
docs_dir = joinpath(pkg_dir, "docs")
|
||||
|
||||
# Generate files.
|
||||
|
31
test/fixtures/AllPlugins/.appveyor.yml.txt
vendored
Normal file
31
test/fixtures/AllPlugins/.appveyor.yml.txt
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
# Documentation: https://github.com/JuliaCI/Appveyor.jl
|
||||
environment:
|
||||
matrix:
|
||||
- julia_version: 1.0
|
||||
- julia_version: 1.2
|
||||
- julia_version: nightly
|
||||
platform:
|
||||
- x64
|
||||
matrix:
|
||||
allow_failures:
|
||||
- julia_version: nightly
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /release-.*/
|
||||
notifications:
|
||||
- provider: Email
|
||||
on_build_success: false
|
||||
on_build_failure: false
|
||||
on_build_status_changed: false
|
||||
install:
|
||||
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))
|
||||
build_script:
|
||||
- echo "%JL_BUILD_SCRIPT%"
|
||||
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"
|
||||
test_script:
|
||||
- echo "%JL_TEST_SCRIPT%"
|
||||
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
|
||||
on_success:
|
||||
- echo "%JL_CODECOV_SCRIPT%"
|
||||
- C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%"
|
16
test/fixtures/AllPlugins/.cirrus.yml.txt
vendored
Normal file
16
test/fixtures/AllPlugins/.cirrus.yml.txt
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
freebsd_instance:
|
||||
image: freebsd-12-0-release-amd64
|
||||
task:
|
||||
name: FreeBSD
|
||||
env:
|
||||
JULIA_VERSION: 1.0
|
||||
JULIA_VERSION: 1.2
|
||||
JULIA_VERSION: nightly
|
||||
install_script:
|
||||
- sh -c "$(fetch https://raw.githubusercontent.com/ararslan/CirrusCI.jl/master/bin/install.sh -o -)"
|
||||
build_script:
|
||||
- cirrusjl build
|
||||
test_script:
|
||||
- cirrusjl test
|
||||
coverage_script:
|
||||
- cirrusjl coverage codecov coveralls
|
7
test/fixtures/AllPlugins/.gitignore.txt
vendored
Normal file
7
test/fixtures/AllPlugins/.gitignore.txt
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
*.jl.*.cov
|
||||
*.jl.cov
|
||||
*.jl.mem
|
||||
.DS_Store
|
||||
/dev/
|
||||
/docs/build/
|
||||
/docs/site/
|
15
test/fixtures/AllPlugins/.gitlab-ci.yml.txt
vendored
Normal file
15
test/fixtures/AllPlugins/.gitlab-ci.yml.txt
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
Julia 1.0:
|
||||
image: julia:1.0
|
||||
script: julia --project=@. -e '
|
||||
using Pkg
|
||||
Pkg.build()
|
||||
Pkg.test(coverage=true)'
|
||||
coverage: /Test Coverage (\d+\.\d+%)/
|
||||
after_script:
|
||||
- julia -e '
|
||||
using Pkg
|
||||
Pkg.add("Coverage")
|
||||
using Coverage
|
||||
c, t = get_summary(process_folder())
|
||||
using Printf
|
||||
@printf "Test Coverage %.2f%%\n" 100c/t'
|
27
test/fixtures/AllPlugins/.travis.yml.txt
vendored
Normal file
27
test/fixtures/AllPlugins/.travis.yml.txt
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
# Documentation: http://docs.travis-ci.com/user/languages/julia
|
||||
language: julia
|
||||
notifications:
|
||||
email: false
|
||||
julia:
|
||||
- 1.0
|
||||
- 1.2
|
||||
- nightly
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
- windows
|
||||
jobs:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- julia: nightly
|
||||
after_success:
|
||||
- julia -e '
|
||||
using Pkg;
|
||||
Pkg.add("Coverage");
|
||||
using Coverage;
|
||||
Codecov.submit(process_folder());'
|
||||
- julia -e '
|
||||
using Pkg;
|
||||
Pkg.add("Coverage");
|
||||
using Coverage;
|
||||
Coveralls.submit(process_folder());'
|
8
test/fixtures/AllPlugins/CITATION.bib.txt
vendored
Normal file
8
test/fixtures/AllPlugins/CITATION.bib.txt
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
@misc{AllPlugins.jl,
|
||||
author = {tester},
|
||||
title = {AllPlugins.jl},
|
||||
url = {https://github.com/tester/AllPlugins.jl},
|
||||
version = {v0.1.0},
|
||||
year = {2019},
|
||||
month = {8}
|
||||
}
|
19
test/fixtures/AllPlugins/LICENSE.txt
vendored
Normal file
19
test/fixtures/AllPlugins/LICENSE.txt
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2019 tester
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
2
test/fixtures/AllPlugins/Manifest.toml.txt
vendored
Normal file
2
test/fixtures/AllPlugins/Manifest.toml.txt
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# This file is machine-generated - editing it directly is not advised
|
||||
|
13
test/fixtures/AllPlugins/Project.toml.txt
vendored
Normal file
13
test/fixtures/AllPlugins/Project.toml.txt
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
name = "AllPlugins"
|
||||
uuid = "5b7e9947-ddc0-4b3f-9b55-0d8042f74170"
|
||||
authors = ["tester"]
|
||||
version = "0.1.0"
|
||||
|
||||
[compat]
|
||||
julia = "1"
|
||||
|
||||
[extras]
|
||||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
||||
|
||||
[targets]
|
||||
test = ["Test"]
|
13
test/fixtures/AllPlugins/README.md.txt
vendored
Normal file
13
test/fixtures/AllPlugins/README.md.txt
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# AllPlugins
|
||||
|
||||
[](https://travis-ci.com/tester/AllPlugins.jl)
|
||||
[](https://ci.appveyor.com/project/tester/AllPlugins-jl)
|
||||
[](https://gitlab.com/tester/AllPlugins.jl/pipelines)
|
||||
[](https://gitlab.com/tester/AllPlugins.jl/commits/master)
|
||||
[](https://cirrus-ci.com/github/tester/AllPlugins.jl)
|
||||
[](https://codecov.io/gh//.jl)
|
||||
[](https://coveralls.io/github//.jl?branch=master)
|
||||
|
||||
## Citing
|
||||
|
||||
See [`CITATION.bib`](CITATION.bib) for the relevant reference(s).
|
89
test/fixtures/AllPlugins/docs/Manifest.toml.txt
vendored
Normal file
89
test/fixtures/AllPlugins/docs/Manifest.toml.txt
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
# This file is machine-generated - editing it directly is not advised
|
||||
|
||||
[[Base64]]
|
||||
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
|
||||
|
||||
[[Dates]]
|
||||
deps = ["Printf"]
|
||||
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
|
||||
|
||||
[[Distributed]]
|
||||
deps = ["Random", "Serialization", "Sockets"]
|
||||
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
|
||||
|
||||
[[DocStringExtensions]]
|
||||
deps = ["LibGit2", "Markdown", "Pkg", "Test"]
|
||||
git-tree-sha1 = "0513f1a8991e9d83255e0140aace0d0fc4486600"
|
||||
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
|
||||
version = "0.8.0"
|
||||
|
||||
[[Documenter]]
|
||||
deps = ["Base64", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
|
||||
git-tree-sha1 = "1b6ae3796f60311e39cd1770566140d2c056e87f"
|
||||
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
||||
version = "0.23.3"
|
||||
|
||||
[[InteractiveUtils]]
|
||||
deps = ["Markdown"]
|
||||
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
|
||||
|
||||
[[JSON]]
|
||||
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
|
||||
git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e"
|
||||
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
||||
version = "0.21.0"
|
||||
|
||||
[[LibGit2]]
|
||||
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
|
||||
|
||||
[[Logging]]
|
||||
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
|
||||
|
||||
[[Markdown]]
|
||||
deps = ["Base64"]
|
||||
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
|
||||
|
||||
[[Mmap]]
|
||||
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
|
||||
|
||||
[[Parsers]]
|
||||
deps = ["Dates", "Test"]
|
||||
git-tree-sha1 = "db2b35dedab3c0e46dc15996d170af07a5ab91c9"
|
||||
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
|
||||
version = "0.3.6"
|
||||
|
||||
[[Pkg]]
|
||||
deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
|
||||
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
|
||||
|
||||
[[Printf]]
|
||||
deps = ["Unicode"]
|
||||
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
|
||||
|
||||
[[REPL]]
|
||||
deps = ["InteractiveUtils", "Markdown", "Sockets"]
|
||||
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
|
||||
|
||||
[[Random]]
|
||||
deps = ["Serialization"]
|
||||
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
|
||||
|
||||
[[SHA]]
|
||||
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
|
||||
|
||||
[[Serialization]]
|
||||
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
|
||||
|
||||
[[Sockets]]
|
||||
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
|
||||
|
||||
[[Test]]
|
||||
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
|
||||
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
||||
|
||||
[[UUIDs]]
|
||||
deps = ["Random", "SHA"]
|
||||
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
|
||||
|
||||
[[Unicode]]
|
||||
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
|
2
test/fixtures/AllPlugins/docs/Project.toml.txt
vendored
Normal file
2
test/fixtures/AllPlugins/docs/Project.toml.txt
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
[deps]
|
||||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
8
test/fixtures/AllPlugins/docs/make.jl.txt
vendored
Normal file
8
test/fixtures/AllPlugins/docs/make.jl.txt
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# AllPlugins
|
||||
|
||||
```@index
|
||||
```
|
||||
|
||||
```@autodocs
|
||||
Modules = [AllPlugins]
|
||||
```
|
15
test/fixtures/AllPlugins/docs/src/index.md.txt
vendored
Normal file
15
test/fixtures/AllPlugins/docs/src/index.md.txt
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
using AllPlugins
|
||||
using Documenter
|
||||
|
||||
makedocs(;
|
||||
modules=[AllPlugins],
|
||||
authors="tester",
|
||||
repo="https://github.com/tester/AllPlugins.jl/blob/{commit}{path}#L{line}",
|
||||
sitename="AllPlugins.jl",
|
||||
format=Documenter.HTML(;
|
||||
assets=String[],
|
||||
),
|
||||
pages=[
|
||||
"Home" => "index.md",
|
||||
],
|
||||
)
|
5
test/fixtures/AllPlugins/src/AllPlugins.jl.txt
vendored
Normal file
5
test/fixtures/AllPlugins/src/AllPlugins.jl.txt
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
module AllPlugins
|
||||
|
||||
greet() = print("Hello World!")
|
||||
|
||||
end # module
|
6
test/fixtures/AllPlugins/test/runtests.jl.txt
vendored
Normal file
6
test/fixtures/AllPlugins/test/runtests.jl.txt
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
using AllPlugins
|
||||
using Test
|
||||
|
||||
@testset "AllPlugins.jl" begin
|
||||
# Write your tests here.
|
||||
end
|
1
test/fixtures/Basic/.gitignore.txt
vendored
1
test/fixtures/Basic/.gitignore.txt
vendored
@ -1,3 +1,2 @@
|
||||
.DS_Store
|
||||
/Manifest.toml
|
||||
/dev/
|
||||
|
@ -1,25 +1,32 @@
|
||||
default_files(pkg::AbstractString) = [
|
||||
".gitignore",
|
||||
"LICENSE",
|
||||
"Manifest.toml",
|
||||
"Project.toml",
|
||||
"README.md",
|
||||
"src/$pkg.jl",
|
||||
"test/runtests.jl",
|
||||
]
|
||||
# TODO: License fixtures need to be updated every year because they don't use Mustache.
|
||||
|
||||
function reference_test(pkg_dir::AbstractString, path::AbstractString)
|
||||
pkg = basename(pkg_dir)
|
||||
path = replace(path, "/" => path_separator)
|
||||
# All fixture files are .txt because otherwise ReferenceTests/FileIO can't handle them.
|
||||
reference = joinpath(@__DIR__, "fixtures", pkg, path * ".txt")
|
||||
observed = read(joinpath(pkg_dir, path), String)
|
||||
@test_reference reference observed
|
||||
function PT.user_view(::Citation, ::Template, ::AbstractString)
|
||||
return Dict("MONTH" => 8, "YEAR" => 2019)
|
||||
end
|
||||
|
||||
function test_all(pkg::AbstractString; kwargs...)
|
||||
t = tpl(; kwargs...)
|
||||
pkg_dir = joinpath(t.dir, pkg)
|
||||
t(pkg)
|
||||
try
|
||||
foreach(readlines(`git -C $pkg_dir ls-files`)) do f
|
||||
# All fixture files are .txt so that ReferenceTests can't handle them.
|
||||
reference = joinpath(@__DIR__, "fixtures", pkg, f * ".txt")
|
||||
observed = read(joinpath(pkg_dir, f), String)
|
||||
@test_reference reference observed
|
||||
end
|
||||
finally
|
||||
rm(pkg_dir; recursive=true, force=true)
|
||||
end
|
||||
end
|
||||
|
||||
@testset "Default package" begin
|
||||
pkg = "Basic"
|
||||
t = tpl(; develop=false, authors=USER)
|
||||
t(pkg)
|
||||
foreach(f -> reference_test(joinpath(t.dir, pkg), f), default_files(pkg))
|
||||
test_all("Basic"; authors=USER, develop=false, manifest=true)
|
||||
end
|
||||
|
||||
@testset "All plugins" begin
|
||||
test_all("AllPlugins"; authors=USER, develop=false, manifest=true, plugins=[
|
||||
AppVeyor(), CirrusCI(), Citation(), Codecov(),
|
||||
Coveralls(), Documenter(), GitLabCI(), TravisCI(),
|
||||
])
|
||||
end
|
||||
|
@ -1,5 +1,3 @@
|
||||
using Base.Filesystem: path_separator
|
||||
|
||||
using Pkg: Pkg
|
||||
using Random: Random
|
||||
using Test: @test, @testset, @test_throws
|
||||
@ -22,9 +20,14 @@ tpl(; kwargs...) = Template(; user=USER, kwargs...)
|
||||
pushfirst!(DEPOT_PATH, dir)
|
||||
try
|
||||
include("template.jl")
|
||||
include("generate.jl")
|
||||
# include("plugin.jl")
|
||||
# include("interactive.jl")
|
||||
|
||||
# Some plugins use the current Julia version in their output,
|
||||
# and the test fixtures are generated with Julia 1.2.
|
||||
if VERSION.major == 1 && VERSION.minor == 2
|
||||
include("generate.jl")
|
||||
else
|
||||
@info "Skipping reference tests (Julia = $VERSION)"
|
||||
end
|
||||
finally
|
||||
popfirst!(DEPOT_PATH)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user