From 8c174ef2d391a1b2c89a8dcc8549806edbd02ea5 Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Sat, 27 May 2023 17:40:46 +0800 Subject: [PATCH] [CI] Update images that are not related to binary release. (#9205) * [CI] Update images that are not related to the binary release. - Update clang-tidy, prefer tools from the Ubuntu repository. - Update GPU image to 22.04. - Small cleanup to the tidy script. - Remove gpu_jvm, which seems to be unused. --- tests/ci_build/Dockerfile.clang_tidy | 15 ++++---- tests/ci_build/Dockerfile.gpu | 4 +-- tests/ci_build/Dockerfile.gpu_jvm | 53 ---------------------------- tests/ci_build/tidy.py | 31 ++++++++++------ 4 files changed, 29 insertions(+), 74 deletions(-) delete mode 100644 tests/ci_build/Dockerfile.gpu_jvm diff --git a/tests/ci_build/Dockerfile.clang_tidy b/tests/ci_build/Dockerfile.clang_tidy index 967f24d3c..b7cd23042 100644 --- a/tests/ci_build/Dockerfile.clang_tidy +++ b/tests/ci_build/Dockerfile.clang_tidy @@ -1,5 +1,5 @@ ARG CUDA_VERSION_ARG -FROM nvidia/cuda:$CUDA_VERSION_ARG-devel-ubuntu20.04 +FROM nvidia/cuda:$CUDA_VERSION_ARG-devel-ubuntu22.04 ARG CUDA_VERSION_ARG # Environment @@ -7,22 +7,21 @@ ENV DEBIAN_FRONTEND noninteractive # Install all basic requirements RUN \ - apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub && \ + apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub && \ apt-get update && \ - apt-get install -y tar unzip wget git build-essential python3 python3-pip software-properties-common \ + apt-get install -y wget git python3 python3-pip software-properties-common \ apt-transport-https ca-certificates gnupg-agent && \ - wget -nv -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ - add-apt-repository -u 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main' && \ - apt-get update && \ apt-get install -y llvm-15 clang-tidy-15 clang-15 libomp-15-dev && \ - wget -nv -nc https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh --no-check-certificate && \ - bash cmake-3.18.0-Linux-x86_64.sh --skip-license --prefix=/usr + apt-get install -y cmake # Set default clang-tidy version RUN \ update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 100 && \ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100 +RUN \ + apt-get install libgtest-dev libgmock-dev -y + # Install Python packages RUN \ pip3 install pyyaml diff --git a/tests/ci_build/Dockerfile.gpu b/tests/ci_build/Dockerfile.gpu index 3b5701693..4011ad834 100644 --- a/tests/ci_build/Dockerfile.gpu +++ b/tests/ci_build/Dockerfile.gpu @@ -1,5 +1,5 @@ ARG CUDA_VERSION_ARG -FROM nvidia/cuda:$CUDA_VERSION_ARG-runtime-ubuntu18.04 +FROM nvidia/cuda:$CUDA_VERSION_ARG-runtime-ubuntu22.04 ARG CUDA_VERSION_ARG ARG RAPIDS_VERSION_ARG @@ -9,7 +9,7 @@ SHELL ["/bin/bash", "-c"] # Use Bash as shell # Install all basic requirements RUN \ - apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub && \ + apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub && \ apt-get update && \ apt-get install -y wget unzip bzip2 libgomp1 build-essential openjdk-8-jdk-headless && \ # Python diff --git a/tests/ci_build/Dockerfile.gpu_jvm b/tests/ci_build/Dockerfile.gpu_jvm deleted file mode 100644 index 7883d189e..000000000 --- a/tests/ci_build/Dockerfile.gpu_jvm +++ /dev/null @@ -1,53 +0,0 @@ -ARG CUDA_VERSION_ARG -FROM nvidia/cuda:$CUDA_VERSION_ARG-runtime-ubuntu16.04 -ARG CUDA_VERSION_ARG -ARG JDK_VERSION=8 -ARG SPARK_VERSION=3.0.0 - -# Environment -ENV DEBIAN_FRONTEND noninteractive - -# Install all basic requirements -RUN \ - apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/3bf863cc.pub && \ - apt-get update && \ - apt-get install -y software-properties-common && \ - add-apt-repository ppa:openjdk-r/ppa && \ - apt-get update && \ - apt-get install -y tar unzip wget openjdk-$JDK_VERSION-jdk libgomp1 && \ - # Python - wget -nv -O conda.sh https://github.com/conda-forge/miniforge/releases/download/22.11.1-2/Mambaforge-22.11.1-2-Linux-x86_64.sh && \ - bash conda.sh -b -p /opt/mambaforge && \ - /opt/mambaforge/bin/pip install awscli && \ - # Maven - wget -nv https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz && \ - tar xvf apache-maven-3.6.1-bin.tar.gz -C /opt && \ - ln -s /opt/apache-maven-3.6.1/ /opt/maven && \ - # Spark - wget -nv https://archive.apache.org/dist/spark/spark-$SPARK_VERSION/spark-$SPARK_VERSION-bin-hadoop2.7.tgz && \ - tar xvf spark-$SPARK_VERSION-bin-hadoop2.7.tgz -C /opt && \ - ln -s /opt/spark-$SPARK_VERSION-bin-hadoop2.7 /opt/spark - -ENV PATH=/opt/mambaforge/bin:/opt/spark/bin:/opt/maven/bin:$PATH - -# Install Python packages -RUN \ - pip install numpy scipy pandas scikit-learn - -ENV GOSU_VERSION 1.10 - -# Install lightweight sudo (not bound to TTY) -RUN set -ex; \ - wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" && \ - chmod +x /usr/local/bin/gosu && \ - gosu nobody true - -# Set default JDK version -RUN update-java-alternatives -v -s java-1.$JDK_VERSION.0-openjdk-amd64 - -# Default entry-point to use if running locally -# It will preserve attributes of created files -COPY entrypoint.sh /scripts/ - -WORKDIR /workspace -ENTRYPOINT ["/scripts/entrypoint.sh"] diff --git a/tests/ci_build/tidy.py b/tests/ci_build/tidy.py index 33e153850..16fb07e0d 100755 --- a/tests/ci_build/tidy.py +++ b/tests/ci_build/tidy.py @@ -41,7 +41,7 @@ class ClangTidy(object): def __init__(self, args): self.cpp_lint = args.cpp self.cuda_lint = args.cuda - self.use_dmlc_gtest = args.use_dmlc_gtest + self.use_dmlc_gtest: bool = args.use_dmlc_gtest self.cuda_archs = args.cuda_archs.copy() if args.cuda_archs else [] if args.tidy_version: @@ -202,6 +202,7 @@ class ClangTidy(object): cdb_file = os.path.join(self.cdb_path, 'compile_commands.json') with open(cdb_file, 'r') as fd: self.compile_commands = json.load(fd) + tidy_file = os.path.join(self.root_path, '.clang-tidy') with open(tidy_file) as fd: self.clang_tidy = yaml.safe_load(fd) @@ -276,16 +277,24 @@ right keywords? print('clang-tidy is working.') -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Run clang-tidy.') - parser.add_argument('--cpp', type=int, default=1) - parser.add_argument('--tidy-version', type=int, default=None, - help='Specify the version of preferred clang-tidy.') - parser.add_argument('--cuda', type=int, default=1) - parser.add_argument('--use-dmlc-gtest', type=int, default=1, - help='Whether to use gtest bundled in dmlc-core.') - parser.add_argument('--cuda-archs', action='append', - help='List of CUDA archs to build') +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Run clang-tidy.") + parser.add_argument("--cpp", type=int, default=1) + parser.add_argument( + "--tidy-version", + type=int, + default=None, + help="Specify the version of preferred clang-tidy.", + ) + parser.add_argument("--cuda", type=int, default=1) + parser.add_argument( + "--use-dmlc-gtest", + action="store_true", + help="Whether to use gtest bundled in dmlc-core.", + ) + parser.add_argument( + "--cuda-archs", action="append", help="List of CUDA archs to build" + ) args = parser.parse_args() test_tidy(args)