fix undefined is_ci

This commit is contained in:
Daniel Schwabeneder 2020-07-01 10:32:04 +02:00
parent 0a929d6022
commit ddc89e54f1
3 changed files with 27 additions and 17 deletions

View File

@ -16,7 +16,7 @@ jobs:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} name: Julia ${{ matrix.version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.version == 'nightly' || (matrix.version == '1.3' && matrix.os == 'windows-latest')}} continue-on-error: ${{ matrix.version == 'nightly' }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@ -16,14 +16,21 @@ function fix_rand!(ex)
pushfirst!(ex.args[1].args, :(rng = StableRNG(1234))) pushfirst!(ex.args[1].args, :(rng = StableRNG(1234)))
end end
function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = !is_ci(), sigma = [1,1], tol = 1e-2) function image_comparison_tests(
pkg::Symbol,
idx::Int;
debug = false,
popup = !is_ci(),
sigma = [1, 1],
tol = 1e-2,
)
Plots._debugMode.on = debug Plots._debugMode.on = debug
example = Plots._examples[idx] example = Plots._examples[idx]
Plots.theme(:default) Plots.theme(:default)
@info("Testing plot: $pkg:$idx:$(example.header)") @info("Testing plot: $pkg:$idx:$(example.header)")
backend(pkg) backend(pkg)
backend() backend()
default(size=(500,300)) default(size = (500, 300))
fn = "ref$idx.png" fn = "ref$idx.png"
reffn = reference_file(pkg, idx, _current_plots_version) reffn = reference_file(pkg, idx, _current_plots_version)
@ -40,19 +47,22 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = !i
# the test # the test
vtest = VisualTest(func, reffn, idx) vtest = VisualTest(func, reffn, idx)
test_images(vtest, popup=popup, sigma=sigma, tol=tol, newfn = newfn) test_images(vtest, popup = popup, sigma = sigma, tol = tol, newfn = newfn)
end end
function image_comparison_facts(pkg::Symbol; function image_comparison_facts(
skip = [], # skip these examples (int index) pkg::Symbol;
only = nothing, # limit to these examples (int index) skip = [], # skip these examples (int index)
debug = false, # print debug information? only = nothing, # limit to these examples (int index)
sigma = [1,1], # number of pixels to "blur" debug = false, # print debug information?
tol = 1e-2) # acceptable error (percent) sigma = [1, 1], # number of pixels to "blur"
for i in 1:length(Plots._examples) tol = 1e-2,
i in skip && continue ) # acceptable error (percent)
if only === nothing || i in only for i = 1:length(Plots._examples)
@test image_comparison_tests(pkg, i, debug=debug, sigma=sigma, tol=tol) |> success == true i in skip && continue
if only === nothing || i in only
@test image_comparison_tests(pkg, i, debug = debug, sigma = sigma, tol = tol) |>
success == true
end
end end
end
end end

View File

@ -44,8 +44,8 @@ include("imgcomp.jl")
# don't actually show the plots # don't actually show the plots
Random.seed!(1234) Random.seed!(1234)
default(show=false, reuse=true) default(show=false, reuse=true)
const IS_CI = get(ENV, "CI", "false") == "true" is_ci() = get(ENV, "CI", "false") == "true"
const IMG_TOL = VERSION < v"1.4" && Sys.iswindows() ? 1e-1 : IS_CI ? 1e-2 : 1e-3 const IMG_TOL = VERSION < v"1.4" && Sys.iswindows() ? 1e-1 : is_ci() ? 1e-2 : 1e-3
## Uncomment the following lines to update reference images for different backends ## Uncomment the following lines to update reference images for different backends