@@ -5,21 +5,27 @@ step = ENV["BUILDKITE_STEP_KEY"]
55@test success (` $(BuildkiteUtils. agent ()) --version` )
66
77@testset " meta-data" begin
8- if step == " linux"
8+ if step == " linux-latest "
99 @test keys (BuildkiteUtils. METADATA) == []
10- elseif step == " windows"
11- @test keys (BuildkiteUtils. METADATA) == [" aa-linux" ]
12- @test BuildkiteUtils. METADATA[" aa-linux" ] == " hello"
10+ @test ! haskey (BuildkiteUtils. METADATA, " test-linux-latest" )
11+ else
12+ @test " test-linux-latest" in keys (BuildkiteUtils. METADATA)
13+ @test haskey (BuildkiteUtils. METADATA, " test-linux-latest" )
14+ @test BuildkiteUtils. METADATA[" test-linux-latest" ] == " hello"
1315 end
1416
15- BuildkiteUtils. METADATA[" aa -$step " ] = " hello"
17+ BuildkiteUtils. METADATA[" test -$step " ] = " hello"
1618
17- if step == " linux"
18- @test keys (BuildkiteUtils. METADATA) == [" aa-linux" ]
19- elseif step == " windows"
20- @test keys (BuildkiteUtils. METADATA) == [" aa-linux" , " aa-windows" ]
19+ if step == " linux-latest"
20+ @test keys (BuildkiteUtils. METADATA) == [" test-linux-latest" ]
21+ @test haskey (BuildkiteUtils. METADATA, " test-linux-latest" )
22+ else
23+ @test haskey (BuildkiteUtils. METADATA, " test-linux-latest" )
24+ @test haskey (BuildkiteUtils. METADATA, " test-$step " )
25+ @test " test-$step " in keys (BuildkiteUtils. METADATA)
2126 end
22- @test BuildkiteUtils. METADATA[" aa-$step " ] == " hello"
27+
28+ @test BuildkiteUtils. METADATA[" test-$step " ] == " hello"
2329end
2430
2531using Plots
@@ -28,9 +34,9 @@ using Plots
2834 dir = mktempdir ()
2935 subdir = joinpath (dir, " extra" )
3036 mkpath (subdir)
31- write (joinpath (subdir, " $ step .txt" ), " hello world " )
37+ write (joinpath (subdir, " step.txt" ), step )
3238
33- if step == " linux"
39+ if step == " linux-latest "
3440
3541 @test BuildkiteUtils. artifact_search (" *" ) == []
3642
@@ -42,42 +48,48 @@ using Plots
4248 BuildkiteUtils. artifact_upload (" **/*.txt" )
4349 end
4450
45- @test sort (BuildkiteUtils. artifact_search ()) == sort ([" sin x.png" , " extra/linux .txt" ])
51+ @test sort (BuildkiteUtils. artifact_search ()) == sort ([" sin x.png" , " extra/step .txt" ])
4652
4753 newdir = mktempdir ()
4854 BuildkiteUtils. artifact_download (" *.png" , newdir; step= step)
4955 @test readdir (newdir) == [" sin x.png" ]
5056 @test read (joinpath (dir, " sin x.png" )) == read (joinpath (newdir, " sin x.png" ))
5157
52- elseif step == " windows "
58+ else
5359
54- @test sort (BuildkiteUtils. artifact_search ()) == sort ([" sin x.png" , " extra/linux.txt" ])
60+ @test sort (BuildkiteUtils. artifact_search (step= " linux-latest" )) == sort ([" sin x.png" , " extra/step.txt" ])
61+ @test isempty (BuildkiteUtils. artifact_search (step= step))
5562
5663 cd (dir) do
5764 BuildkiteUtils. artifact_upload (" **/*.txt" )
5865 end
5966
60- @test sort (BuildkiteUtils. artifact_search ()) == sort ([" sin x.png" , " extra/linux.txt" , " extra\\ windows.txt" ])
61- @test sort (BuildkiteUtils. artifact_search (; step= " linux" )) == sort ([" sin x.png" , " extra/linux.txt" ])
62- @test sort (BuildkiteUtils. artifact_search (; step= " windows" )) == sort ([" extra\\ windows.txt" ])
67+ if step == " windows"
68+ @test BuildkiteUtils. artifact_search (step= step) == [" extra\\ step.txt" ]
69+ else
70+ @test BuildkiteUtils. artifact_search (step= step) == [" extra/step.txt" ]
71+ end
6372
6473 newdir = mktempdir ()
65- BuildkiteUtils. artifact_download (" *.png" , newdir; step= " linux" )
74+ BuildkiteUtils. artifact_download (" *.png" , newdir; step= " linux-latest " )
6675 @test readdir (newdir) == [" sin x.png" ]
6776 end
6877end
6978
7079@testset " annotation" begin
71- if step == " linux"
72- BuildkiteUtils. annotate (" Hello from :linux:\n " )
80+ if step == " linux-latest "
81+ BuildkiteUtils. annotate (" Hello from :linux:\n\n " )
7382 BuildkiteUtils. annotate ("""
74- Success
83+ Success!
7584
7685 <img src="artifact://sin x.png" alt="sin(x)" height=250 >
7786 """ ; style= " success" , context= " xtra" )
7887
88+ elseif step == " linux-v1.6"
89+ BuildkiteUtils. annotate (" and from :linux: v1.6\n\n " ; append= true )
7990 elseif step == " windows"
80- BuildkiteUtils. annotate (" and from :windows:\n " ; append= true )
81-
91+ BuildkiteUtils. annotate (" and from :windows:\n\n " ; append= true )
92+ elseif step == " macos"
93+ BuildkiteUtils. annotate (" and from :macos:\n\n " ; append= true )
8294 end
8395end
0 commit comments