From f1d9369d8128b4b1dc67c98e631f9be4e594d0fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Dutheillet-Lamonth=C3=A9zie?= Date: Mon, 2 Sep 2024 16:24:23 +0200 Subject: [PATCH] #97: differenciate base docker files for ubuntu 22 and ubuntu 24 ci tests --- .github/workflows/build-and-test-ubuntu.yml | 1 + .github/workflows/pushbasedockerimage.yml | 4 +- ...file => make-base-ubuntu-22.04.dockerfile} | 6 +- ci/docker/make-base-ubuntu-24.04.dockerfile | 103 ++++++++++++++++++ 4 files changed, 110 insertions(+), 4 deletions(-) rename ci/docker/{make-base.dockerfile => make-base-ubuntu-22.04.dockerfile} (96%) create mode 100644 ci/docker/make-base-ubuntu-24.04.dockerfile diff --git a/.github/workflows/build-and-test-ubuntu.yml b/.github/workflows/build-and-test-ubuntu.yml index 6c6b590b6..3db91f24d 100644 --- a/.github/workflows/build-and-test-ubuntu.yml +++ b/.github/workflows/build-and-test-ubuntu.yml @@ -18,6 +18,7 @@ jobs: - ubuntu_22.04-gcc_11-vtk_9.2.2-py_3.8 - ubuntu_22.04-clang_11-vtk_9.2.2-py_3.8 - ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8 + - ubuntu_24.04-gcc_13-vtk_9.3.1-py_3.8 env: OUTPUT_DIR: '/tmp/artifacts' VT_TV_TESTS_ENABLED: 'ON' # Build & Test in all configurations diff --git a/.github/workflows/pushbasedockerimage.yml b/.github/workflows/pushbasedockerimage.yml index 1b6d5be38..e8f01e483 100644 --- a/.github/workflows/pushbasedockerimage.yml +++ b/.github/workflows/pushbasedockerimage.yml @@ -10,6 +10,7 @@ on: - ubuntu_22.04-gcc_11-vtk_9.2.2-py_3.8 - ubuntu_22.04-clang_11-vtk_9.2.2-py_3.8 - ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8 + - ubuntu_24.04-gcc_12-vtk_9.3.1-py_3.8 default: ubuntu_22.04-gcc_12-vtk_9.3.0-py_3.8 jobs: @@ -27,6 +28,7 @@ jobs: run: | IFS='_-' read -r -a CONFIG <<< "${{ inputs.image }}" echo "BASE_IMAGE=${CONFIG[0]}:${CONFIG[1]}" >> $GITHUB_ENV + echo "BASE_DOCKERFILE=make-base-${CONFIG[0]}-${CONFIG[1]}.dockerfile" >> $GITHUB_ENV echo "CC=${CONFIG[2]}-${CONFIG[3]}" >> $GITHUB_ENV if [[ "${CONFIG[2]}" == "gcc" ]]; then echo "CXX=g++-${CONFIG[3]}" >> $GITHUB_ENV @@ -68,6 +70,6 @@ jobs: GCOV=${{ env.GCOV }} VTK_VERSION=${{ env.VTK_VERSION }} PYTHON_VERSION=${{ env.PYTHON_VERSION }} - file: ci/docker/make-base.dockerfile + file: ci/docker/${{ env.BASE_DOCKERFILE }} push: true tags: "${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_TAG }}" diff --git a/ci/docker/make-base.dockerfile b/ci/docker/make-base-ubuntu-22.04.dockerfile similarity index 96% rename from ci/docker/make-base.dockerfile rename to ci/docker/make-base-ubuntu-22.04.dockerfile index 28d7d973f..b0f876017 100644 --- a/ci/docker/make-base.dockerfile +++ b/ci/docker/make-base-ubuntu-22.04.dockerfile @@ -85,12 +85,12 @@ RUN git clone --recursive --branch v${VTK_VERSION} https://gitlab.kitware.com/vt # Build VTK RUN mkdir -p ${VTK_DIR} WORKDIR ${VTK_DIR} -RUN cmake \ +RUN if [ "${BASE_IMAGE}" ] cmake \ -DCMAKE_BUILD_TYPE:STRING=Release \ -DBUILD_TESTING:BOOL=OFF \ - -DVTK_OPENGL_HAS_OSMESA:BOOL=OFF \ + -DVTK_OPENGL_HAS_OSMESA:BOOL=ON \ -DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=ON \ - -DVTK_USE_X:BOOL=ON \ + -DVTK_USE_X:BOOL=OFF \ -DVTK_USE_WIN32_OPENGL:BOOL=OFF \ -DVTK_USE_COCOA:BOOL=OFF \ -DVTK_USE_SDL2:BOOL=OFF \ diff --git a/ci/docker/make-base-ubuntu-24.04.dockerfile b/ci/docker/make-base-ubuntu-24.04.dockerfile new file mode 100644 index 000000000..703cef654 --- /dev/null +++ b/ci/docker/make-base-ubuntu-24.04.dockerfile @@ -0,0 +1,103 @@ +# Docker instructions to build an image with some arguments to specify compilers, python and VTK versions. +# @see .github/workflows/pushbasedockerimage.yml + +ARG BASE_IMAGE=ubuntu:24.04 + +# Base image & requirements +FROM ${BASE_IMAGE} AS base + +# Arguments +ARG VTK_VERSION=v9.2.2 +ARG PYTHON_VERSION=3.8 +ARG CC=gcc-11 +ARG CXX=g++-11 +ARG GCOV=gcov-11 + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update -y -q && \ + apt-get install -y -q --no-install-recommends \ + ${CC} \ + ${CXX} \ + git \ + xz-utils \ + bzip2 \ + zip \ + gpg \ + wget \ + gpgconf \ + software-properties-common \ + libsigsegv2 \ + libsigsegv-dev \ + pkg-config \ + zlib1g \ + zlib1g-dev \ + m4 \ + gfortran-11 \ + make \ + cmake-data \ + cmake \ + pkg-config \ + libncurses5-dev \ + m4 \ + libgl1-mesa-dev \ + libglu1-mesa-dev \ + mesa-common-dev \ + libosmesa6-dev \ + perl \ + curl \ + xvfb \ + lcov \ + && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Share environment variables for use in images based on this. +ENV CC=/usr/bin/$CC +ENV CXX=/usr/bin/$CXX +ENV GCOV=/usr/bin/$GCOV +ENV VTK_DIR=/opt/build/vtk + +# Setup python 3.8 with conda + +# Download and install Miniconda +RUN curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ + bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda && \ + rm Miniconda3-latest-Linux-x86_64.sh + +# Update PATH so that conda and the installed packages are usable +ENV PATH="/opt/conda/bin:${PATH}" + +# Create a new environment and install necessary packages +RUN conda create -y -n deves python=${PYTHON_VERSION} && \ + echo "source activate deves" > ~/.bashrc && \ + /bin/bash -c ". /opt/conda/etc/profile.d/conda.sh && conda activate deves && pip install nanobind" + +# Set the environment to deves on container run +ENV CONDA_DEFAULT_ENV=deves +ENV CONDA_PREFIX=/opt/conda/envs/$CONDA_DEFAULT_ENV +ENV PATH=$PATH:$CONDA_PREFIX/bin +ENV CONDA_AUTO_UPDATE_CONDA=false + +# Clone VTK source +RUN mkdir -p /opt/src/vtk +RUN git clone --recursive --branch v${VTK_VERSION} https://gitlab.kitware.com/vtk/vtk.git /opt/src/vtk + +# Build VTK +# Note: use X not OSMESA because of glew build error on ubuntu 24.04 +RUN mkdir -p ${VTK_DIR} +WORKDIR ${VTK_DIR} +RUN if [ "${BASE_IMAGE}" ] cmake \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DBUILD_TESTING:BOOL=OFF \ + -DVTK_OPENGL_HAS_OSMESA:BOOL=OFF \ + -DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=ON \ + -DVTK_USE_X:BOOL=ON \ + -DVTK_USE_WIN32_OPENGL:BOOL=OFF \ + -DVTK_USE_COCOA:BOOL=OFF \ + -DVTK_USE_SDL2:BOOL=OFF \ + -DVTK_Group_Rendering:BOOL=OFF \ + -DBUILD_SHARED_LIBS:BOOL=ON \ + -S /opt/src/vtk -B ${VTK_DIR} +RUN cmake --build ${VTK_DIR} -j$(nproc) + +RUN echo "Base creation success"