From 0c5581e2b6862b85a9daa2d87525e654ae939305 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 2 Sep 2024 22:37:09 -0500 Subject: [PATCH] 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