cmake(ci): Add Almalinux and Rockylinux, remove centos

This commit is contained in:
Corentin Le Molgat
2024-07-12 15:49:09 +02:00
parent fd71f2efee
commit d5359da8d3
19 changed files with 233 additions and 84 deletions

View File

@@ -7,7 +7,7 @@ jobs:
cmake:
strategy:
matrix:
distro: [alpine, archlinux, centos, debian, fedora, opensuse, ubuntu]
distro: [almalinux, alpine, archlinux, debian, fedora, opensuse, rockylinux, ubuntu]
lang: [cpp, python, dotnet, java]
fail-fast: false
name: ${{ matrix.distro }} • CMake • ${{ matrix.lang }}

View File

@@ -16,15 +16,15 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install SWIG 4.1.1
- name: Install SWIG 4.2.1
run: |
(New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.1.1.zip","swigwin-4.1.1.zip");
Expand-Archive .\swigwin-4.1.1.zip .;
echo "$((Get-Item .).FullName)/swigwin-4.1.1" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
(New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.2.1.zip","swigwin-4.2.1.zip");
Expand-Archive .\swigwin-4.2.1.zip .;
echo "$((Get-Item .).FullName)/swigwin-4.2.1" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Check swig
run: swig -version
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Check dotnet

View File

@@ -16,11 +16,11 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install SWIG 4.1.1
- name: Install SWIG 4.2.1
run: |
(New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.1.1.zip","swigwin-4.1.1.zip");
Expand-Archive .\swigwin-4.1.1.zip .;
echo "$((Get-Item .).FullName)/swigwin-4.1.1" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
(New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.2.1.zip","swigwin-4.2.1.zip");
Expand-Archive .\swigwin-4.2.1.zip .;
echo "$((Get-Item .).FullName)/swigwin-4.2.1" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Check swig
run: swig -version
- name: Check java

View File

@@ -27,11 +27,11 @@ jobs:
python-version: ${{ matrix.python.version }}
- name: Install python3
run: python3 -m pip install --user mypy-protobuf absl-py setuptools wheel numpy pandas
- name: Install SWIG 4.1.1
- name: Install SWIG 4.2.1
run: |
(New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.1.1.zip","swigwin-4.1.1.zip");
Expand-Archive .\swigwin-4.1.1.zip .;
echo "$((Get-Item .).FullName)/swigwin-4.1.1" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
(New-Object System.Net.WebClient).DownloadFile("http://prdownloads.sourceforge.net/swig/swigwin-4.2.1.zip","swigwin-4.2.1.zip");
Expand-Archive .\swigwin-4.2.1.zip .;
echo "$((Get-Item .).FullName)/swigwin-4.2.1" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Check swig
run: swig -version
- name: Add Python binaries to path

View File

@@ -38,12 +38,13 @@ help:
@echo -e "\t${BOLD}clean_<distro>_<stage>${RESET}: Remove a <stage> docker image for a specific distro."
@echo
@echo -e "\tWith ${BOLD}<distro>${RESET}:"
@echo -e "\t\t${BOLD}almalinux${RESET} (latest)"
@echo -e "\t\t${BOLD}alpine${RESET} (edge)"
@echo -e "\t\t${BOLD}archlinux${RESET} (latest)"
@echo -e "\t\t${BOLD}centos${RESET} (latest)"
@echo -e "\t\t${BOLD}debian${RESET} (latest)"
@echo -e "\t\t${BOLD}fedora${RESET} (latest)"
@echo -e "\t\t${BOLD}opensuse${RESET} (tumbleweed)"
@echo -e "\t\t${BOLD}rockylinux${RESET} (9)"
@echo -e "\t\t${BOLD}ubuntu${RESET} (rolling)"
@echo -e "\t\t${BOLD}system_deps${RESET} (archlinux with all deps from pacman)"
@echo -e "\t\t${BOLD}all${RESET}: ALL DISTROS"
@@ -187,7 +188,16 @@ endif
DOCKER_RUN_CMD := docker run --rm --init --net=host
# Currently supported distro
DISTROS := alpine archlinux centos debian fedora opensuse ubuntu system_deps
DISTROS := \
almalinux \
alpine \
archlinux \
debian \
fedora \
opensuse \
rockylinux \
ubuntu \
system_deps
# $* stem
# $< first prerequist

View File

@@ -43,11 +43,11 @@ Dockers \[Alpine, Archlinux, Centos, Debian, Fedora, OpenSuse, Ubuntu\]x
[![Build Status][mips_toolchain_status]][mips_toolchain_link]
[![Build Status][powerpc_toolchain_status]][powerpc_toolchain_link]
[aarch64_toolchain_status]: ./../../../actions/workflows/aarch64_toolchain.yml/badge.svg
[aarch64_toolchain_status]: ./../../../actions/workflows/aarch64_toolchain.yml/badge.svg?branch=main
[aarch64_toolchain_link]: ./../../../actions/workflows/aarch64_toolchain.yml
[mips_toolchain_status]: ./../../../actions/workflows/mips_toolchain.yml/badge.svg
[mips_toolchain_status]: ./../../../actions/workflows/mips_toolchain.yml/badge.svg?branch=main
[mips_toolchain_link]: ./../../../actions/workflows/mips_toolchain.yml
[powerpc_toolchain_status]: ./../../../actions/workflows/powerpc_toolchain.yml/badge.svg
[powerpc_toolchain_status]: ./../../../actions/workflows/powerpc_toolchain.yml/badge.svg?branch=main
[powerpc_toolchain_link]: ./../../../actions/workflows/powerpc_toolchain.yml
## Introduction

View File

@@ -0,0 +1,27 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/almalinux
FROM almalinux:latest AS base
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN dnf -y update \
&& dnf -y install git wget openssl-devel cmake \
&& dnf -y groupinstall "Development Tools" \
&& dnf clean all \
&& rm -rf /var/cache/dnf
CMD [ "/usr/bin/bash" ]
# Install SWIG 4.2.1
FROM base AS swig
RUN dnf -y update \
&& dnf -y install pcre2-devel \
&& dnf clean all \
&& rm -rf /var/cache/dnf \
&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.2.1/swig-4.2.1.tar.gz" \
&& tar xvf swig-4.2.1.tar.gz \
&& rm swig-4.2.1.tar.gz \
&& cd swig-4.2.1 \
&& ./configure --prefix=/usr \
&& make -j 4 \
&& make install \
&& cd .. \
&& rm -rf swig-4.2.1

View File

@@ -1,4 +1,4 @@
FROM ortools/cmake:centos_base AS env
FROM ortools/cmake:almalinux_base AS env
RUN cmake -version
FROM env AS devel

View File

@@ -1,9 +1,10 @@
FROM ortools/cmake:centos_swig AS env
# see: https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-centos8
RUN dnf -y update \
&& dnf -y install dotnet-sdk-6.0 \
&& dnf clean all \
&& rm -rf /var/cache/dnf
FROM ortools/cmake:almalinux_swig AS env
# Install .NET SDK
# see: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install
RUN wget -q "https://dot.net/v1/dotnet-install.sh" \
&& chmod a+x dotnet-install.sh \
&& ./dotnet-install.sh -c 3.1 -i /usr/local/bin \
&& ./dotnet-install.sh -c 6.0 -i /usr/local/bin
# Trigger first run experience by running arbitrary cmd
RUN dotnet --info

View File

@@ -1,4 +1,4 @@
FROM ortools/cmake:centos_swig AS env
FROM ortools/cmake:almalinux_swig AS env
RUN dnf -y update \
&& dnf -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel maven \
&& dnf clean all \

View File

@@ -1,10 +1,11 @@
FROM ortools/cmake:centos_swig AS env
FROM ortools/cmake:almalinux_swig AS env
ENV PATH=/root/.local/bin:$PATH
RUN dnf -y update \
&& dnf -y install python3.11-devel python3.11-numpy python3.11-pip \
&& dnf -y install python3-devel python3-pip python3-numpy \
&& dnf clean all \
&& rm -rf /var/cache/dnf
RUN python3.11 -m pip install absl-py mypy mypy-protobuf pandas
RUN python3 -m pip install \
absl-py mypy mypy-protobuf pandas
FROM env AS devel
WORKDIR /home/project

View File

@@ -1,43 +0,0 @@
# Create a virtual environment with all tools installed
# ref: https://quay.io/repository/centos/centos
FROM quay.io/centos/centos:stream AS base
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN dnf -y update \
&& dnf -y install git wget openssl-devel \
&& dnf -y groupinstall "Development Tools" \
&& dnf clean all \
&& rm -rf /var/cache/dnf
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN dnf -y update \
&& dnf -y install gcc-toolset-11 \
&& dnf clean all \
&& rm -rf /var/cache/dnf
RUN echo "source /opt/rh/gcc-toolset-11/enable" >> /etc/bashrc
SHELL ["/bin/bash", "--login", "-c"]
# Install CMake 3.28.3
RUN wget -q "https://cmake.org/files/v3.28/cmake-3.28.3-linux-x86_64.sh" \
&& chmod a+x cmake-3.28.3-linux-x86_64.sh \
&& ./cmake-3.28.3-linux-x86_64.sh --prefix=/usr/local/ --skip-license \
&& rm cmake-3.28.3-linux-x86_64.sh
CMD [ "/usr/bin/bash" ]
# Install SWIG 4.2.0
FROM base AS swig
RUN dnf -y update \
&& dnf -y install pcre2-devel \
&& dnf clean all \
&& rm -rf /var/cache/dnf \
&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.2.0/swig-4.2.0.tar.gz" \
&& tar xvf swig-4.2.0.tar.gz \
&& rm swig-4.2.0.tar.gz \
&& cd swig-4.2.0 \
&& ./configure --prefix=/usr \
&& make -j 4 \
&& make install \
&& cd .. \
&& rm -rf swig-4.2.0

View File

@@ -0,0 +1,27 @@
# Create a virtual environment with all tools installed
# ref: https://hub.docker.com/_/rockylinux
FROM rockylinux:9 AS base
# Install system build dependencies
ENV PATH=/usr/local/bin:$PATH
RUN dnf -y update \
&& dnf -y install git wget openssl-devel cmake \
&& dnf -y groupinstall "Development Tools" \
&& dnf clean all \
&& rm -rf /var/cache/dnf
CMD [ "/usr/bin/bash" ]
# Install SWIG 4.2.1
FROM base AS swig
RUN dnf -y update \
&& dnf -y install pcre2-devel \
&& dnf clean all \
&& rm -rf /var/cache/dnf \
&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.2.1/swig-4.2.1.tar.gz" \
&& tar xvf swig-4.2.1.tar.gz \
&& rm swig-4.2.1.tar.gz \
&& cd swig-4.2.1 \
&& ./configure --prefix=/usr \
&& make -j 4 \
&& make install \
&& cd .. \
&& rm -rf swig-4.2.1

View File

@@ -0,0 +1,29 @@
FROM ortools/cmake:rockylinux_base AS env
RUN cmake -version
FROM env AS devel
WORKDIR /home/project
COPY . .
FROM devel AS build
RUN cmake -S. -Bbuild -DBUILD_DEPS=ON
RUN cmake --build build --target all -v
RUN cmake --build build --target install
FROM build AS test
RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test
FROM env AS install_env
COPY --from=build /usr/local /usr/local/
FROM install_env AS install_devel
WORKDIR /home/sample
COPY cmake/samples/cpp .
FROM install_devel AS install_build
RUN cmake -S. -Bbuild
RUN cmake --build build --target all -v
RUN cmake --build build --target install
FROM install_build AS install_test
RUN cmake --build build --target test

View File

@@ -0,0 +1,36 @@
FROM ortools/cmake:rockylinux_swig AS env
# Install .NET SDK
# see: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install
RUN wget -q "https://dot.net/v1/dotnet-install.sh" \
&& chmod a+x dotnet-install.sh \
&& ./dotnet-install.sh -c 3.1 -i /usr/local/bin \
&& ./dotnet-install.sh -c 6.0 -i /usr/local/bin
# Trigger first run experience by running arbitrary cmd
RUN dotnet --info
# Add the library src to our build env
FROM env AS devel
WORKDIR /home/project
COPY . .
FROM devel AS build
RUN cmake -version
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
RUN cmake --build build --target all -v
RUN cmake --build build --target install -v
FROM build AS test
RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test -v
FROM env AS install_env
WORKDIR /home/sample
COPY --from=build /home/project/build/dotnet/packages/*.nupkg ./
FROM install_env AS install_devel
COPY cmake/samples/dotnet .
FROM install_devel AS install_build
RUN dotnet build
FROM install_build AS install_test
RUN dotnet test

View File

@@ -0,0 +1,31 @@
FROM ortools/cmake:rockylinux_swig AS env
RUN dnf -y update \
&& dnf -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel maven \
&& dnf clean all \
&& rm -rf /var/cache/dnf
FROM env AS devel
WORKDIR /home/project
COPY . .
FROM devel AS build
RUN cmake -S. -Bbuild -DBUILD_JAVA=ON -DSKIP_GPG=ON \
-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
RUN cmake --build build --target all -v
RUN cmake --build build --target install
FROM build AS test
RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test
FROM env AS install_env
COPY --from=build /usr/local /usr/local/
FROM install_env AS install_devel
WORKDIR /home/sample
COPY cmake/samples/java .
FROM install_devel AS install_build
RUN mvn compile
FROM install_build AS install_test
RUN mvn test

View File

@@ -0,0 +1,34 @@
FROM ortools/cmake:rockylinux_swig AS env
ENV PATH=/root/.local/bin:$PATH
RUN dnf -y update \
&& dnf -y install python3-devel python3-pip python3-numpy \
&& dnf clean all \
&& rm -rf /var/cache/dnf
RUN python3 -m pip install \
absl-py mypy mypy-protobuf pandas
FROM env AS devel
WORKDIR /home/project
COPY . .
FROM devel AS build
RUN cmake -S. -Bbuild -DBUILD_PYTHON=ON -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
RUN cmake --build build --target all -v
RUN cmake --build build --target install
FROM build AS test
RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test
FROM env AS install_env
WORKDIR /home/sample
COPY --from=build /home/project/build/python/dist/*.whl .
RUN python3 -m pip install *.whl
FROM install_env AS install_devel
COPY cmake/samples/python .
FROM install_devel AS install_build
RUN python3 -m compileall .
FROM install_build AS install_test
RUN python3 sample.py

View File

@@ -5,7 +5,7 @@ FROM ubuntu:latest AS env
ENV PATH=/usr/local/bin:$PATH
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq git wget libssl-dev build-essential \
ninja-build python3 pkgconf libglib2.0-dev \
ninja-build python3 python3-venv pkgconf libglib2.0-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENTRYPOINT ["/usr/bin/bash", "-c"]
@@ -23,9 +23,12 @@ COPY . .
ENV PROJECT=or-tools
ARG TARGET
ENV TARGET ${TARGET:-unknown}
ENV TARGET=${TARGET:-unknown}
FROM devel AS build
FROM devel AS toolchain
RUN ./tools/cross_compile.sh toolchain
FROM toolchain AS build
RUN cmake --version
RUN ./tools/cross_compile.sh build

View File

@@ -5,17 +5,10 @@ FROM ubuntu:rolling AS base
ENV PATH=/usr/local/bin:$PATH
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq \
git wget libssl-dev build-essential \
git wget libssl-dev build-essential cmake \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install CMake 3.28.3
RUN wget -q "https://cmake.org/files/v3.28/cmake-3.28.3-linux-x86_64.sh" \
&& chmod a+x cmake-3.28.3-linux-x86_64.sh \
&& ./cmake-3.28.3-linux-x86_64.sh --prefix=/usr/local/ --skip-license \
&& rm cmake-3.28.3-linux-x86_64.sh
CMD [ "/usr/bin/bash" ]
FROM base AS swig
RUN apt-get update -qq \
&& apt-get install -yq swig \