-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance falback ticks - rework downstream tests
- Loading branch information
Showing
4 changed files
with
97 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,90 @@ | ||
using Pkg, PlotUtils | ||
using Pkg, PlotUtils, Test | ||
|
||
LibGit2 = Pkg.GitTools.LibGit2 | ||
TOML = Pkg.TOML | ||
|
||
Plots_jl = joinpath(mkpath(tempname()), "Plots.jl") | ||
Plots_toml = joinpath(Plots_jl, "Project.toml") | ||
|
||
# clone and checkout the latest stable version of Plots | ||
depot = joinpath(first(DEPOT_PATH), "registries", "General", "P", "Plots", "Versions.toml") | ||
stable = maximum(VersionNumber.(keys(TOML.parse(read(depot, String))))) | ||
for i in 1:6 | ||
try | ||
global repo = Pkg.GitTools.ensure_clone( | ||
stdout, | ||
Plots_jl, | ||
"https://github.com/JuliaPlots/Plots.jl", | ||
) | ||
break | ||
catch err | ||
@warn err | ||
sleep(20i) | ||
failsafe_clone_checkout(versions, path, url) = begin | ||
local repo | ||
for i in 1:6 | ||
try | ||
repo = Pkg.GitTools.ensure_clone( | ||
stdout, | ||
path, | ||
url, | ||
) | ||
break | ||
catch err | ||
@warn err | ||
sleep(20i) | ||
end | ||
end | ||
|
||
@assert isfile(joinpath(path, "Project.toml")) "spurious network error: clone failed, bailing out" | ||
stable = maximum(VersionNumber.(keys(TOML.parse(read(versions, String))))) | ||
tag = LibGit2.GitObject(repo, "v$stable") | ||
hash = string(LibGit2.target(tag)) | ||
LibGit2.checkout!(repo, hash) | ||
nothing | ||
end | ||
|
||
fake_supported_version!(path) = begin | ||
toml = joinpath(path, "Project.toml") | ||
# fake the supported PlotUtils version for testing (for `Pkg.develop`) | ||
PlotUtils_version = Pkg.Types.read_package(normpath(@__DIR__, "..", "Project.toml")).version | ||
parsed_toml = TOML.parse(read(toml, String)) | ||
parsed_toml["compat"]["PlotUtils"] = string(PlotUtils_version) | ||
open(toml, "w") do io | ||
TOML.print(io, parsed_toml) | ||
end | ||
nothing | ||
end | ||
@assert isfile(Plots_toml) "spurious network error: clone failed, bailing out" | ||
tag = LibGit2.GitObject(repo, "v$stable") | ||
hash = string(LibGit2.target(tag)) | ||
LibGit2.checkout!(repo, hash) | ||
|
||
# fake the supported PlotUtils version for testing (for `Pkg.develop`) | ||
plotutils_version = Pkg.Types.read_package(normpath(@__DIR__, "..", "Project.toml")).version | ||
toml = TOML.parse(read(Plots_toml, String)) | ||
toml["compat"]["PlotUtils"] = string(plotutils_version) | ||
open(Plots_toml, "w") do io | ||
TOML.print(io, toml) | ||
|
||
deploy_Plots() = begin | ||
tmpd = mktempdir() | ||
Plots_jl = joinpath(tmpd, "Plots.jl") | ||
Plots_toml = joinpath(Plots_jl, "Project.toml") | ||
versions = joinpath(first(DEPOT_PATH), "registries", "General", "P", "Plots", "Versions.toml") | ||
|
||
failsafe_clone_checkout(versions, Plots_jl, "https://github.com/JuliaPlots/Plots.jl") | ||
fake_supported_version!(Plots_jl) | ||
|
||
Pkg.develop(path = Plots_jl) | ||
Pkg.status(["PlotUtils", "Plots"]) | ||
nothing | ||
end | ||
Pkg.develop(path = Plots_jl) | ||
Pkg.status(["PlotUtils", "Plots"]) | ||
|
||
# test basic plots creation & display | ||
using Plots, Test | ||
deploy_Makie(extended=false) = begin | ||
tmpd = mktempdir() | ||
Makie_jl = joinpath(tmpd, "Makie.jl") | ||
versions = joinpath(first(DEPOT_PATH), "registries", "General", "M", "Makie", "Versions.toml") | ||
|
||
failsafe_clone_checkout(versions, Makie_jl, "https://github.com/MakieOrg/Makie.jl") | ||
fake_supported_version!(Makie_jl) | ||
|
||
Pkg.develop(path = joinpath(tmpd, "Makie.jl", "MakieCore")) | ||
Pkg.develop(path = joinpath(tmpd, "Makie.jl")) | ||
if extended # too costly ? | ||
Pkg.develop(path = joinpath(tmpd, "Makie.jl", "ReferenceTests")) | ||
Pkg.develop(path = joinpath(tmpd, "Makie.jl", "CairoMakie")) | ||
# Pkg.develop(path = joinpath(tmpd, "Makie.jl", "GLMakie")) | ||
end | ||
Pkg.status(["PlotUtils", "MakieCore", "Makie"]) | ||
nothing | ||
end | ||
|
||
deploy_Plots() | ||
using Plots | ||
|
||
@testset "downstream Plots" begin | ||
# test basic plots creation & display (Plots tests are too long to run) | ||
true && @time for i in 1:length(Plots._examples) | ||
i ∈ Plots._backend_skips[:gr] && continue # skip unsupported examples | ||
Plots._examples[i].imports ≡ nothing || continue # skip examples requiring optional test deps | ||
show(devnull, Plots.test_examples(:gr, i; disp = false)) # trigger display logic | ||
end | ||
end | ||
|
||
@time for i in 1:length(Plots._examples) | ||
i ∈ Plots._backend_skips[:gr] && continue # skip unsupported examples | ||
Plots._examples[i].imports ≡ nothing || continue # skip examples requiring optional test deps | ||
show(devnull, Plots.test_examples(:gr, i; disp = false)) # trigger display logic | ||
deploy_Makie() | ||
@testset "downstream Makie" begin | ||
Pkg.test("Makie") | ||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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