Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ uuid = "82f577da-a64f-4709-b926-88c56b51bf4b"
authors = ["Simon Byrne <simonbyrne@gmail.com>"]
version = "0.1.0"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

[compat]
julia = "1.6"

[extras]
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
PlotlyKaleido = "f2990250-8cf9-495f-b13a-cce12b45703c"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Plots"]
test = ["Test", "PlotlyBase", "PlotlyKaleido", "Plots"]
27 changes: 16 additions & 11 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ end

using Plots

plotly()

@testset "artifact" begin
dir = mktempdir()
subdir = joinpath(dir, "extra")
Expand All @@ -39,25 +41,28 @@ using Plots
if step == "linux-latest"

@test BuildkiteUtils.artifact_search("*") == []
X = range(-2pi,2pi,length=30)
p = plot(X, sin.(X))

p = plot(identity, sin, -2pi, 2pi)
png(p, joinpath(dir, "sin x.png"))
savefig(p, joinpath(dir, "sin x.html"))
savefig(p, joinpath(dir, "sin x.svg"))

cd(dir) do
BuildkiteUtils.artifact_upload("*.png")
BuildkiteUtils.artifact_upload("*.svg")
BuildkiteUtils.artifact_upload("*.html")
BuildkiteUtils.artifact_upload("**/*.txt")
end

@test sort(BuildkiteUtils.artifact_search()) == sort(["sin x.png", "extra/step.txt"])
@test sort(BuildkiteUtils.artifact_search()) == sort(["sin x.html", "sin x.svg", "extra/step.txt"])

newdir = mktempdir()
BuildkiteUtils.artifact_download("*.png", newdir; step=step)
@test readdir(newdir) == ["sin x.png"]
@test read(joinpath(dir, "sin x.png")) == read(joinpath(newdir, "sin x.png"))
BuildkiteUtils.artifact_download("*.svg", newdir; step=step)
@test readdir(newdir) == ["sin x.svg"]
@test read(joinpath(dir, "sin x.svg")) == read(joinpath(newdir, "sin x.svg"))

else

@test sort(BuildkiteUtils.artifact_search(step="linux-latest")) == sort(["sin x.png", "extra/step.txt"])
@test sort(BuildkiteUtils.artifact_search(step="linux-latest")) == sort(["sin x.html", "sin x.svg", "extra/step.txt"])
@test isempty(BuildkiteUtils.artifact_search(step=step))

cd(dir) do
Expand All @@ -71,8 +76,8 @@ using Plots
end

newdir = mktempdir()
BuildkiteUtils.artifact_download("*.png", newdir; step="linux-latest")
@test readdir(newdir) == ["sin x.png"]
BuildkiteUtils.artifact_download("*.svg", newdir; step="linux-latest")
@test readdir(newdir) == ["sin x.svg"]
end
end

Expand All @@ -82,7 +87,7 @@ end
BuildkiteUtils.annotate("""
Success!

<img src="artifact://sin x.png" alt="sin(x)" height=250 >
<a href="artifact://sin x.html"><img src="artifact://sin x.svg" alt="sin(x)" height=250 ></a>
"""; style="success", context="xtra")

elseif step == "linux-v1.6"
Expand Down