-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow "deploying" to a tarball (#1865)
- Loading branch information
Showing
4 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
isdefined(@__MODULE__, :TestUtilities) || include("TestUtilities.jl") | ||
using Documenter: Documenter, deploydocs | ||
using Documenter.Utilities: git | ||
using Test, ..TestUtilities | ||
|
||
struct TestDeployConfig <: Documenter.DeployConfig | ||
repo_path :: String | ||
subfolder :: String | ||
end | ||
function Documenter.deploy_folder(c::TestDeployConfig; branch, repo, kwargs...) | ||
Documenter.DeployDecision(; all_ok = true, subfolder = c.subfolder, branch, repo) | ||
end | ||
Documenter.authentication_method(::TestDeployConfig) = Documenter.HTTPS | ||
Documenter.authenticated_repo_url(c::TestDeployConfig) = c.repo_path | ||
|
||
@testset "deploydocs" begin | ||
mktempdir() do dir | ||
cd(dir) do | ||
mkdir("repo") | ||
run(`$(git()) -C repo init -q --bare`) | ||
full_repo_path = joinpath(pwd(), "repo") | ||
# Pseudo makedocs products in build/ | ||
mkdir("build") | ||
write("build/page.html", "...") | ||
# Create gh-pages and deploy dev/ | ||
@quietly deploydocs( | ||
root = pwd(), | ||
deploy_config = TestDeployConfig(full_repo_path, "dev"), | ||
repo = full_repo_path, | ||
devbranch = "master", | ||
) | ||
# Deploy 1.0.0 tag | ||
@quietly deploydocs( | ||
root = pwd(), | ||
deploy_config = TestDeployConfig(full_repo_path, "1.0.0"), | ||
repo = full_repo_path, | ||
devbranch = "master", | ||
) | ||
# Deploy 1.1.0 tag | ||
@quietly deploydocs( | ||
root = pwd(), | ||
deploy_config = TestDeployConfig(full_repo_path, "1.1.0"), | ||
repo = full_repo_path, | ||
devbranch = "master", | ||
) | ||
# Deploy 2.0.0 tag, but into an archive (so nothing pushed to gh-pages) | ||
@quietly deploydocs( | ||
root = pwd(), | ||
deploy_config = TestDeployConfig(full_repo_path, "2.0.0"), | ||
repo = full_repo_path, | ||
devbranch = "master", | ||
archive = joinpath(pwd(), "ghpages.tar.gz"), | ||
) | ||
# Check what we have in gh-pages now: | ||
run(`$(git()) clone -q -b gh-pages $(full_repo_path) worktree`) | ||
@test isfile(joinpath("worktree", "index.html")) | ||
@test isfile(joinpath("worktree", "versions.js")) | ||
for d in ["dev", "v1.0.0", "v1.1.0"] | ||
@test isfile(joinpath("worktree", d, "page.html")) | ||
@test isfile(joinpath("worktree", d, "siteinfo.js")) | ||
end | ||
@test islink(joinpath("worktree", "v1")) | ||
@test islink(joinpath("worktree", "v1.0")) | ||
@test islink(joinpath("worktree", "v1.1")) | ||
@test islink(joinpath("worktree", "stable")) | ||
# And make sure that archived option didn't modify gh-pages | ||
@test ! ispath(joinpath("worktree", "2.0.0")) | ||
@test ! ispath(joinpath("worktree", "v2.0")) | ||
@test ! ispath(joinpath("worktree", "v2")) | ||
@test isfile("ghpages.tar.gz") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters