Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: [ci] [R-package] re-enable clang-18 testing (fixes #6369) #6381

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 55 additions & 5 deletions .ci/install-clang-devel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,30 @@
#
# Installs a development version of clang and the other LLVM tools.
#
# Supported operating systems:
#
# - Debian
# - Ubuntu
#
# [usage]
#
# ./install-clang-devel.sh 18
#

set -e -E -u -o pipefail

CLANG_VERSION=${1}

# get short name, e.g. 'debian', 'ubuntu'
OS_NAME=$(
cat /etc/os-release \
| grep -E '^NAME' \
| cut -d '=' -f2 \
| cut -d ' ' -f1 \
| tr -d '"' \
| tr '[:upper:]' '[:lower:]'
)

apt-get autoremove -y --purge \
clang-* \
libclang-* \
Expand All @@ -25,10 +44,17 @@ apt-get install --no-install-recommends -y \
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -

# ref: https://apt.llvm.org/
add-apt-repository -y "deb http://apt.llvm.org/unstable/ llvm-toolchain main"
add-apt-repository -y "deb-src http://apt.llvm.org/unstable/ llvm-toolchain main"
add-apt-repository -y "deb http://apt.llvm.org/unstable/ llvm-toolchain-${CLANG_VERSION} main" || true
add-apt-repository -y "deb-src http://apt.llvm.org/unstable/ llvm-toolchain-${CLANG_VERSION} main" || true
if [[ ${OS_NAME} == "debian" ]]; then
add-apt-repository -y "deb [trusted=yes] http://apt.llvm.org/unstable/ llvm-toolchain main"
add-apt-repository -y "deb-src [trusted=yes] http://apt.llvm.org/unstable/ llvm-toolchain main"
add-apt-repository -y "deb [trusted=yes] http://apt.llvm.org/unstable/ llvm-toolchain-${CLANG_VERSION} main" || true
add-apt-repository -y "deb-src [trusted=yes] http://apt.llvm.org/unstable/ llvm-toolchain-${CLANG_VERSION} main" || true
elif [[ ${OS_NAME} == "ubuntu" ]]; then
UBUNTU_CODENAME=$(lsb_release --codename --short)
add-apt-repository -y "deb http://apt.llvm.org/jammy/ llvm-toolchain-${UBUNTU_CODENAME}-${CLANG_VERSION} main"
add-apt-repository -y "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-${UBUNTU_CODENAME}-${CLANG_VERSION} main"
fi

apt-get update -y

apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -60,12 +86,36 @@ cp --remove-destination /usr/lib/llvm-${CLANG_VERSION}/bin/* /usr/bin/
# and install the libcxx-devel/libc++-dev package.
mkdir -p "${HOME}/.R"

cat << EOF > "${HOME}/.R/Makevars"
# populate ~/.R/Makevars with all configuration R recognizes
#
# The grep for lines with '=' handles other non-parseable output that
# 'R CMD config --all' prints.
#
# For more details, see the "R config" sections at
# https://r-hub.github.io/containers/containers.html
R CMD config --all \
| grep -E '.*=.*' \
> "${HOME}/.R/Makevars"

# Replace all uses of LLVM stuff with the version of clang requested
sed \
-i=.bak \
-E "s|clang\-[0-9]+|clang-${CLANG_VERSION}|g" \
"${HOME}/.R/Makevars"

sed \
-i=.bak \
-E "s|clang\+\+\-[0-9]+|clang\+\+-${CLANG_VERSION}|g" \
"${HOME}/.R/Makevars"

# ensure that -stdlib=libc++ is used for all the CXX variables
cat << EOF >> "${HOME}/.R/Makevars"
CXX += -stdlib=libc++
CXX11 += -stdlib=libc++
CXX14 += -stdlib=libc++
CXX17 += -stdlib=libc++
CXX20 += -stdlib=libc++
CXX23 += -stdlib=libc++
EOF

echo ""
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/r_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,26 @@ jobs:
RDscript${{ matrix.r_customization }} testthat.R >> tests.log 2>&1 || exit_code=-1
cat ./tests.log
exit ${exit_code}
test-r-debian-clang:
name: r-package (debian, R-devel, clang-${{ matrix.clang-version }})
test-r-devel-clang:
name: r-package (${{ matrix.os }}, R-devel, clang-${{ matrix.clang-version }})
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
# list of versions tested in CRAN "Additional Checks":
# https://cran.r-project.org/web/checks/check_issue_kinds.html
clang-version:
- 16
- 17
include:
- clang-version: 16
container: rhub/debian-clang-devel
os: debian
- clang-version: 17
container: rhub/debian-clang-devel
os: debian
- clang-version: 18
container: ghcr.io/r-hub/containers/ubuntu-clang
os: ubuntu
runs-on: ubuntu-latest
container: rhub/debian-clang-devel
container: ${{ matrix.container }}
env:
DEBIAN_FRONTEND: noninteractive
steps:
Expand All @@ -284,6 +291,7 @@ jobs:
submodules: true
- name: install clang
run: |
export PATH=/opt/R-devel/bin/:${PATH}
./.ci/install-clang-devel.sh ${{ matrix.clang-version }}
- name: Install packages and run tests
shell: bash
Expand All @@ -304,7 +312,7 @@ jobs:
all-r-package-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs: [test, test-r-sanitizers, test-r-debian-clang]
needs: [test, test-r-sanitizers, test-r-devel-clang]
steps:
- name: Note that all tests succeeded
uses: re-actors/[email protected]
Expand Down