Skip to content

Apache DataFusion SQL Query Engine

ARROW-7146: [R][CI] Various fixes and speedups for the R docker-compose setup

Neal Richardsone34d4d086d30
diff --git a/.dockerignore b/.dockerignore
index b96eecdbad..e5097681ab 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -30,3 +30,4 @@
!python/requirements*.txt
!python/manylinux1/**
!python/manylinux2010/**
+!r/DESCRIPTION
diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml
index 8b26698396..6cb4387cf2 100644
--- a/.github/workflows/r.yml
+++ b/.github/workflows/r.yml
@@ -42,7 +42,6 @@ jobs:
env:
R: ${{ matrix.r }}
UBUNTU: ${{ matrix.ubuntu }}
- ARROW_R_CXXFLAGS: '-Werror'
steps:
- name: Checkout Arrow
uses: actions/checkout@v1
diff --git a/appveyor.yml b/appveyor.yml
index 73ba717753..a6d79de7e0 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -95,6 +95,8 @@ environment:
TEST_R_WITH_ARROW: "TRUE"
RWINLIB_LOCAL: '%APPVEYOR_BUILD_FOLDER%\libarrow.zip'
ARROW_R_CXXFLAGS: '-Werror'
+ _R_CHECK_TESTS_NLINES_: 0
+ WARNINGS_ARE_ERRORS: 1
MSVC_DEFAULT_OPTIONS: ON
APPVEYOR_SAVE_CACHE_ON_ERROR: true
diff --git a/ci/conda_env_r.yml b/ci/conda_env_r.yml
index f5447e9066..f7f76126cd 100644
--- a/ci/conda_env_r.yml
+++ b/ci/conda_env_r.yml
@@ -31,6 +31,7 @@ pandoc
r-covr
r-hms
r-lubridate
+r-rcmdcheck
r-rmarkdown
r-testthat
r-tibble
diff --git a/ci/docker/linux-apt-r.dockerfile b/ci/docker/linux-apt-r.dockerfile
index 1d8381b988..15320a63e7 100644
--- a/ci/docker/linux-apt-r.dockerfile
+++ b/ci/docker/linux-apt-r.dockerfile
@@ -30,7 +30,10 @@ RUN apt-get update -y && \
apt-key adv \
--keyserver keyserver.ubuntu.com \
--recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 && \
- add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/' && \
+ # NOTE: as of 2019-12, R 3.5 and 3.6 are available in the repos with -cran35 suffix
+ # R 3.2, 3.3, 3.4 are available without the suffix but only for trusty and xenial
+ # TODO: make sure OS version and R version are valid together and conditionally set repo suffix
+ add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu '$(lsb_release -cs)'-cran35/' && \
apt-get install -y \
r-base=${r}* \
# system libs needed by core R packages
@@ -42,7 +45,10 @@ RUN apt-get update -y && \
clang-format \
clang-tidy \
# R CMD CHECK --as-cran needs pdflatex to build the package manual
- texlive-latex-base && \
+ texlive-latex-base \
+ # Need locales so we can set UTF-8
+ locales && \
+ locale-gen en_US.UTF-8 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
@@ -50,14 +56,18 @@ RUN apt-get update -y && \
# and use pre-built binaries where possible
RUN printf "\
options(Ncpus = parallel::detectCores(), \
- repos = 'https://demo.rstudiopm.com/all/__linux__/bionic/latest', \
+ repos = 'https://demo.rstudiopm.com/all/__linux__/"$(lsb_release -cs)"/latest', \
HTTPUserAgent = sprintf(\
'R/%%s R (%%s)', getRversion(), \
paste(getRversion(), R.version\$platform, R.version\$arch, R.version\$os)))\n" \
>> /etc/R/Rprofile.site
-# Also ensure parallel compilation of each individual package
-RUN echo "MAKEFLAGS=-j8" >> /usr/lib/R/etc/Makeconf
+# Also ensure parallel compilation of C/C++ code
+RUN echo "MAKEFLAGS=-j$(R --slave -e 'cat(parallel::detectCores())')" >> /usr/lib/R/etc/Makeconf
+
+COPY ci/scripts/r_deps.sh /arrow/ci/scripts/
+COPY r/DESCRIPTION /arrow/r/
+RUN /arrow/ci/scripts/r_deps.sh /arrow
ENV \
ARROW_BUILD_STATIC=OFF \
@@ -66,9 +76,9 @@ ENV \
ARROW_DEPENDENCY_SOURCE=SYSTEM \
ARROW_FLIGHT=OFF \
ARROW_GANDIVA=OFF \
+ ARROW_NO_DEPRECATED_API=ON \
ARROW_ORC=OFF \
ARROW_PARQUET=ON \
ARROW_PLASMA=OFF \
ARROW_USE_GLOG=OFF \
- ARROW_NO_DEPRECATED_API=ON \
- ARROW_R_DEV=TRUE
+ LC_ALL=en_US.UTF-8
diff --git a/ci/scripts/r_build.sh b/ci/scripts/r_build.sh
deleted file mode 100755
index 2b63b63299..0000000000
--- a/ci/scripts/r_build.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -ex
-
-: ${R_BIN:=R}
-
-source_dir=${1}/r
-
-# ARROW-6171: Because lz4 is installed in the base Ubuntu image, there's an
-# issue of which library is loaded at runtime. R by default will override
-# LD_LIBRARY_PATH at runtime by concatenating (in that order)
-# R_LD_LIBRARY_PATH, R_JAVA_LD_LIBRARY_PATH and LD_LIBRARY_PATH. If
-# R_LD_LIBRARY_PATH is not set, it'll default to a list of directories which
-# contains /usr/lib/x86_64-linux-gnu.
-export LD_LIBRARY_PATH=${ARROW_HOME}/lib:${LD_LIBRARY_PATH}
-export R_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
-
-pushd ${source_dir}
-
-make clean
-${R_BIN} CMD build --keep-empty-dirs .
-${R_BIN} CMD INSTALL $(ls | grep arrow_*.tar.gz)
-
-popd
diff --git a/ci/scripts/r_deps.sh b/ci/scripts/r_deps.sh
index 2289d525fc..eb14080e61 100755
--- a/ci/scripts/r_deps.sh
+++ b/ci/scripts/r_deps.sh
@@ -25,8 +25,8 @@ source_dir=${1}/r
pushd ${source_dir}
# Install R package dependencies
-${R_BIN} -e "install.packages(c('remotes', 'dplyr', 'glue'))"
+${R_BIN} -e "install.packages('remotes'); remotes::install_cran(c('glue', 'rcmdcheck'))"
${R_BIN} -e "remotes::install_deps(dependencies = TRUE)"
-${R_BIN} -e "remotes::install_github('romainfrancois/decor')"
+${R_BIN} -e "remotes::install_github('nealrichardson/decor')"
popd
diff --git a/ci/scripts/r_test.sh b/ci/scripts/r_test.sh
index f0a44d102b..c0bb02cf75 100755
--- a/ci/scripts/r_test.sh
+++ b/ci/scripts/r_test.sh
@@ -26,7 +26,14 @@ pushd ${source_dir}
export LD_LIBRARY_PATH=${ARROW_HOME}/lib:${LD_LIBRARY_PATH}
export R_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
+export ARROW_R_CXXFLAGS='-Werror'
+export TEST_R_WITH_ARROW=TRUE
+export _R_CHECK_TESTS_NLINES_=0
+export _R_CHECK_CRAN_INCOMING_REMOTE_=FALSE
+export _R_CHECK_LIMIT_CORES_=FALSE
+export _R_CHECK_COMPILATION_FLAGS_=FALSE
+export VERSION=$(grep ^Version DESCRIPTION | sed s/Version:\ //)
-${R_BIN} CMD check --no-manual --as-cran arrow_*.tar.gz
+${R_BIN} -e "rcmdcheck::rcmdcheck(build_args = '--no-build-vignettes', args = c('--no-manual', '--as-cran', '--ignore-vignettes'), error_on = 'warning', check_dir = 'check')"
popd
diff --git a/docker-compose.yml b/docker-compose.yml
index 1150e55e26..9c994369d9 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -576,7 +576,6 @@ services:
volumes: *conda-volumes
command:
["/arrow/ci/scripts/cpp_build.sh /arrow /build/cpp &&
- /arrow/ci/scripts/r_build.sh /arrow &&
/arrow/ci/scripts/r_test.sh /arrow"]
ubuntu-r:
@@ -598,8 +597,6 @@ services:
command: >
/bin/bash -c "
/arrow/ci/scripts/cpp_build.sh /arrow /build/cpp &&
- /arrow/ci/scripts/r_deps.sh /arrow &&
- /arrow/ci/scripts/r_build.sh /arrow &&
/arrow/ci/scripts/r_test.sh /arrow"
ubuntu-r-sanitizer: