Skip to content

Commit

Permalink
Merge pull request #2281 from infotroph/travis-multiR
Browse files Browse the repository at this point in the history
Travis: Build against multiple R versions
  • Loading branch information
mdietze committed Feb 8, 2019
2 parents 549abd2 + 077792c commit 089d9ac
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 13 deletions.
36 changes: 28 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

language: r
r:
- 3.5
- release
- devel
- oldrel

# TRUSTY: Change version when 16.04 image is available.
dist: trusty
Expand All @@ -19,6 +21,13 @@ env:
# When Travis updates, check for Make 4 and add -O if available.
- MAKEFLAGS="-j2"
- PGHOST=localhost
- RGL_USE_NULL=TRUE # Keeps RGL from complaining it can't find X11

matrix:
fast_finish: true
allow_failures:
- r: devel
- r: oldrel

cache:
- directories:
Expand All @@ -43,7 +52,6 @@ addons:
- libgmp-dev
- libhdf5-dev
- liblapack-dev
- libmagick++-dev
- libnetcdf-dev
- libproj-dev
- libudunits2-dev
Expand All @@ -57,8 +65,10 @@ addons:
- r-bioc-biocinstaller
- r-cran-ape
- r-cran-curl
- r-cran-data.table
- r-cran-devtools
- r-cran-dplyr
- r-cran-gap
- r-cran-ggplot2
- r-cran-httr
- r-cran-igraph
Expand All @@ -71,7 +81,10 @@ addons:
- r-cran-redland
- r-cran-rncl
- r-cran-roxygen2
- r-cran-rsqlite
- r-cran-sf
- r-cran-shiny
- r-cran-sirt
- r-cran-testthat
- r-cran-tidyverse
- r-cran-xml
Expand Down Expand Up @@ -105,8 +118,6 @@ install:
- rm configure
- R CMD INSTALL .
- popd
# temporary until remotes 2.0.2 binary reaches C2D4U
- Rscript -e 'if(packageVersion("remotes") <= "2.0.1"){install.packages("remotes", repos = "http://cran.rstudio.com")}'

before_script:
- sudo service postgresql stop
Expand All @@ -128,17 +139,26 @@ before_script:

script:
- set -e
- echo 'Installing PEcAn packages'
- Rscript scripts/generate_makefile_deps.R
- echo 'Installing PEcAn packages' && echo -en 'travis_fold:start:install_pkgs\\r'
# TODO: Would probably be faster to use -j2 NCPUS=1 as for other steps,
# but many dependency compilations seem not parallel-safe.
# More debugging needed.
- NCPUS=2 make -j1
- echo 'Testing PEcAn packages'
- echo -en 'travis_fold:end:install_pkgs\\r'
#
- echo 'Testing PEcAn packages' && echo -en 'travis_fold:start:test_pkgs\\r'
- make test
- make check
- echo 'Testing Integration'
- echo -en 'travis_fold:end:test_pkgs\\r'
#
- echo 'Checking PEcAn packages' && echo -en 'travis_fold:start:check_pkgs\\r'
- REBUILD_DOCS=FALSE make check
- echo -en 'travis_fold:end:check_pkgs\\r'
#
- echo 'Testing Integration' && echo -en 'travis_fold:start:integration_test\\r'
- ./tests/integration.sh travis
- echo -en 'travis_fold:end:integration_test\\r'
#
- if [[ `git status -s` ]]; then
echo "These files were changed by the build process:";
git status -s;
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ For more information about this file see also [Keep a Changelog](http://keepacha
## [Unreleased]

### Changed
- Automatic build are currently done using R version 3.5 and most development will be done with version 3.5 as well. It still might be possible to use R version 3.4 however we will not guarantee future compatibility with 3.4.
- Improved testing (#2281). Automatic Travis CI builds of PEcAn on are now run using three versions of R in parallel. This should mean fewer issues with new releases and better backwards compatibility, but note that we still only guarantee full compatibility with the current release version of R. The tested versions are:
- `release`, the current public release of R (currently R 3.5). Build failures in this version are fixed before merging the change that caused them. When we say PEcAn is fully tested and working, this is the build we mean.
- `devel`, the newest available development build of R. We will fix issues with this version before the next major R release.
- `oldrel`, the previous major release of R (currently R 3.4). We will fix issues with this version as time allows, but we do not guarantee that it will stay compatible.
- Reverting back from PR #2137 to fix issues with MAAT wrappers.
- Moved docker files for models into model specific folder, for example Dockerfile for sipnet now is in models/sipnet/Dockerfile.
- `PEcAn.utils`
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ depends_R_pkg = time Rscript -e " \
deps <- if (grepl('base/utils', '$(1)')) { c('Depends', 'Imports', 'LinkingTo') } else { TRUE }; \
devtools::install_deps('$(strip $(1))', Ncpus = ${NCPUS}, dependencies = deps);"
install_R_pkg = time Rscript -e "devtools::install('$(strip $(1))', Ncpus = ${NCPUS});"
check_R_pkg = Rscript scripts/check_with_errors.R $(strip $(1))
test_R_pkg = Rscript -e "devtools::test('"$(strip $(1))"', stop_on_failure = TRUE, stop_on_warning = FALSE)" # TODO: Raise bar to stop_on_warning = TRUE when we can
doc_R_pkg = Rscript -e "devtools::document('"$(strip $(1))"')"
check_R_pkg = time Rscript scripts/check_with_errors.R $(strip $(1))
test_R_pkg = time Rscript -e "devtools::test('"$(strip $(1))"', stop_on_failure = TRUE, stop_on_warning = FALSE)" # TODO: Raise bar to stop_on_warning = TRUE when we can
doc_R_pkg = time Rscript -e "devtools::document('"$(strip $(1))"')"

$(ALL_PKGS_I) $(ALL_PKGS_C) $(ALL_PKGS_T) $(ALL_PKGS_D): | .install/devtools .install/roxygen2 .install/testthat

Expand Down
4 changes: 3 additions & 1 deletion scripts/check_with_errors.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ pkg <- arg[1]
# check() sets its own values for `_R_CHECK_*` environment variables, without
# checking whether any are already set. It winds up string-concatenating new
# onto old (e.g. "FALSE TRUE") instead of either respecting or overriding them.
# (Fixed in devtools 2.0.1.9000; remove these lines after next CRAN release)
Sys.unsetenv(
c('_R_CHECK_CRAN_INCOMING_',
'_R_CHECK_CRAN_INCOMING_REMOTE_',
'_R_CHECK_FORCE_SUGGESTS_'))

log_level <- Sys.getenv('LOGLEVEL', unset = NA)
die_level <- Sys.getenv('DIELEVEL', unset = NA)
redocument <- as.logical(Sys.getenv('REBUILD_DOCS', unset = NA))

# message('log_level = ', log_level)
# message('die_level = ', die_level)
Expand All @@ -33,7 +35,7 @@ die_warn <- !is.na(die_level) && die_level == 'warn'

log_notes <- !is.na(log_level) && log_level == 'all'

chk <- devtools::check(pkg, quiet = TRUE, error_on = "never")
chk <- devtools::check(pkg, quiet = TRUE, error_on = "never", document = redocument)

errors <- chk[['errors']]
n_errors <- length(errors)
Expand Down

0 comments on commit 089d9ac

Please sign in to comment.