Skip to content

Commit

Permalink
[R-package] [ci] remove unnecessary include in linear_tree_learner (f…
Browse files Browse the repository at this point in the history
…ixes #6264) (#6265)
  • Loading branch information
jameslamb committed Jan 17, 2024
1 parent ef2a49c commit 255c93b
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 41 deletions.
71 changes: 71 additions & 0 deletions .ci/install-clang-devel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

# [description]
#
# Installs a development version of clang and the other LLVM tools.
#

set -e -E -u -o pipefail

CLANG_VERSION=${1}

apt-get autoremove -y --purge \
clang-* \
libclang-* \
libunwind-* \
llvm-*

apt-get update -y
apt-get install --no-install-recommends -y \
gnupg \
lsb-release \
software-properties-common \
wget

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"

apt-get install -y --no-install-recommends \
clang-${CLANG_VERSION} \
clangd-${CLANG_VERSION} \
clang-format-${CLANG_VERSION} \
clang-tidy-${CLANG_VERSION} \
clang-tools-${CLANG_VERSION} \
lldb-${CLANG_VERSION} \
lld-${CLANG_VERSION} \
llvm-${CLANG_VERSION}-dev \
llvm-${CLANG_VERSION}-tools \
libomp-${CLANG_VERSION}-dev \
libc++-${CLANG_VERSION}-dev \
libc++abi-${CLANG_VERSION}-dev \
libclang-common-${CLANG_VERSION}-dev \
libclang-${CLANG_VERSION}-dev \
libclang-cpp${CLANG_VERSION}-dev \
libunwind-${CLANG_VERSION}-dev

# overwriting the stuff in /usr/bin is simpler and more reliable than
# updating PATH, LD_LIBRARY_PATH, etc.
cp --remove-destination /usr/lib/llvm-${CLANG_VERSION}/bin/* /usr/bin/

# per https://www.stats.ox.ac.uk/pub/bdr/Rconfig/r-devel-linux-x86_64-fedora-clang
#
# clang was built to use libc++: for a version built to default to libstdc++
# (as shipped by Fedora/Debian/Ubuntu), add -stdlib=libc++ to CXX
# and install the libcxx-devel/libc++-dev package.
mkdir -p "${HOME}/.R"

cat << EOF > "${HOME}/.R/Makevars"
CXX += -stdlib=libc++
CXX11 += -stdlib=libc++
CXX14 += -stdlib=libc++
CXX17 += -stdlib=libc++
CXX20 += -stdlib=libc++
EOF

echo ""
echo "done installing clang"
clang --version
echo ""
59 changes: 19 additions & 40 deletions .github/workflows/r_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,21 @@ jobs:
cat ./tests.log
exit ${exit_code}
test-r-debian-clang:
name: r-package (debian, R-devel, clang)
name: r-package (debian, 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
- 18
runs-on: ubuntu-latest
container: rhub/debian-clang-devel
env:
DEBIAN_FRONTEND: noninteractive
steps:
- name: Install Git before checkout
shell: bash
Expand All @@ -276,53 +287,21 @@ jobs:
with:
fetch-depth: 5
submodules: true
- name: update to clang 15
shell: bash
- name: install clang
run: |
# remove clang stuff that comes installed in the image
apt-get autoremove -y --purge \
clang-* \
libclang-* \
libunwind-* \
llvm-*
#
# replace it all with clang-15
apt-get update -y
apt-get install --no-install-recommends -y \
gnupg \
lsb-release \
software-properties-common \
wget
#
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
#
add-apt-repository "deb http://apt.llvm.org/unstable/ llvm-toolchain main"
apt-get install -y --no-install-recommends \
clang-15 \
clangd-15 \
clang-format-15 \
clang-tidy-15 \
clang-tools-15 \
lldb-15 \
lld-15 \
llvm-15-dev \
llvm-15-tools \
libomp-15-dev \
libc++-15-dev \
libc++abi-15-dev \
libclang-common-15-dev \
libclang-15-dev \
libclang-cpp15-dev \
libunwind-15-dev
# overwrite everything in /usr/bin with the new v15 versions
cp --remove-destination /usr/lib/llvm-15/bin/* /usr/bin/
./.ci/install-clang-devel.sh ${{ matrix.clang-version }}
- name: Install packages and run tests
shell: bash
run: |
export PATH=/opt/R-devel/bin/:${PATH}
Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())"
sh build-cran-package.sh
R CMD check --as-cran --run-donttest lightgbm_*.tar.gz || exit -1
echo ""
echo "install logs:"
echo ""
cat lightgbm.Rcheck/00install.out
echo ""
if grep -q -E "NOTE|WARNING|ERROR" lightgbm.Rcheck/00check.log; then
echo "NOTEs, WARNINGs, or ERRORs have been found by R CMD check"
exit -1
Expand Down
1 change: 0 additions & 1 deletion src/treelearner/linear_tree_learner.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#ifndef LIGHTGBM_TREELEARNER_LINEAR_TREE_LEARNER_H_
#define LIGHTGBM_TREELEARNER_LINEAR_TREE_LEARNER_H_

#include <string>
#include <cmath>
#include <cstdio>
#include <memory>
Expand Down

0 comments on commit 255c93b

Please sign in to comment.