diff --git a/.travis.yml b/.travis.yml index 57610347e..eed4dd4ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ language: julia os: - linux julia: - - 1.1 - 1.2 - nightly notifications: @@ -14,16 +13,8 @@ git: # uncomment the following lines to allow failures on nightly julia # (tests will run but not make your overall status red) matrix: - allow_failures: - - julia: nightly - -## uncomment and modify the following lines to manually install system packages -#addons: -# apt: # apt-get for linux -# packages: -# - ffmpeg -before_script: - - julia -e 'using Pkg; pkg"add MakieGallery"' + allow_failures: + - julia: nightly ## uncomment the following lines to override the default test script #script: diff --git a/Project.toml b/Project.toml index c0bc1954d..129b066dc 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "AbstractPlotting" uuid = "537997a7-5e4e-5d89-9595-2241ea00577e" -version = "0.9.8" +version = "0.9.9" [deps] ColorBrewer = "a2cac450-b92f-5266-8821-25eda20663c8" @@ -40,14 +40,33 @@ Observables = "≥ 0.2.0" StructArrays = "≥ 0.3.0" [extras] +Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4" +ColorVectorSpace = "c3611d14-8923-5661-9e6a-0046d554d3a4" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" +DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa" +Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" +GDAL = "add2ef01-049f-52c4-9ee2-e494f65e021a" +GLFW = "f7f18e0c-5ee9-5ccd-a5bf-e8befd85ed98" +GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" +ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534" ImageFiltering = "6a3955dd-da59-5b1f-98d4-e7296123deb5" -Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" +ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1" +ImageTransformations = "02fcd773-0e25-5acc-982a-7f6622650795" +Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" MakieGallery = "dbd62bd0-c9f5-5087-a2e1-f5c4bb0cec90" +MeshIO = "7269a6da-0436-5bbc-96c2-40638cbb6118" +ModernGL = "66fc600b-dfda-50eb-8b99-91cfa97b1301" +OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" +ParameterizedFunctions = "65888b18-ceab-5e60-b2b9-181511a3b968" +Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b" +Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" +Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" StatsMakie = "65254759-4cff-5aa5-8326-61ce017a8c70" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea" [targets] -test = ["Test", "Logging", "MakieGallery", "ImageFiltering", "DataFrames", "ColorSchemes", "StatsMakie", "RDatasets"] +test = ["Pkg", "Statistics", "Test", "Distributions", "Random", "ModernGL", "OrdinaryDiffEq", "ParameterizedFunctions", "RDatasets", "MeshIO", "ZipFile", "ColorSchemes", "StatsMakie", "Base64", "ColorVectorSpace", "ImageMagick", "Makie", "ImageCore", "StaticArrays", "DifferentialEquations", "GLFW", "DataFrames", "GDAL", "GLMakie", "ImageFiltering", "ImageTransformations", "MakieGallery"] diff --git a/test/runtests.jl b/test/runtests.jl index 295d9ec22..cc7eed6a0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,20 +1,16 @@ using AbstractPlotting +using MakieGallery using Test # does this machine have a OPENGL? -const OPENGL = haskey(ENV, "OPENGL") || haskey(ENV, "GITLAB_CI") || try success(pipeline(`glxinfo`, `grep version`)) catch; false end # if it's Gitlab, it must be JuliaGPU +const OPENGL = false#haskey(ENV, "OPENGL") || haskey(ENV, "GITLAB_CI") || try success(pipeline(`glxinfo`, `grep version`)) catch; false end # if it's Gitlab, it must be JuliaGPU OPENGL && begin @info "OpenGL detected"; using GLMakie end OPENGL || @warn "No OpenGL detected! Software tests only." # does this machine have FFMPEG? We'll take it on faith if you tell us... -const fmp = haskey(ENV, "FFMPEG") || try; AbstractPlotting.@ffmpeg_env success(`$ffmpeg -version`); catch; false end; - const _MINIMAL = get(ENV, "ABSTRACTPLOTTING_MINIMAL", "false") - -scene = scatter(rand(4)) - include("conversions.jl") include("quaternions.jl") include("projection_math.jl") @@ -26,11 +22,6 @@ include("projection_math.jl") @test scene[Axis].ticks.title_gap[] == 4 end -# if get(ENV, "IS_TRAVIS_CI", "false") == "false" -# exit(0); -# end - -using MakieGallery if _MINIMAL == "false" @@ -38,121 +29,109 @@ if _MINIMAL == "false" database = MakieGallery.load_database() - ## Exceptions are made on basis of title and not index, + ## Exceptions are made on basis of title and not index, # because index may change as MakieGallery changes. - # All these require FFMpeg and need to save, - # and are therefore ignored - ffmpeg_exs = [ - "Animation", "Lots of Heatmaps","Animated Scatter", - "Chess Game", "Record Video", "Animated surface and wireframe", - "Moire", "pong", "pulsing marker", "Travelling wave", - "Type recipe for molecule simulation" - ] - - # All these require GLMakie and so are ignored - glmakie_exs = [ - "Textured Mesh", "Load Mesh", "Wireframe of a Mesh", - "FEM mesh 3D", "Normals of a Cat", "Line GIF" - ] - - # Requires GDAL (a GL package) so ignored - gdal_exs = [ - "WorldClim visualization" - ] + # All these require FFMpeg and need to save, + # and are therefore ignored + ffmpeg_exs = [ + "Animation", "Lots of Heatmaps","Animated Scatter", + "Chess Game", "Record Video", "Animated surface and wireframe", + "Moire", "pong", "pulsing marker", "Travelling wave", + "Type recipe for molecule simulation", "Cobweb plot" + ] + + # All these require GLMakie and so are ignored + glmakie_exs = [ + "Textured Mesh", "Load Mesh", "Wireframe of a Mesh", + "FEM mesh 3D", "Normals of a Cat", "Line GIF" + ] + + # Requires GDAL (a GL package) so ignored + gdal_exs = [ + "WorldClim visualization" + ] # Requires GLMakie and ModernGL, so ignored - moderngl_exs = [ - "Explicit frame rendering" - ] - - # use Stepper plots, which save, so ignored - save_exs = [ - "Axis theming", "Labels", "Color Legend", - "Stepper demo" - ] - - # hopefullly fixed by next tag of MakieGallery (already in AbstractPlotting - color_exs = ["colormaps"] - - # curl fails with this for some reason, so it has been ignored. - curl_exs = ["Earth & Ships"] - - if OPENGL - if fmp - # all test infrastructure in place - no exceptions! - exc_str = Set() - else - exc_str = Set(ffmpeg_exs) - end - else - # combine all exceptions into a single Set - exc_str = exc_str = union(ffmpeg_exs, glmakie_exs, gdal_exs, moderngl_exs, save_exs, color_exs, curl_exs) - end + moderngl_exs = [ + "Explicit frame rendering" + ] + + # use Stepper plots, which save, so ignored + save_exs = [ + "Axis theming", "Labels", "Color Legend", + "Stepper demo" + ] + + # hopefullly fixed by next tag of MakieGallery (already in AbstractPlotting + color_exs = ["colormaps"] + + # curl fails with this for some reason, so it has been ignored. + curl_exs = ["Earth & Ships"] + stepper_exclude = ["Tutorial plot transformation", "Legend"] + if OPENGL + excluded_examples = Set() + else + # combine all exceptions into a single Set + excluded_examples = excluded_examples = union( + ffmpeg_exs, glmakie_exs, gdal_exs, moderngl_exs, + save_exs, color_exs, curl_exs, stepper_exclude + ) + end else - # Load only short tests - database = MakieGallery.load_tests() - - # This one is broken, all the others are fine. I don't know why this fails. It doesn't fail on my machine :P - exc_str = Set(["Comparing contours, image, surfaces and heatmaps"]) - + excluded_examples = Set(["Comparing contours, image, surfaces and heatmaps"]) end if !OPENGL # run software only tests... - + # Make sure we don't include Makie in the usings + empty!(MakieGallery.plotting_backends) + push!(MakieGallery.plotting_backends, "AbstractPlotting") + @test AbstractPlotting.current_backend[] isa Missing + @info "Starting minimal software tests" + filter!(database) do example + !(example.title in excluded_examples) && + !("record" in example.tags) + end @testset "Gallery short tests" begin - # iterate over database @testset "$(database[i].title) (#$i)" for i in 1:length(database) - - # skip if the title is in the list of exceptions - if database[i].title ∈ exc_str - - print( - "Skipping " - * database[i].title * - "\n(removed from tests explicitly)\n" - ) - - continue - - end - - @debug("Running " * database[i].title * "\n(index $i)\n") - # evaluate the entry - @test_nowarn MakieGallery.eval_example(database[i]); - + @debug("Running " * database[i].title * "\n(index $i)\n") + # evaluate the entry + try + MakieGallery.eval_example(database[i]) + @test true + catch e + # THis is ok, since we try to record something, which we can't + # without backend + if e isa LoadError && e.error isa MethodError && ( + e.error.f == AbstractPlotting.backend_display || + e.error.f == AbstractPlotting.format2mime + ) + @test true + else + @test rethrow(e) + end + end + @assert AbstractPlotting.current_backend[] isa Missing end - end - else # full MakieGallery comparisons here - using GLMakie - @info("Running full tests - artifacts will be stored!") - - for exc in exc_str - + for exc in excluded_examples printstyled("Excluded ", color = :yellow, bold = true) println(exc) - end - - filter!(entry -> !(entry.title in exc_str), database) - + filter!(entry -> !(entry.title in excluded_examples), database) tested_diff_path = joinpath(@__DIR__, "tested_different") test_record_path = joinpath(@__DIR__, "test_recordings") rm(tested_diff_path, force = true, recursive = true) mkpath(tested_diff_path) rm(test_record_path, force = true, recursive = true) mkpath(test_record_path) - examples = MakieGallery.record_examples(test_record_path) - MakieGallery.run_comparison(test_record_path, tested_diff_path) - end