Skip to content

Commit

Permalink
add CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Sep 3, 2024
1 parent 46a8cc7 commit 0c5581e
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 3 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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) }}
3 changes: 2 additions & 1 deletion docker/gpu/dockerfile-cli-only-distroless.gpu
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docker/gpu/dockerfile-cli-only.gpu
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docker/gpu/dockerfile.gpu
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0c5581e

Please sign in to comment.