diff --git a/.travis.yml b/.travis.yml index 4362cc6c06..1b6988f368 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,17 +3,15 @@ cache: packages sudo: true dist: trusty -addons: - apt: - packages: - - libfreetype6 - -r: -- 3.1 -- 3.2 -- oldrel -- release -- devel +# build matrix; turn on vdiffr only on r release +matrix: + include: + - r: devel + - r: release + env: USE_VDIFFR=true + - r: oldrel + - r: 3.2 + - r: 3.1 # work around temporary travis + R 3.5 bug r_packages: devtools @@ -21,9 +19,13 @@ r_packages: devtools # Install manually because dev vdiffr is not compatible with Appveyor yet r_github_packages: lionel-/vdiffr +# environment variables set for all builds env: global: + # don't treat missing suggested packages as error - _R_CHECK_FORCE_SUGGESTS_=false + # switch off vdiffr by default + - USE_VDIFFR=false after_success: - Rscript -e 'covr::codecov()' diff --git a/tests/testthat/helper-vdiffr.R b/tests/testthat/helper-vdiffr.R index e0bca59e85..10d375015a 100644 --- a/tests/testthat/helper-vdiffr.R +++ b/tests/testthat/helper-vdiffr.R @@ -1,12 +1,16 @@ +# default is equal to whether NOT_CRAN is true or not +enable_vdiffr <- identical(Sys.getenv("NOT_CRAN"), "true") -enable_vdiffr <- TRUE - -if (!requireNamespace("vdiffr", quietly = TRUE) || - utils::packageVersion("vdiffr") < "0.2.3.9000") { +# disable or enable vdiffr based on the state of USE_VDIFFR, if set +if (identical(Sys.getenv("USE_VDIFFR"), "true")) { + enable_vdiffr <- TRUE +} else if (identical(Sys.getenv("USE_VDIFFR"), "false")) { enable_vdiffr <- FALSE } -if (paste(R.Version()$major, R.Version()$minor, sep = ".") < "3.3.0") { +# disable vdiffr if version is too old +if (!requireNamespace("vdiffr", quietly = TRUE) || + utils::packageVersion("vdiffr") < "0.2.3.9000") { enable_vdiffr <- FALSE }