From 46a8cc71b7744df657eb97e5db0fc75e401934c9 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 2 Sep 2024 22:28:59 -0500 Subject: [PATCH 1/5] [docker] fix dockerfiles, test docker builds in CI --- docker/dockerfile-cli | 14 +++++++------- docker/dockerfile-python | 13 ++++++------- docker/dockerfile-r | 6 ++++-- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/docker/dockerfile-cli b/docker/dockerfile-cli index 63c3e1f3d32c..55179e1ef7dd 100644 --- a/docker/dockerfile-cli +++ b/docker/dockerfile-cli @@ -1,36 +1,36 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 ENV \ DEBIAN_FRONTEND=noninteractive \ LANG=C.UTF-8 \ LC_ALL=C.UTF-8 +ARG LIGHTGBM_GIT_REF=stable + RUN apt-get update -y && \ apt-get install -y --no-install-recommends \ ca-certificates \ curl \ build-essential \ - gcc \ - g++ \ git \ libomp-dev && \ rm -rf /var/lib/apt/lists/* -RUN curl -L -o cmake.sh https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-linux-x86_64.sh && \ +RUN curl -L -o cmake.sh https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-linux-$(arch).sh && \ chmod +x cmake.sh && \ sh ./cmake.sh --prefix=/usr/local --skip-license && \ rm cmake.sh RUN git clone \ --recursive \ - --branch stable \ + --branch ${LIGHTGBM_GIT_REF} \ --depth 1 \ https://github.com/Microsoft/LightGBM && \ cd ./LightGBM && \ cmake -B build -S . && \ cmake --build build -j4 && \ cmake --install build && \ - cd "${HOME}" && \ - rm -rf LightGBM + cd .. && \ + rm -rf ./LightGBM ENTRYPOINT ["lightgbm"] diff --git a/docker/dockerfile-python b/docker/dockerfile-python index 900d05c30012..231eafc675f7 100644 --- a/docker/dockerfile-python +++ b/docker/dockerfile-python @@ -1,6 +1,7 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 ARG CONDA_DIR=/opt/miniforge +ARG LIGHTGBM_GIT_REF=stable ENV \ DEBIAN_FRONTEND=noninteractive \ @@ -13,22 +14,20 @@ RUN apt-get update && \ ca-certificates \ cmake \ build-essential \ - gcc \ - g++ \ curl \ git \ libomp-dev && \ # python environment - curl -sL https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -o miniforge.sh && \ + curl -sL https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-$(arch).sh -o miniforge.sh && \ /bin/bash miniforge.sh -f -b -p $CONDA_DIR && \ - export PATH="$CONDA_DIR/bin:$PATH" && \ conda config --set always_yes yes --set changeps1 no && \ # lightgbm conda install -q -y numpy scipy scikit-learn pandas && \ - git clone --recursive --branch stable --depth 1 https://github.com/Microsoft/LightGBM && \ + git clone --recursive --branch ${LIGHTGBM_GIT_REF} --depth 1 https://github.com/Microsoft/LightGBM && \ cd ./LightGBM && \ sh ./build-python.sh install && \ # clean apt-get autoremove -y && apt-get clean && \ conda clean -a -y && \ - rm -rf /usr/local/src/* + cd .. && \ + rm -rf ./LightGBM diff --git a/docker/dockerfile-r b/docker/dockerfile-r index 65c20165f83e..19af3ccffc8e 100644 --- a/docker/dockerfile-r +++ b/docker/dockerfile-r @@ -1,16 +1,18 @@ ARG R_VERSION=latest FROM rocker/verse:${R_VERSION} +ARG LIGHTGBM_GIT_REF=stable + RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ libomp-dev && \ git clone \ --recursive \ - --branch stable \ + --branch ${LIGHTGBM_GIT_REF} \ --depth 1 https://github.com/Microsoft/LightGBM && \ cd ./LightGBM && \ sh build-cran-package.sh --no-build-vignettes && \ - R CMD INSTALL ./lightgbm_*.tar.gz && \ + MAKEFLAGS="-j2" R CMD INSTALL ./lightgbm_*.tar.gz && \ cd .. && \ rm -rf ./LightGBM From 0c5581e2b6862b85a9daa2d87525e654ae939305 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 2 Sep 2024 22:37:09 -0500 Subject: [PATCH 2/5] add CI job --- .github/workflows/docker.yml | 64 +++++++++++++++++++ docker/gpu/dockerfile-cli-only-distroless.gpu | 3 +- docker/gpu/dockerfile-cli-only.gpu | 3 +- docker/gpu/dockerfile.gpu | 3 +- 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000000..89b2a4fe7b5a --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,64 @@ +name: Docker + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +# automatically cancel in-progress builds if another commit is pushed +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: dockerfile-cli + shell: + docker build \ + --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + - < ./docker/dockerfile-python + - name: dockerfile-r + shell: + docker build \ + --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + - < ./docker/dockerfile-r + - name: dockerfile-python + shell: + docker build \ + --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + - < ./docker/dockerfile-python + - name: dockerfile.gpu + shell: + docker build \ + --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + - < ./docker/gpu/dockerfile.gpu + - name: dockerfile-cli-only.gpu + shell: + docker build \ + --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + - < ./docker/gpu/dockerfile-cli-only.gpu + - name: dockerfile-cli-only-distroless.gpu + shell: + docker build \ + --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + - < ./docker/gpu/dockerfile-cli-only-distroless.gpu + all-docker-jobs-successful: + if: always() + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Note that all tests succeeded + uses: re-actors/alls-green@v1.2.2 + with: + jobs: ${{ toJSON(needs) }} diff --git a/docker/gpu/dockerfile-cli-only-distroless.gpu b/docker/gpu/dockerfile-cli-only-distroless.gpu index b195d427fc1c..97a9aea87b2b 100644 --- a/docker/gpu/dockerfile-cli-only-distroless.gpu +++ b/docker/gpu/dockerfile-cli-only-distroless.gpu @@ -17,6 +17,7 @@ FROM nvidia/opencl:devel-ubuntu18.04 AS build ARG DEBIAN_FRONTEND=noninteractive +ARG LIGHTGBM_GIT_REF=stable ARG OPENCL_LIBRARIES=/usr/lib/x86_64-linux-gnu ARG OPENCL_INCLUDE_DIR=/usr/include/CL @@ -39,7 +40,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # LightGBM WORKDIR /opt -RUN git clone --recursive --branch stable --depth 1 https://github.com/Microsoft/LightGBM && \ +RUN git clone --recursive --branch ${LIGHTGBM_GIT_REF} --depth 1 https://github.com/Microsoft/LightGBM && \ cd LightGBM && \ cmake -B build -S . -DUSE_GPU=1 -DOpenCL_LIBRARY=${OPENCL_LIBRARIES}/libOpenCL.so.1 -DOpenCL_INCLUDE_DIR=$OPENCL_INCLUDE_DIR && \ OPENCL_HEADERS=$OPENCL_INCLUDE_DIR LIBOPENCL=$OPENCL_LIBRARIES cmake --build build diff --git a/docker/gpu/dockerfile-cli-only.gpu b/docker/gpu/dockerfile-cli-only.gpu index baec8a7e0841..7333f4810907 100644 --- a/docker/gpu/dockerfile-cli-only.gpu +++ b/docker/gpu/dockerfile-cli-only.gpu @@ -17,6 +17,7 @@ FROM nvidia/opencl:devel AS build ARG DEBIAN_FRONTEND=noninteractive +ARG LIGHTGBM_GIT_REF=stable ARG OPENCL_LIBRARIES=/usr/lib/x86_64-linux-gnu ARG OPENCL_INCLUDE_DIR=/usr/include/CL @@ -39,7 +40,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # LightGBM WORKDIR /opt -RUN git clone --recursive --branch stable --depth 1 https://github.com/Microsoft/LightGBM && \ +RUN git clone --recursive --branch ${LIGHTGBM_GIT_REF} --depth 1 https://github.com/Microsoft/LightGBM && \ cd LightGBM && \ cmake -B build -S . -DUSE_GPU=1 -DOpenCL_LIBRARY=${OPENCL_LIBRARIES}/libOpenCL.so.1 -DOpenCL_INCLUDE_DIR=$OPENCL_INCLUDE_DIR && \ OPENCL_HEADERS=$OPENCL_INCLUDE_DIR LIBOPENCL=$OPENCL_LIBRARIES cmake --build build diff --git a/docker/gpu/dockerfile.gpu b/docker/gpu/dockerfile.gpu index 48d99dcd0859..fab9362cf5bb 100644 --- a/docker/gpu/dockerfile.gpu +++ b/docker/gpu/dockerfile.gpu @@ -7,6 +7,7 @@ FROM nvidia/cuda:8.0-cudnn5-devel ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 ARG DEBIAN_FRONTEND=noninteractive +ARG LIGHTGBM_GIT_REF=stable ################################################################################################################# # Global Path Setting @@ -81,7 +82,7 @@ RUN conda config --set always_yes yes --set changeps1 no && \ ################################################################################################################# RUN cd /usr/local/src && mkdir lightgbm && cd lightgbm && \ - git clone --recursive --branch stable --depth 1 https://github.com/microsoft/LightGBM && \ + git clone --recursive --branch ${LIGHTGBM_GIT_REF} --depth 1 https://github.com/microsoft/LightGBM && \ cd LightGBM && \ cmake -B build -S . -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ && \ OPENCL_HEADERS=/usr/local/cuda-8.0/targets/x86_64-linux/include LIBOPENCL=/usr/local/cuda-8.0/targets/x86_64-linux/lib cmake --build build From 9afebc9a4ce870e92730e89dd63133752894e03f Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 2 Sep 2024 22:46:05 -0500 Subject: [PATCH 3/5] run not shell --- .github/workflows/docker.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 89b2a4fe7b5a..f760eb9c578d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -24,32 +24,32 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: dockerfile-cli - shell: + run: | docker build \ --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ - < ./docker/dockerfile-python - name: dockerfile-r - shell: + run: | docker build \ --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ - < ./docker/dockerfile-r - name: dockerfile-python - shell: + run: | docker build \ --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ - < ./docker/dockerfile-python - name: dockerfile.gpu - shell: + run: | docker build \ --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ - < ./docker/gpu/dockerfile.gpu - name: dockerfile-cli-only.gpu - shell: + run: | docker build \ --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ - < ./docker/gpu/dockerfile-cli-only.gpu - name: dockerfile-cli-only-distroless.gpu - shell: + run: | docker build \ --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ - < ./docker/gpu/dockerfile-cli-only-distroless.gpu From 90f80903a9df2f9d8169c24d8426f732f2c8d1e1 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 2 Sep 2024 22:51:14 -0500 Subject: [PATCH 4/5] use SHA --- .appveyor.yml | 42 --- .github/workflows/cuda.yml | 136 -------- .github/workflows/docker.yml | 12 +- .github/workflows/python_package.yml | 155 --------- .github/workflows/r_package.yml | 344 ------------------- .vsts-ci.yml | 481 --------------------------- 6 files changed, 6 insertions(+), 1164 deletions(-) delete mode 100644 .appveyor.yml delete mode 100644 .github/workflows/cuda.yml delete mode 100644 .github/workflows/python_package.yml delete mode 100644 .github/workflows/r_package.yml delete mode 100644 .vsts-ci.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 3819447db96b..000000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,42 +0,0 @@ -version: 4.5.0.99.{build} - -image: Visual Studio 2015 -platform: x64 -configuration: - - '3.8' - -# only build on 'master' and pull requests targeting it -branches: - only: - - master - -environment: - matrix: - - COMPILER: MSVC - TASK: python - - COMPILER: MINGW - TASK: python - -clone_depth: 5 - -install: - - git submodule update --init --recursive # get `external_libs` folder - - set PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH% - - set PYTHON_VERSION=%CONFIGURATION% - - ps: | - $env:ALLOW_SKIP_ARROW_TESTS = "1" - $env:APPVEYOR = "true" - $env:CMAKE_BUILD_PARALLEL_LEVEL = 4 - $env:MINICONDA = "C:\Miniconda3-x64" - $env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH" - $env:BUILD_SOURCESDIRECTORY = "$env:APPVEYOR_BUILD_FOLDER" - -build: false - -test_script: - - conda config --remove channels defaults - - conda config --add channels nodefaults - - conda config --add channels conda-forge - - conda config --set channel_priority strict - - conda init powershell - - powershell.exe -ExecutionPolicy Bypass -File %APPVEYOR_BUILD_FOLDER%\.ci\test-windows.ps1 diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml deleted file mode 100644 index 6c32db1a2ed8..000000000000 --- a/.github/workflows/cuda.yml +++ /dev/null @@ -1,136 +0,0 @@ -name: CUDA Version - -on: - push: - branches: - - master - pull_request: - branches: - - master - # Run manually by clicking a button in the UI - workflow_dispatch: - inputs: - restart_docker: - description: 'Restart nvidia-docker on the runner before building?' - required: true - type: boolean - default: false - -# automatically cancel in-progress builds if another commit is pushed -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - # Optionally reinstall + restart docker on the runner before building. - # This is safe as long as only 1 of these jobs runs at a time. - restart-docker: - name: set up docker - runs-on: [self-hosted, linux] - timeout-minutes: 30 - steps: - - name: Setup or update software on host machine - if: ${{ inputs.restart_docker }} - run: | - # install core packages - sudo apt-get update - sudo apt-get install --no-install-recommends -y \ - apt-transport-https \ - ca-certificates \ - curl \ - gnupg-agent \ - lsb-release \ - software-properties-common - # set up nvidia-docker - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" -y - curl -sL https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - - curl -sL https://nvidia.github.io/nvidia-docker/$(. /etc/os-release;echo $ID$VERSION_ID)/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list - sudo apt-get update - sudo apt-get install --no-install-recommends -y \ - containerd.io \ - docker-ce \ - docker-ce-cli \ - nvidia-docker2 - sudo chmod a+rw /var/run/docker.sock - sudo systemctl restart docker - - name: mark job successful - run: | - exit 0 - test: - name: ${{ matrix.task }} ${{ matrix.cuda_version }} ${{ matrix.method }} (${{ matrix.linux_version }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }}) - runs-on: [self-hosted, linux] - needs: [restart-docker] - container: - image: nvcr.io/nvidia/cuda:${{ matrix.cuda_version }}-devel-${{ matrix.linux_version }} - env: - CMAKE_BUILD_PARALLEL_LEVEL: 4 - COMPILER: ${{ matrix.compiler }} - CONDA: /tmp/miniforge - DEBIAN_FRONTEND: noninteractive - METHOD: ${{ matrix.method }} - OS_NAME: linux - PYTHON_VERSION: ${{ matrix.python_version }} - TASK: ${{ matrix.task }} - SKBUILD_STRICT_CONFIG: true - options: --gpus all - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - include: - - method: wheel - compiler: gcc - python_version: "3.10" - cuda_version: "11.8.0" - linux_version: "ubuntu20.04" - task: cuda - - method: source - compiler: gcc - python_version: "3.12" - cuda_version: "12.2.0" - linux_version: "ubuntu22.04" - task: cuda - - method: pip - compiler: clang - python_version: "3.11" - cuda_version: "11.8.0" - linux_version: "ubuntu20.04" - task: cuda - steps: - - name: Install latest git and sudo - run: | - apt-get update - apt-get install --no-install-recommends -y \ - ca-certificates \ - software-properties-common - add-apt-repository ppa:git-core/ppa -y - apt-get update - apt-get install --no-install-recommends -y \ - git \ - sudo - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 5 - submodules: true - - name: Setup and run tests - run: | - export BUILD_DIRECTORY="$GITHUB_WORKSPACE" - export PATH=$CONDA/bin:$PATH - - # check GPU usage - nvidia-smi - - # build and test - $GITHUB_WORKSPACE/.ci/setup.sh - $GITHUB_WORKSPACE/.ci/test.sh - all-cuda-jobs-successful: - if: always() - runs-on: ubuntu-latest - needs: [test] - steps: - - name: Note that all tests succeeded - uses: re-actors/alls-green@v1.2.2 - with: - jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f760eb9c578d..df3a7e36fa7b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -26,32 +26,32 @@ jobs: - name: dockerfile-cli run: | docker build \ - --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + --build-arg LIGHTGBM_GIT_REF=${{ github.sha }} \ - < ./docker/dockerfile-python - name: dockerfile-r run: | docker build \ - --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + --build-arg LIGHTGBM_GIT_REF=${{ github.sha }} \ - < ./docker/dockerfile-r - name: dockerfile-python run: | docker build \ - --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + --build-arg LIGHTGBM_GIT_REF=${{ github.sha }} \ - < ./docker/dockerfile-python - name: dockerfile.gpu run: | docker build \ - --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + --build-arg LIGHTGBM_GIT_REF=${{ github.sha }} \ - < ./docker/gpu/dockerfile.gpu - name: dockerfile-cli-only.gpu run: | docker build \ - --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + --build-arg LIGHTGBM_GIT_REF=${{ github.sha }} \ - < ./docker/gpu/dockerfile-cli-only.gpu - name: dockerfile-cli-only-distroless.gpu run: | docker build \ - --build-arg LIGHTGBM_GIT_REF=${{ github.ref }} \ + --build-arg LIGHTGBM_GIT_REF=${{ github.sha }} \ - < ./docker/gpu/dockerfile-cli-only-distroless.gpu all-docker-jobs-successful: if: always() diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml deleted file mode 100644 index cd16696336c7..000000000000 --- a/.github/workflows/python_package.yml +++ /dev/null @@ -1,155 +0,0 @@ -name: Python-package - -on: - push: - branches: - - master - pull_request: - branches: - - master - -# automatically cancel in-progress builds if another commit is pushed -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - CMAKE_BUILD_PARALLEL_LEVEL: 4 - SKBUILD_STRICT_CONFIG: true - -jobs: - test: - name: ${{ matrix.task }} ${{ matrix.method }} (${{ matrix.os }}, Python ${{ matrix.python_version }}) - runs-on: ${{ matrix.os }} - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - include: - - os: macos-13 - task: regular - python_version: '3.10' - - os: macos-13 - task: sdist - python_version: '3.11' - - os: macos-13 - task: bdist - python_version: '3.8' - - os: macos-13 - task: if-else - python_version: '3.9' - - os: macos-14 - task: bdist - method: wheel - python_version: '3.10' - # We're currently skipping MPI jobs on macOS, see https://github.com/microsoft/LightGBM/pull/6425 - # for further details. - # - os: macos-13 - # task: mpi - # method: source - # python_version: '3.11' - # - os: macos-13 - # task: mpi - # method: pip - # python_version: '3.12' - # - os: macos-13 - # task: mpi - # method: wheel - # python_version: '3.9' - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 5 - submodules: true - - name: Setup and run tests - shell: bash - run: | - export TASK="${{ matrix.task }}" - export METHOD="${{ matrix.method }}" - export PYTHON_VERSION="${{ matrix.python_version }}" - if [[ "${{ matrix.os }}" == "macos-14" ]]; then - # use clang when creating macOS release artifacts - export COMPILER="clang" - export OS_NAME="macos" - elif [[ "${{ matrix.os }}" == "macos-13" ]]; then - export COMPILER="gcc" - export OS_NAME="macos" - elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then - export COMPILER="clang" - export OS_NAME="linux" - fi - export BUILD_DIRECTORY="$GITHUB_WORKSPACE" - export CONDA=${HOME}/miniforge - export PATH=${CONDA}/bin:${PATH} - $GITHUB_WORKSPACE/.ci/setup.sh || exit 1 - $GITHUB_WORKSPACE/.ci/test.sh || exit 1 - - name: upload wheels - if: ${{ matrix.method == 'wheel' && matrix.os == 'macos-14' }} - uses: actions/upload-artifact@v4 - with: - name: macosx-arm64-wheel - path: dist/*.whl - test-latest-versions: - name: Python - latest versions (ubuntu-latest) - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 5 - submodules: true - - name: Create wheel - run: | - docker run \ - --rm \ - --env CMAKE_BUILD_PARALLEL_LEVEL=${{ env.CMAKE_BUILD_PARALLEL_LEVEL }} \ - -v $(pwd):/opt/lgb-build \ - -w /opt/lgb-build \ - lightgbm/vsts-agent:manylinux_2_28_x86_64 \ - /bin/bash -c 'PATH=/opt/miniforge/bin:$PATH sh ./build-python.sh bdist_wheel --nomp' - - name: Test compatibility - run: | - docker run \ - --rm \ - -v $(pwd):/opt/lgb-build \ - -w /opt/lgb-build \ - python:3.11 \ - /bin/bash ./.ci/test-python-latest.sh - test-oldest-versions: - name: Python - oldest supported versions (ubuntu-latest) - runs-on: ubuntu-latest - timeout-minutes: 60 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 5 - submodules: true - - name: Create wheel - run: | - docker run \ - --rm \ - --env CMAKE_BUILD_PARALLEL_LEVEL=${{ env.CMAKE_BUILD_PARALLEL_LEVEL }} \ - -v $(pwd):/opt/lgb-build \ - -w /opt/lgb-build \ - lightgbm/vsts-agent:manylinux_2_28_x86_64 \ - /bin/bash -c 'PATH=/opt/miniforge/bin:$PATH sh ./build-python.sh bdist_wheel --nomp' - - name: Test compatibility - run: | - docker run \ - --rm \ - -v $(pwd):/opt/lgb-build \ - -w /opt/lgb-build \ - python:3.7 \ - /bin/bash ./.ci/test-python-oldest.sh - all-python-package-jobs-successful: - if: always() - runs-on: ubuntu-latest - needs: [test, test-latest-versions, test-oldest-versions] - steps: - - name: Note that all tests succeeded - uses: re-actors/alls-green@v1.2.2 - with: - jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/r_package.yml b/.github/workflows/r_package.yml deleted file mode 100644 index fd7b83187170..000000000000 --- a/.github/workflows/r_package.yml +++ /dev/null @@ -1,344 +0,0 @@ -name: R-package - -on: - push: - branches: - - master - pull_request: - branches: - - master - -# automatically cancel in-progress builds if another commit is pushed -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - # https://github.com/actions/checkout/issues/1590#issuecomment-2207052044 - # - # this could be removed (hopefully) when R 3.6 support is removed - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - # in CMake-driven builds, parallelize compilation - CMAKE_BUILD_PARALLEL_LEVEL: 4 - # on Debian-based images, avoid interactive prompts - DEBIAN_FRONTEND: noninteractive - # parallelize compilation (extra important for Linux, where CRAN doesn't supply pre-compiled binaries) - MAKEFLAGS: "-j4" - # hack to get around this: - # https://stat.ethz.ch/pipermail/r-package-devel/2020q3/005930.html - _R_CHECK_SYSTEM_CLOCK_: 0 - # ignore R CMD CHECK NOTE checking how long it has - # been since the last submission - _R_CHECK_CRAN_INCOMING_REMOTE_: 0 - # CRAN ignores the "installed size is too large" NOTE, - # so our CI can too. Setting to a large value here just - # to catch extreme problems - _R_CHECK_PKG_SIZES_THRESHOLD_: 100 - -jobs: - test: - name: ${{ matrix.task }} (${{ matrix.os }}, ${{ matrix.compiler }}, R ${{ matrix.r_version }}, ${{ matrix.build_type }}) - runs-on: ${{ matrix.os }} - container: ${{ matrix.container }} - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - include: - ################ - # CMake builds # - ################ - - os: ubuntu-latest - task: r-package - compiler: gcc - r_version: 3.6 - build_type: cmake - container: 'ubuntu:18.04' - - os: ubuntu-latest - task: r-package - compiler: gcc - r_version: 4.3 - build_type: cmake - container: 'ubuntu:22.04' - - os: ubuntu-latest - task: r-package - compiler: clang - r_version: 4.3 - build_type: cmake - container: 'ubuntu:22.04' - - os: macos-13 - task: r-package - compiler: gcc - r_version: 4.3 - build_type: cmake - container: null - - os: macos-13 - task: r-package - compiler: clang - r_version: 4.3 - build_type: cmake - container: null - - os: windows-latest - task: r-package - compiler: MINGW - toolchain: MINGW - r_version: 3.6 - build_type: cmake - container: null - - os: windows-latest - task: r-package - compiler: MINGW - toolchain: MSYS - r_version: 4.3 - build_type: cmake - container: null - # Visual Studio 2019 - - os: windows-2019 - task: r-package - compiler: MSVC - toolchain: MSVC - r_version: 3.6 - build_type: cmake - container: null - # Visual Studio 2022 - - os: windows-2022 - task: r-package - compiler: MSVC - toolchain: MSVC - r_version: 4.3 - build_type: cmake - container: null - ############### - # CRAN builds # - ############### - - os: windows-latest - task: r-package - compiler: MINGW - toolchain: MINGW - r_version: 3.6 - build_type: cran - container: null - - os: windows-latest - task: r-package - compiler: MINGW - toolchain: MSYS - r_version: 4.3 - build_type: cran - container: null - - os: ubuntu-latest - task: r-package - compiler: gcc - r_version: 4.3 - build_type: cran - container: 'ubuntu:22.04' - - os: macos-13 - task: r-package - compiler: clang - r_version: 4.3 - build_type: cran - container: null - # macos-14 = arm64 - - os: macos-14 - task: r-package - compiler: clang - r_version: 4.3 - build_type: cran - container: null - steps: - - name: Prevent conversion of line endings on Windows - if: startsWith(matrix.os, 'windows') - shell: pwsh - 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 - uses: actions/checkout@v3 - with: - fetch-depth: 5 - submodules: true - - name: Install pandoc - uses: r-lib/actions/setup-pandoc@v2 - if: matrix.container != 'ubuntu:18.04' - # R 3.6 binary isn't easily available on Ubuntu 18.04, - # but setup-pandoc>=2.7.1 is uses a too-new glibc for it. - # ref: https://github.com/microsoft/LightGBM/issues/6298 - - name: Install pandoc - uses: r-lib/actions/setup-pandoc@v2.6.0 - if: matrix.container == 'ubuntu:18.04' - - name: Install tinytex - if: startsWith(matrix.os, 'windows') - uses: r-lib/actions/setup-tinytex@v2 - env: - CTAN_MIRROR: https://ctan.math.illinois.edu/systems/win32/miktex - TINYTEX_INSTALLER: TinyTeX - - name: Setup and run tests on Linux and macOS - if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') - shell: bash - run: | - export TASK="${{ matrix.task }}" - export COMPILER="${{ matrix.compiler }}" - if [[ "${{ matrix.os }}" =~ ^macos ]]; then - export OS_NAME="macos" - elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then - export OS_NAME="linux" - export IN_UBUNTU_BASE_CONTAINER="true" - fi - export BUILD_DIRECTORY="$GITHUB_WORKSPACE" - export R_VERSION="${{ matrix.r_version }}" - export R_BUILD_TYPE="${{ matrix.build_type }}" - $GITHUB_WORKSPACE/.ci/setup.sh - $GITHUB_WORKSPACE/.ci/test.sh - - name: Setup and run tests on Windows - if: startsWith(matrix.os, 'windows') - shell: pwsh -command ". {0}" - run: | - $env:BUILD_SOURCESDIRECTORY = $env:GITHUB_WORKSPACE - $env:LGB_VER = (Get-Content -TotalCount 1 $env:BUILD_SOURCESDIRECTORY\VERSION.txt).trim().replace('rc', '-') - $env:TOOLCHAIN = "${{ matrix.toolchain }}" - $env:R_VERSION = "${{ matrix.r_version }}" - $env:R_BUILD_TYPE = "${{ matrix.build_type }}" - $env:COMPILER = "${{ matrix.compiler }}" - $env:TASK = "${{ matrix.task }}" - & "$env:GITHUB_WORKSPACE/.ci/test-windows.ps1" - test-r-sanitizers: - name: r-sanitizers (ubuntu-latest, R-devel, ${{ matrix.compiler }} ASAN/UBSAN) - timeout-minutes: 60 - runs-on: ubuntu-latest - container: wch1/r-debug - strategy: - fail-fast: false - matrix: - include: - - r_customization: san - compiler: gcc - - r_customization: csan - compiler: clang - steps: - - name: Trust git cloning LightGBM - run: | - git config --global --add safe.directory "${GITHUB_WORKSPACE}" - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 5 - submodules: true - - name: Install packages - shell: bash - run: | - RDscript${{ matrix.r_customization }} -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-executable=RD${{ matrix.r_customization }} - RD${{ matrix.r_customization }} CMD INSTALL lightgbm_*.tar.gz || exit 1 - - name: Run tests with sanitizers - shell: bash - run: | - cd R-package/tests - exit_code=0 - RDscript${{ matrix.r_customization }} testthat.R >> tests.log 2>&1 || exit_code=-1 - cat ./tests.log - exit ${exit_code} - test-r-extra-checks: - name: r-package (${{ matrix.image }}, R-devel) - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - # references: - # * CRAN "additional checks": https://cran.r-project.org/web/checks/check_issue_kinds.html - # * images: https://r-hub.github.io/containers/containers.html - image: - # clang16 should be re-enabled once it's fixed upstream - # ref: https://github.com/microsoft/LightGBM/issues/6607 - #- clang16 - - clang17 - - clang18 - - clang19 - - gcc14 - - intel - runs-on: ubuntu-latest - container: ghcr.io/r-hub/containers/${{ matrix.image }}:latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 5 - submodules: true - - name: Install pandoc - uses: r-lib/actions/setup-pandoc@v2 - - name: Install LaTeX - shell: bash - run: | - if type -f apt 2>&1 > /dev/null; then - apt-get update - apt-get install --no-install-recommends -y \ - devscripts \ - texinfo \ - texlive-latex-extra \ - texlive-latex-recommended \ - texlive-fonts-recommended \ - texlive-fonts-extra \ - tidy \ - qpdf - else - yum update -y - yum install -y \ - devscripts \ - qpdf \ - texinfo \ - texinfo-tex \ - texlive-latex \ - tidy - fi - - name: Install packages and run tests - shell: bash - run: | - 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 - if [[ "${{ matrix.image }}" =~ "clang" ]]; then - # allowing the following NOTEs (produced by default in the clang images): - # - # * checking compilation flags used ... NOTE - # Compilation used the following non-portable flag(s): - # ‘-Wp,-D_FORTIFY_SOURCE=3’ - # - # even though CRAN itself sets that: - # https://www.stats.ox.ac.uk/pub/bdr/Rconfig/r-devel-linux-x86_64-fedora-clang - # - declare -i allowed_notes=1 - else - declare -i allowed_notes=0 - fi - - bash .ci/run-r-cmd-check.sh \ - "$(echo lightgbm_$(head -1 VERSION.txt).tar.gz)" \ - "${allowed_notes}" - all-r-package-jobs-successful: - if: always() - runs-on: ubuntu-latest - needs: [test, test-r-sanitizers, test-r-extra-checks] - steps: - - name: Note that all tests succeeded - uses: re-actors/alls-green@v1.2.2 - with: - jobs: ${{ toJSON(needs) }} diff --git a/.vsts-ci.yml b/.vsts-ci.yml deleted file mode 100644 index 3a111e10898e..000000000000 --- a/.vsts-ci.yml +++ /dev/null @@ -1,481 +0,0 @@ -trigger: - branches: - include: - - master - tags: - include: - - v* -pr: -- master -variables: - AZURE: 'true' - CMAKE_BUILD_PARALLEL_LEVEL: 4 - PYTHON_VERSION: '3.12' - runCodesignValidationInjection: false - skipComponentGovernanceDetection: true - Codeql.Enabled: false - Codeql.SkipTaskAutoInjection: true - DOTNET_CLI_TELEMETRY_OPTOUT: true - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - SKBUILD_STRICT_CONFIG: true -resources: - # The __work/ directory, where Azure DevOps writes the source files, needs to be read-write because - # LightGBM's CI jobs write files in the source directory. - # - # For all the containers included here, all other directories that Azure mounts in are mounted as read-only - # to minimize the risk of side effects from one run affecting future runs. - # ref: https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/resources-containers-container - containers: - - container: linux-artifact-builder - image: lightgbm/vsts-agent:manylinux_2_28_x86_64 - mountReadOnly: - work: false - externals: true - tools: true - tasks: true - - container: ubuntu-latest - image: 'ubuntu:22.04' - options: "--name ci-container -v /usr/bin/docker:/tmp/docker:ro" - mountReadOnly: - work: false - externals: true - tools: true - tasks: true - - container: rbase - image: wch1/r-debug - mountReadOnly: - work: false - externals: true - tools: true - tasks: true -jobs: -########################################### -- job: Maintenance -########################################### - pool: mariner-20240410-0 - container: ubuntu-latest - # routine maintenance (like periodically deleting old files), - # to be run on 1 random CI runner in the self-hosted pool each runner - steps: - - script: | - print-diagnostics(){ - echo "---- df -h -m ----" - df -h -m - echo "---- docker system df ----" - /tmp/docker system df - echo "---- docker images ----" - /tmp/docker images - } - # check disk usage - print-diagnostics - # remove old containers, container images, volumes - # ref: https://stackoverflow.com/a/32723127/3986677) - echo "---- running 'docker system prune' ----" - /tmp/docker system prune \ - --all \ - --force \ - --filter until=720h - # check disk usage again - print-diagnostics - displayName: clean -########################################### -- job: Linux -########################################### - variables: - COMPILER: gcc - SETUP_CONDA: 'false' - OS_NAME: 'linux' - PRODUCES_ARTIFACTS: 'true' - pool: mariner-20240410-0 - container: linux-artifact-builder - strategy: - matrix: - regular: - TASK: regular - PYTHON_VERSION: '3.10' - sdist: - TASK: sdist - PYTHON_VERSION: '3.8' - bdist: - TASK: bdist - PYTHON_VERSION: '3.9' - inference: - TASK: if-else - mpi_source: - TASK: mpi - METHOD: source - PYTHON_VERSION: '3.9' - gpu_source: - TASK: gpu - METHOD: source - swig: - TASK: swig - steps: - - script: | - echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" - echo "##vso[task.prependpath]/usr/lib64/openmpi/bin" - echo "##vso[task.prependpath]$CONDA/bin" - displayName: 'Set variables' - - script: | - git clean -d -f -x - displayName: 'Clean source directory' - - script: | - echo '$(Build.SourceVersion)' > '$(Build.ArtifactStagingDirectory)/commit.txt' - displayName: 'Add commit hash to artifacts archive' - - task: Bash@3 - displayName: Setup - inputs: - filePath: $(Build.SourcesDirectory)/.ci/setup.sh - targetType: filePath - - task: Bash@3 - displayName: Test - inputs: - filePath: $(Build.SourcesDirectory)/.ci/test.sh - targetType: filePath - - task: PublishBuildArtifacts@1 - condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist', 'swig'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: PackageAssets - artifactType: container -########################################### -- job: Linux_latest -########################################### - variables: - COMPILER: clang-17 - DEBIAN_FRONTEND: 'noninteractive' - IN_UBUNTU_BASE_CONTAINER: 'true' - OS_NAME: 'linux' - SETUP_CONDA: 'true' - pool: mariner-20240410-0 - container: ubuntu-latest - strategy: - matrix: - regular: - TASK: regular - sdist: - TASK: sdist - bdist: - TASK: bdist - PYTHON_VERSION: '3.10' - inference: - TASK: if-else - mpi_source: - TASK: mpi - METHOD: source - mpi_pip: - TASK: mpi - METHOD: pip - PYTHON_VERSION: '3.11' - mpi_wheel: - TASK: mpi - METHOD: wheel - PYTHON_VERSION: '3.9' - gpu_source: - TASK: gpu - METHOD: source - PYTHON_VERSION: '3.11' - gpu_pip: - TASK: gpu - METHOD: pip - PYTHON_VERSION: '3.10' - gpu_wheel: - TASK: gpu - METHOD: wheel - PYTHON_VERSION: '3.9' - cpp_tests: - TASK: cpp-tests - METHOD: with-sanitizers - steps: - - script: | - echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" - CONDA=$HOME/miniforge - echo "##vso[task.setvariable variable=CONDA]$CONDA" - echo "##vso[task.prependpath]$CONDA/bin" - displayName: 'Set variables' - # https://github.com/microsoft/azure-pipelines-agent/issues/2043#issuecomment-687983301 - - script: | - /tmp/docker exec -t -u 0 ci-container \ - sh -c "apt-get update && apt-get -o Dpkg::Options::="--force-confold" -y install sudo" - displayName: 'Install sudo' - - script: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends git - git clean -d -f -x - displayName: 'Clean source directory' - - task: Bash@3 - displayName: Setup - inputs: - filePath: $(Build.SourcesDirectory)/.ci/setup.sh - targetType: 'filePath' - - task: Bash@3 - displayName: Test - inputs: - filePath: $(Build.SourcesDirectory)/.ci/test.sh - targetType: 'filePath' -########################################### -- job: QEMU_multiarch -########################################### - variables: - BUILD_DIRECTORY: /LightGBM - COMPILER: gcc - PRODUCES_ARTIFACTS: 'true' - pool: - vmImage: ubuntu-22.04 - timeoutInMinutes: 180 - strategy: - matrix: - bdist: - TASK: bdist - ARCH: aarch64 - steps: - - script: | - sudo apt-get update - sudo apt-get install --no-install-recommends -y \ - binfmt-support \ - qemu \ - qemu-user \ - qemu-user-static - displayName: 'Install QEMU' - - script: | - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - displayName: 'Enable Docker multi-architecture support' - - script: | - git clean -d -f -x - displayName: 'Clean source directory' - - script: | - cat > docker-script.sh < Date: Mon, 2 Sep 2024 23:12:35 -0500 Subject: [PATCH 5/5] allow passing a git sha --- docker/dockerfile-cli | 3 +-- docker/dockerfile-python | 5 ++++- docker/dockerfile-r | 4 ++-- docker/gpu/dockerfile-cli-only-distroless.gpu | 5 ++++- docker/gpu/dockerfile-cli-only.gpu | 5 ++++- docker/gpu/dockerfile.gpu | 5 ++++- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/docker/dockerfile-cli b/docker/dockerfile-cli index 55179e1ef7dd..a8ef50811671 100644 --- a/docker/dockerfile-cli +++ b/docker/dockerfile-cli @@ -23,9 +23,8 @@ RUN curl -L -o cmake.sh https://github.com/Kitware/CMake/releases/download/v3.29 RUN git clone \ --recursive \ - --branch ${LIGHTGBM_GIT_REF} \ - --depth 1 \ https://github.com/Microsoft/LightGBM && \ + git -C ./LightGBM checkout ${LIGHTGBM_GIT_REF} && \ cd ./LightGBM && \ cmake -B build -S . && \ cmake --build build -j4 && \ diff --git a/docker/dockerfile-python b/docker/dockerfile-python index 231eafc675f7..030fd22e50e6 100644 --- a/docker/dockerfile-python +++ b/docker/dockerfile-python @@ -23,7 +23,10 @@ RUN apt-get update && \ conda config --set always_yes yes --set changeps1 no && \ # lightgbm conda install -q -y numpy scipy scikit-learn pandas && \ - git clone --recursive --branch ${LIGHTGBM_GIT_REF} --depth 1 https://github.com/Microsoft/LightGBM && \ + git clone \ + --recursive \ + https://github.com/Microsoft/LightGBM && \ + git -C ./LightGBM checkout ${LIGHTGBM_GIT_REF} && \ cd ./LightGBM && \ sh ./build-python.sh install && \ # clean diff --git a/docker/dockerfile-r b/docker/dockerfile-r index 19af3ccffc8e..3d6d4bb48a8e 100644 --- a/docker/dockerfile-r +++ b/docker/dockerfile-r @@ -9,8 +9,8 @@ RUN apt-get update && \ libomp-dev && \ git clone \ --recursive \ - --branch ${LIGHTGBM_GIT_REF} \ - --depth 1 https://github.com/Microsoft/LightGBM && \ + https://github.com/Microsoft/LightGBM && \ + git -C ./LightGBM checkout ${LIGHTGBM_GIT_REF} && \ cd ./LightGBM && \ sh build-cran-package.sh --no-build-vignettes && \ MAKEFLAGS="-j2" R CMD INSTALL ./lightgbm_*.tar.gz && \ diff --git a/docker/gpu/dockerfile-cli-only-distroless.gpu b/docker/gpu/dockerfile-cli-only-distroless.gpu index 97a9aea87b2b..c6b840751237 100644 --- a/docker/gpu/dockerfile-cli-only-distroless.gpu +++ b/docker/gpu/dockerfile-cli-only-distroless.gpu @@ -40,7 +40,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # LightGBM WORKDIR /opt -RUN git clone --recursive --branch ${LIGHTGBM_GIT_REF} --depth 1 https://github.com/Microsoft/LightGBM && \ +RUN git clone \ + --recursive \ + https://github.com/Microsoft/LightGBM && \ + git -C ./LightGBM checkout ${LIGHTGBM_GIT_REF} && \ cd LightGBM && \ cmake -B build -S . -DUSE_GPU=1 -DOpenCL_LIBRARY=${OPENCL_LIBRARIES}/libOpenCL.so.1 -DOpenCL_INCLUDE_DIR=$OPENCL_INCLUDE_DIR && \ OPENCL_HEADERS=$OPENCL_INCLUDE_DIR LIBOPENCL=$OPENCL_LIBRARIES cmake --build build diff --git a/docker/gpu/dockerfile-cli-only.gpu b/docker/gpu/dockerfile-cli-only.gpu index 7333f4810907..940d1d2bd46c 100644 --- a/docker/gpu/dockerfile-cli-only.gpu +++ b/docker/gpu/dockerfile-cli-only.gpu @@ -40,7 +40,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # LightGBM WORKDIR /opt -RUN git clone --recursive --branch ${LIGHTGBM_GIT_REF} --depth 1 https://github.com/Microsoft/LightGBM && \ +RUN git clone \ + --recursive \ + https://github.com/Microsoft/LightGBM && \ + git -C ./LightGBM checkout ${LIGHTGBM_GIT_REF} && \ cd LightGBM && \ cmake -B build -S . -DUSE_GPU=1 -DOpenCL_LIBRARY=${OPENCL_LIBRARIES}/libOpenCL.so.1 -DOpenCL_INCLUDE_DIR=$OPENCL_INCLUDE_DIR && \ OPENCL_HEADERS=$OPENCL_INCLUDE_DIR LIBOPENCL=$OPENCL_LIBRARIES cmake --build build diff --git a/docker/gpu/dockerfile.gpu b/docker/gpu/dockerfile.gpu index fab9362cf5bb..8de7f295fefd 100644 --- a/docker/gpu/dockerfile.gpu +++ b/docker/gpu/dockerfile.gpu @@ -82,7 +82,10 @@ RUN conda config --set always_yes yes --set changeps1 no && \ ################################################################################################################# RUN cd /usr/local/src && mkdir lightgbm && cd lightgbm && \ - git clone --recursive --branch ${LIGHTGBM_GIT_REF} --depth 1 https://github.com/microsoft/LightGBM && \ + git clone \ + --recursive \ + https://github.com/Microsoft/LightGBM && \ + git -C ./LightGBM checkout ${LIGHTGBM_GIT_REF} && \ cd LightGBM && \ cmake -B build -S . -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ && \ OPENCL_HEADERS=/usr/local/cuda-8.0/targets/x86_64-linux/include LIBOPENCL=/usr/local/cuda-8.0/targets/x86_64-linux/lib cmake --build build