Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions ci/docker/alpine-linux-3.22-r.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 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.

# Minimal Alpine Linux container with R for testing Arrow R package
# on musl libc (CRAN runs checks on Alpine Linux 3.22)
# Replicates CRAN's Alpine environment as closely as possible

ARG arch=amd64
FROM ${arch}/alpine:3.22

# Install R and essential build tools
# Note: bash is needed for Arrow CI scripts, even though CRAN's Alpine uses BusyBox
RUN apk add \
R \
R-dev \
R-doc \
bash \
checkbashisms \
cmake \
curl-dev \
g++ \
gcc \
git \
linux-headers \
make \
musl-locales \
openssl-dev \
pkgconfig \
zlib-dev && \
rm -rf /var/cache/apk/* && \
ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
echo "Etc/UTC" > /etc/timezone

# Set locale and timezone
ENV LANG=C.UTF-8 \
LC_COLLATE=C \
MUSL_LOCPATH=/usr/share/i18n/locales/musl

# Set CRAN repo
RUN echo 'options(repos = c(CRAN = "https://cran.rstudio.com"))' >> /usr/lib/R/etc/Rprofile.site

# Install pak for package management (following rhub pattern)
RUN R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "devel", .Platform$pkgType, R.Version()$os, R.Version()$arch))'

# Enable automatic system requirements installation
ENV PKG_SYSREQS=true \
R_PKG_SYSREQS2=true

# Set up parallel compilation
RUN echo "MAKEFLAGS=-j$(R -s -e 'cat(parallel::detectCores())')" >> /usr/lib/R/etc/Renviron.site

# Configure image and install Arrow-specific tooling
COPY ci/scripts/r_docker_configure.sh /arrow/ci/scripts/
COPY ci/etc/rprofile /arrow/ci/etc/
COPY ci/scripts/r_install_system_dependencies.sh /arrow/ci/scripts/
COPY ci/scripts/install_minio.sh /arrow/ci/scripts/
COPY ci/scripts/install_gcs_testbench.sh /arrow/ci/scripts/
RUN /arrow/ci/scripts/r_docker_configure.sh

# Install sccache
COPY ci/scripts/install_sccache.sh /arrow/ci/scripts/
RUN /arrow/ci/scripts/install_sccache.sh unknown-linux-musl /usr/local/bin

# Install R package dependencies
COPY ci/scripts/r_deps.sh /arrow/ci/scripts/
COPY r/DESCRIPTION /arrow/r/
RUN /arrow/ci/scripts/r_deps.sh /arrow

# Verify R works and this is musl
RUN R --version && ldd --version 2>&1 | grep -q musl
16 changes: 13 additions & 3 deletions ci/scripts/r_docker_configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ elif [ "`which yum`" ]; then
PACKAGE_MANAGER=yum
elif [ "`which zypper`" ]; then
PACKAGE_MANAGER=zypper
elif [ "`which apk`" ]; then
PACKAGE_MANAGER=apk
else
PACKAGE_MANAGER=apt-get
apt-get update --allow-releaseinfo-change # flag needed for when debian version changes
Expand All @@ -49,8 +51,12 @@ fi
R_CUSTOM_CCACHE=`echo $R_CUSTOM_CCACHE | tr '[:upper:]' '[:lower:]'`
if [ ${R_CUSTOM_CCACHE} = "true" ]; then
# install ccache
$PACKAGE_MANAGER install -y epel-release || true
$PACKAGE_MANAGER install -y ccache
if [ "$PACKAGE_MANAGER" = "apk" ]; then
$PACKAGE_MANAGER add ccache
else
$PACKAGE_MANAGER install -y epel-release || true
$PACKAGE_MANAGER install -y ccache
fi

mkdir -p ~/.R
echo "VER=
Expand All @@ -73,7 +79,11 @@ fi

# Install rsync for bundling cpp source and curl to make sure it is installed on all images,
# cmake is now a listed sys req.
$PACKAGE_MANAGER install -y rsync cmake curl
if [ "$PACKAGE_MANAGER" = "apk" ]; then
$PACKAGE_MANAGER add rsync cmake curl
else
$PACKAGE_MANAGER install -y rsync cmake curl
fi

# Update clang version to latest available.
# This is only for rhub/clang20. If we change the base image from rhub/clang20,
Expand Down
10 changes: 10 additions & 0 deletions ci/scripts/r_install_system_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ elif [ "`which yum`" ]; then
PACKAGE_MANAGER=yum
elif [ "`which zypper`" ]; then
PACKAGE_MANAGER=zypper
elif [ "`which apk`" ]; then
PACKAGE_MANAGER=apk
else
PACKAGE_MANAGER=apt-get
apt-get update
Expand All @@ -39,6 +41,9 @@ case "$PACKAGE_MANAGER" in
apt-get)
apt-get install -y libcurl4-openssl-dev libssl-dev
;;
apk)
$PACKAGE_MANAGER add curl-dev openssl-dev
;;
*)
$PACKAGE_MANAGER install -y libcurl-devel openssl-devel
;;
Expand All @@ -59,6 +64,11 @@ if [ "$ARROW_S3" == "ON" ] || [ "$ARROW_GCS" == "ON" ] || [ "$ARROW_R_DEV" == "T
ln -s /usr/bin/python3.10 /usr/local/bin/python
ln -s /usr/bin/pip3.10 /usr/local/bin/pip
;;
apk)
$PACKAGE_MANAGER add py3-pip
ln -s /usr/bin/python3 /usr/local/bin/python
ln -s /usr/bin/pip3 /usr/local/bin/pip
;;
*)
$PACKAGE_MANAGER install -y python3-pip
ln -s /usr/bin/python3 /usr/local/bin/python
Expand Down
32 changes: 32 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ x-hierarchy:
# service entry, so any new image/service must be listed here.
- almalinux-verify-rc
- alpine-linux-cpp
- alpine-linux-r
- centos-cpp-static
- conda:
- conda-cpp:
Expand Down Expand Up @@ -1774,6 +1775,37 @@ services:
command: >
/bin/bash -c "/arrow/ci/scripts/r_revdepcheck.sh /arrow"

alpine-linux-r:
# Usage:
# docker compose build alpine-linux-r
# docker compose run alpine-linux-r
# Tests R package installation on musl (Alpine Linux) for CRAN checks.
# R package builds C++ from source (bundled RE2 2023-03-01 supports musl).
# Parameters:
# ALPINE_LINUX: 3.22
# R: 4.5 (Alpine's R version)
# ARCH: amd64, arm64v8, ...
image: ${REPO}:${ARCH}-alpine-linux-${ALPINE_LINUX}-r
build:
context: .
dockerfile: ci/docker/alpine-linux-${ALPINE_LINUX}-r.dockerfile
cache_from:
- ${REPO}:${ARCH}-alpine-linux-${ALPINE_LINUX}-r
args:
arch: ${ARCH}
shm_size: *shm-size
environment:
<<: [*common, *sccache]
LIBARROW_BINARY: "false"
ARROW_SOURCE_HOME: "/arrow"
ARROW_R_DEV: ${ARROW_R_DEV}
ARROW_USE_PKG_CONFIG: "false"
SKIP_VIGNETTES: "true"
NOT_CRAN: "false"
volumes:
- .:/arrow:delegated
command: /arrow/ci/scripts/r_test.sh /arrow

############################## Integration ##################################

conda-integration:
Expand Down
6 changes: 6 additions & 0 deletions dev/tasks/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,12 @@ tasks:
ci: github
template: r/github.linux.cran.yml

test-r-alpine-linux-cran:
ci: github
template: docker-tests/github.linux.yml
params:
image: alpine-linux-r

test-r-macos-as-cran:
ci: github
template: r/github.macos.cran.yml
Expand Down
2 changes: 1 addition & 1 deletion r/src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ PKG_LIBS=@libs@
all: $(SHLIB) purify

purify: $(SHLIB)
@rm -rf ../{libarrow,windows} || true
@rm -rf ../libarrow ../windows || true
Loading