From 17acb456538ced66ec8c2a1c054e221c72b747e6 Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Tue, 20 Oct 2020 17:54:08 +0200 Subject: [PATCH] Replace artifact by scratchspace (#3067) * replace build.jl by Artifacts.toml * check ENV * fix it * fix condition * restore === * replace Artifact by Scratchspace * correct Project.toml * update CI * Update ci.yml * Update SnoopCompile.yml * add tests * improve tests * fix --- .github/workflows/SnoopCompile.yml | 2 -- .github/workflows/ci.yml | 1 - Artifacts.toml | 7 ------- Project.toml | 5 ++--- src/init.jl | 18 +++++++----------- test/runtests.jl | 13 +++++++++++++ 6 files changed, 22 insertions(+), 24 deletions(-) delete mode 100644 Artifacts.toml diff --git a/.github/workflows/SnoopCompile.yml b/.github/workflows/SnoopCompile.yml index ca726949..a58aaa74 100644 --- a/.github/workflows/SnoopCompile.yml +++ b/.github/workflows/SnoopCompile.yml @@ -21,8 +21,6 @@ jobs: fail-fast: false matrix: version: # NOTE: the versions below should match those in your botconfig - - '1.3' - - '1.4' - '1.5' os: # NOTE: should match the os setting of your botconfig - ubuntu-latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 603e3b04..8d483a8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,6 @@ jobs: fail-fast: false matrix: version: - - '1.3' - '1' - 'nightly' os: diff --git a/Artifacts.toml b/Artifacts.toml deleted file mode 100644 index a14162cd..00000000 --- a/Artifacts.toml +++ /dev/null @@ -1,7 +0,0 @@ -[plotly] -git-tree-sha1 = "f03dd0451a05a5fdbbcb3e548998a9d7a1ab6368" -lazy = true - - [[plotly.download]] - url = "https://cdn.plot.ly/plotly-1.54.2.min.js" - sha256 = "487f1da6b7a1f127de59af8a65bb3fe2c63d709f011afea82896bdce28ecc0f8" diff --git a/Project.toml b/Project.toml index e6dca89b..56daf007 100644 --- a/Project.toml +++ b/Project.toml @@ -17,7 +17,6 @@ Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Measures = "442fdcdd-2543-5da2-b0f3-8c86c306513e" NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" PlotThemes = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a" PlotUtils = "995b91a9-d308-5afd-9ec6-746e21dbc043" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" @@ -27,6 +26,7 @@ RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" RecipesPipeline = "01d81517-befc-4cb6-b9ec-a95719d0359c" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" Requires = "ae029012-a4dd-5104-9daa-d747884805df" +Scratch = "6c6a2e73-6563-6170-7368-637461726353" Showoff = "992d4aef-0814-514b-bc4d-f2e9a6c4116f" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" @@ -52,9 +52,8 @@ RecipesPipeline = "0.1.13" Reexport = "0.2" Requires = "1" Showoff = "0.3.1" -StableRNGs = "0.1.1" StatsBase = "0.32, 0.33" -julia = "1.3" +julia = "1.5" [extras] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" diff --git a/src/init.jl b/src/init.jl index efa41cd9..3cb22c79 100644 --- a/src/init.jl +++ b/src/init.jl @@ -1,7 +1,8 @@ using REPL -using Pkg.Artifacts +using Scratch + +const plotly_local_file_path = Ref{Union{Nothing, String}}(nothing) -const plotly_local_file_path = Ref("") function _plots_defaults() if isdefined(Main, :PLOTS_DEFAULTS) @@ -77,17 +78,12 @@ function __init__() end end - if get(ENV, "PLOTS_HOST_DEPENDENCY_LOCAL", "false") == true - artifact_toml = joinpath(@__DIR__, "Artifacts.toml") - - plotly_sha = artifact_hash("plotly", artifact_toml) - if plotly_sha === nothing || !artifact_exists(plotly_sha) - plotly_sha = create_artifact() do artifact_dir - download("https://cdn.plot.ly/plotly-1.54.2.min.js", joinpath(artifact_dir, "plotly-1.54.2.min.js")) - end + if get(ENV, "PLOTS_HOST_DEPENDENCY_LOCAL", "false") == "true" + global plotly_local_file_path[] = joinpath(@get_scratch!("plotly"), "plotly-1.54.2.min.js") + if !isfile(plotly_local_file_path[]) + download("https://cdn.plot.ly/plotly-1.54.2.min.js", plotly_local_file_path[]) end - plotly_local_file_path[] = joinpath(artifact_path(plotly_sha), "plotly-1.54.2.min.js") use_local_plotlyjs[] = true end diff --git a/test/runtests.jl b/test/runtests.jl index 4daff777..6f7eacf3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -11,6 +11,19 @@ import GeometryTypes, GeometryBasics using Dates using RecipesBase +@testset "Plotly standalone" begin + @test Plots.plotly_local_file_path[] === nothing + temp = Plots.use_local_dependencies[] + withenv("PLOTS_HOST_DEPENDENCY_LOCAL" => true) do + Plots.__init__() + @test Plots.plotly_local_file_path[] isa String + @test isfile(Plots.plotly_local_file_path[]) + @test Plots.use_local_dependencies[] = true + end + Plots.plotly_local_file_path[] = nothing + Plots.use_local_dependencies[] = temp +end # testset + include("test_defaults.jl") include("test_axes.jl") include("test_axis_letter.jl")