Unverified Commit c2d2c99f authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[ci] run r-package Linux jobs in containers (#5638)

parent 61e464bc
...@@ -23,8 +23,8 @@ if [[ "${R_MAJOR_VERSION}" == "3" ]]; then ...@@ -23,8 +23,8 @@ if [[ "${R_MAJOR_VERSION}" == "3" ]]; then
elif [[ "${R_MAJOR_VERSION}" == "4" ]]; then elif [[ "${R_MAJOR_VERSION}" == "4" ]]; then
export R_MAC_VERSION=4.2.2 export R_MAC_VERSION=4.2.2
export R_MAC_PKG_URL=${CRAN_MIRROR}/bin/macosx/base/R-${R_MAC_VERSION}.pkg export R_MAC_PKG_URL=${CRAN_MIRROR}/bin/macosx/base/R-${R_MAC_VERSION}.pkg
export R_LINUX_VERSION="4.2.2-1.2004.0" export R_LINUX_VERSION="4.2.2-1.2204.0"
export R_APT_REPO="focal-cran40/" export R_APT_REPO="jammy-cran40/"
else else
echo "Unrecognized R version: ${R_VERSION}" echo "Unrecognized R version: ${R_VERSION}"
exit -1 exit -1
...@@ -38,14 +38,15 @@ fi ...@@ -38,14 +38,15 @@ fi
if [[ $OS_NAME == "linux" ]]; then if [[ $OS_NAME == "linux" ]]; then
sudo apt-key adv \ sudo apt-key adv \
--keyserver keyserver.ubuntu.com \ --keyserver keyserver.ubuntu.com \
--recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 || exit -1
sudo add-apt-repository \ sudo add-apt-repository \
"deb ${CRAN_MIRROR}/bin/linux/ubuntu ${R_APT_REPO}" "deb ${CRAN_MIRROR}/bin/linux/ubuntu ${R_APT_REPO}" || exit -1
sudo apt-get update sudo apt-get update
sudo apt-get install \ sudo apt-get install \
--no-install-recommends \ --no-install-recommends \
-y --allow-downgrades \ -y \
devscripts \ devscripts \
r-base-core=${R_LINUX_VERSION} \
r-base-dev=${R_LINUX_VERSION} \ r-base-dev=${R_LINUX_VERSION} \
texinfo \ texinfo \
texlive-latex-extra \ texlive-latex-extra \
...@@ -60,8 +61,18 @@ if [[ $OS_NAME == "linux" ]]; then ...@@ -60,8 +61,18 @@ if [[ $OS_NAME == "linux" ]]; then
--no-install-recommends \ --no-install-recommends \
-y \ -y \
autoconf=$(cat R-package/AUTOCONF_UBUNTU_VERSION) \ autoconf=$(cat R-package/AUTOCONF_UBUNTU_VERSION) \
automake \
|| exit -1 || exit -1
fi fi
if [[ $INSTALL_CMAKE_FROM_RELEASES == "true" ]]; then
curl -O -L \
https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-linux-x86_64.sh \
|| exit -1
sudo mkdir /opt/cmake || exit -1
sudo sh cmake-3.25.1-linux-x86_64.sh --skip-license --prefix=/opt/cmake || exit -1
sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake || exit -1
fi
fi fi
# Installing R precompiled for Mac OS 10.11 or higher # Installing R precompiled for Mac OS 10.11 or higher
...@@ -211,6 +222,27 @@ if [[ $check_succeeded == "no" ]]; then ...@@ -211,6 +222,27 @@ if [[ $check_succeeded == "no" ]]; then
exit -1 exit -1
fi fi
used_correct_r_version=$(
cat $LOG_FILE_NAME \
| grep --count "using R version ${R_VERSION}"
)
if [[ $used_correct_r_version -ne 1 ]]; then
echo "Unexpected R version was used. Expected '${R_VERSION}'."
exit -1
fi
if [[ $R_BUILD_TYPE == "cmake" ]]; then
passed_correct_r_version_to_cmake=$(
cat $BUILD_LOG_FILE \
| grep --count "R version passed into FindLibR.cmake: ${R_VERSION}"
)
if [[ $used_correct_r_version -ne 1 ]]; then
echo "Unexpected R version was passed into cmake. Expected '${R_VERSION}'."
exit -1
fi
fi
if grep -q -E "NOTE|WARNING|ERROR" "$LOG_FILE_NAME"; then if grep -q -E "NOTE|WARNING|ERROR" "$LOG_FILE_NAME"; then
echo "NOTEs, WARNINGs, or ERRORs have been found by R CMD check" echo "NOTEs, WARNINGs, or ERRORs have been found by R CMD check"
exit -1 exit -1
......
...@@ -30,6 +30,7 @@ jobs: ...@@ -30,6 +30,7 @@ jobs:
test: test:
name: ${{ matrix.task }} (${{ matrix.os }}, ${{ matrix.compiler }}, R ${{ matrix.r_version }}, ${{ matrix.build_type }}) name: ${{ matrix.task }} (${{ matrix.os }}, ${{ matrix.compiler }}, R ${{ matrix.r_version }}, ${{ matrix.build_type }})
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
timeout-minutes: 60 timeout-minutes: 60
strategy: strategy:
fail-fast: false fail-fast: false
...@@ -38,58 +39,68 @@ jobs: ...@@ -38,58 +39,68 @@ jobs:
################ ################
# CMake builds # # CMake builds #
################ ################
- os: ubuntu-22.04 - os: ubuntu-latest
task: r-package task: r-package
compiler: gcc compiler: gcc
r_version: 3.6 r_version: 3.6
build_type: cmake build_type: cmake
- os: ubuntu-22.04 container: 'ubuntu:18.04'
- os: ubuntu-latest
task: r-package task: r-package
compiler: gcc compiler: gcc
r_version: 4.2 r_version: 4.2
build_type: cmake build_type: cmake
- os: ubuntu-22.04 container: 'ubuntu:22.04'
- os: ubuntu-latest
task: r-package task: r-package
compiler: clang compiler: clang
r_version: 3.6 r_version: 3.6
build_type: cmake build_type: cmake
- os: ubuntu-22.04 container: 'ubuntu:18.04'
- os: ubuntu-latest
task: r-package task: r-package
compiler: clang compiler: clang
r_version: 4.2 r_version: 4.2
build_type: cmake build_type: cmake
container: 'ubuntu:22.04'
- os: macOS-latest - os: macOS-latest
task: r-package task: r-package
compiler: gcc compiler: gcc
r_version: 3.6 r_version: 3.6
build_type: cmake build_type: cmake
container: null
- os: macOS-latest - os: macOS-latest
task: r-package task: r-package
compiler: gcc compiler: gcc
r_version: 4.2 r_version: 4.2
build_type: cmake build_type: cmake
container: null
- os: macOS-latest - os: macOS-latest
task: r-package task: r-package
compiler: clang compiler: clang
r_version: 3.6 r_version: 3.6
build_type: cmake build_type: cmake
container: null
- os: macOS-latest - os: macOS-latest
task: r-package task: r-package
compiler: clang compiler: clang
r_version: 4.2 r_version: 4.2
build_type: cmake build_type: cmake
container: null
- os: windows-latest - os: windows-latest
task: r-package task: r-package
compiler: MINGW compiler: MINGW
toolchain: MINGW toolchain: MINGW
r_version: 3.6 r_version: 3.6
build_type: cmake build_type: cmake
container: null
- os: windows-latest - os: windows-latest
task: r-package task: r-package
compiler: MINGW compiler: MINGW
toolchain: MSYS toolchain: MSYS
r_version: 4.2 r_version: 4.2
build_type: cmake build_type: cmake
container: null
# Visual Studio 2019 # Visual Studio 2019
- os: windows-2019 - os: windows-2019
task: r-package task: r-package
...@@ -97,6 +108,7 @@ jobs: ...@@ -97,6 +108,7 @@ jobs:
toolchain: MSVC toolchain: MSVC
r_version: 3.6 r_version: 3.6
build_type: cmake build_type: cmake
container: null
# Visual Studio 2022 # Visual Studio 2022
- os: windows-2022 - os: windows-2022
task: r-package task: r-package
...@@ -104,6 +116,7 @@ jobs: ...@@ -104,6 +116,7 @@ jobs:
toolchain: MSVC toolchain: MSVC
r_version: 4.2 r_version: 4.2
build_type: cmake build_type: cmake
container: null
############### ###############
# CRAN builds # # CRAN builds #
############### ###############
...@@ -113,35 +126,64 @@ jobs: ...@@ -113,35 +126,64 @@ jobs:
toolchain: MINGW toolchain: MINGW
r_version: 3.6 r_version: 3.6
build_type: cran build_type: cran
container: null
- os: windows-latest - os: windows-latest
task: r-package task: r-package
compiler: MINGW compiler: MINGW
toolchain: MSYS toolchain: MSYS
r_version: 4.2 r_version: 4.2
build_type: cran build_type: cran
- os: ubuntu-22.04 container: null
- os: ubuntu-latest
task: r-package task: r-package
compiler: gcc compiler: gcc
r_version: 4.2 r_version: 4.2
build_type: cran build_type: cran
container: 'ubuntu:22.04'
- os: macOS-latest - os: macOS-latest
task: r-package task: r-package
compiler: clang compiler: clang
r_version: 4.2 r_version: 4.2
build_type: cran build_type: cran
container: null
################ ################
# Other checks # # Other checks #
################ ################
- os: ubuntu-22.04 - os: ubuntu-latest
task: r-rchk task: r-rchk
compiler: gcc compiler: gcc
r_version: 4.2 r_version: 4.2
build_type: cran build_type: cran
container: 'ubuntu:22.04'
steps: steps:
- name: Prevent conversion of line endings on Windows - name: Prevent conversion of line endings on Windows
if: startsWith(matrix.os, 'windows') if: startsWith(matrix.os, 'windows')
shell: pwsh shell: pwsh
run: git config --global core.autocrlf false run: git config --global core.autocrlf false
- name: Install packages used by third-party actions
if: startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
apt-get update -y
apt-get install --no-install-recommends -y \
ca-certificates \
dirmngr \
gpg \
gpg-agent \
software-properties-common \
sudo
# install newest version of git
# ref:
# - https://unix.stackexchange.com/a/170831/550004
# - https://git-scm.com/download/linux
add-apt-repository ppa:git-core/ppa -y
apt-get update -y
apt-get install --no-install-recommends -y \
git
- name: Trust git cloning LightGBM
if: startsWith(matrix.os, 'ubuntu')
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
...@@ -156,7 +198,7 @@ jobs: ...@@ -156,7 +198,7 @@ jobs:
CTAN_MIRROR: https://ctan.math.illinois.edu/systems/win32/miktex CTAN_MIRROR: https://ctan.math.illinois.edu/systems/win32/miktex
TINYTEX_INSTALLER: TinyTeX TINYTEX_INSTALLER: TinyTeX
- name: Setup and run tests on Linux and macOS - name: Setup and run tests on Linux and macOS
if: matrix.os == 'macOS-latest' || matrix.os == 'ubuntu-22.04' if: matrix.os == 'macOS-latest' || matrix.os == 'ubuntu-latest'
shell: bash shell: bash
run: | run: |
export TASK="${{ matrix.task }}" export TASK="${{ matrix.task }}"
...@@ -164,8 +206,14 @@ jobs: ...@@ -164,8 +206,14 @@ jobs:
export GITHUB_ACTIONS="true" export GITHUB_ACTIONS="true"
if [[ "${{ matrix.os }}" == "macOS-latest" ]]; then if [[ "${{ matrix.os }}" == "macOS-latest" ]]; then
export OS_NAME="macos" export OS_NAME="macos"
elif [[ "${{ matrix.os }}" == "ubuntu-22.04" ]]; then elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
export OS_NAME="linux" export OS_NAME="linux"
export IN_UBUNTU_BASE_CONTAINER="true"
# the default version of cmake provided on Ubuntu 18.04 (v3.10.2), is not supported by LightGBM
# see https://github.com/microsoft/LightGBM/issues/5642
if [[ "${{ matrix.container }}" == "ubuntu:18.04" ]]; then
export INSTALL_CMAKE_FROM_RELEASES="true"
fi
fi fi
export BUILD_DIRECTORY="$GITHUB_WORKSPACE" export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
export R_VERSION="${{ matrix.r_version }}" export R_VERSION="${{ matrix.r_version }}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment