This is an automated email from the ASF dual-hosted git repository. martinzink pushed a commit to branch test_on_apache_mzink in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit ddcf35e42d48d636e38ecd61c45a1e1625f79a9a Author: Martin Zink <[email protected]> AuthorDate: Thu Jul 24 16:58:29 2025 +0200 test clang16 and clang20 support --- .dockerignore | 2 + .github/workflows/ci.yml | 18 +++---- .github/workflows/compiler-support.yml | 65 +++++++++++++++++++++++++ README.md | 4 +- bootstrap/system_dependency.py | 2 +- docker/centos/Dockerfile | 67 -------------------------- docker/compiler-test/clang.Dockerfile | 22 +++++++++ docker/compiler-test/gcc.Dockerfile | 18 +++++++ minifi-api/include/minifi-cpp/utils/Literals.h | 20 ++++---- 9 files changed, 129 insertions(+), 89 deletions(-) diff --git a/.dockerignore b/.dockerignore index ab5c47d28..f1bf6d1cb 100644 --- a/.dockerignore +++ b/.dockerignore @@ -64,3 +64,5 @@ libminifi/src/agent/agent_version.cpp **/cmake_install.cmake **/install_manifest.txt **/CTestTestfile.cmake +bootstrap/venv +bootstrap/option_state.json \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17a415a73..7ccc4ccd4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -285,10 +285,10 @@ jobs: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main" | sudo tee -a /etc/apt/sources.list echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy main" | sudo tee -a /etc/apt/sources.list - echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee -a /etc/apt/sources.list - echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee -a /etc/apt/sources.list + echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | sudo tee -a /etc/apt/sources.list + echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | sudo tee -a /etc/apt/sources.list sudo apt update - sudo apt install -y ccache libfl-dev clang-20 clang-tidy-20 libc++-20-dev libc++abi-20-dev libc++1-20 libc++abi1-20 libunwind-20 libsqliteodbc parallel + sudo apt install -y ccache libfl-dev clang-16 clang-tidy-16 libc++-16-dev libc++abi-16-dev libc++1-16 libc++abi1-16 libunwind-16 libsqliteodbc parallel echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV echo -e "127.0.0.1\t$HOSTNAME" | sudo tee -a /etc/hosts > /dev/null - id: free_disk_space @@ -303,8 +303,8 @@ jobs: sudo rm -rf "$AGENT_TOOLSDIRECTORY" - name: build run: | - export CC=clang-20 - export CXX=clang++-20 + export CC=clang-16 + export CXX=clang++-16 export CXXFLAGS="-stdlib=libc++" export LDFLAGS="-stdlib=libc++" python3 -m venv venv && source venv/bin/activate \ @@ -344,10 +344,10 @@ jobs: - name: clang-tidy run: | # https://stackoverflow.com/questions/58466701/clang-tidy-cant-locate-stdlib-headers - sed -i -e 's/\/usr\/lib\/ccache\/clang++-20/\/lib\/llvm-20\/bin\/clang++/g' build/compile_commands.json - sed -i -e 's/\/usr\/lib\/ccache\/clang-20/\/lib\/llvm-20\/bin\/clang/g' build/compile_commands.json - sed -i -e 's/\/usr\/lib\/ccache\/c++/\/lib\/llvm-20\/bin\/clang++/g' build/compile_commands.json - sed -i -e 's/\/usr\/lib\/ccache\/cc/\/lib\/llvm-20\/bin\/clang/g' build/compile_commands.json + sed -i -e 's/\/usr\/lib\/ccache\/clang++-16/\/lib\/llvm-16\/bin\/clang++/g' build/compile_commands.json + sed -i -e 's/\/usr\/lib\/ccache\/clang-16/\/lib\/llvm-16\/bin\/clang/g' build/compile_commands.json + sed -i -e 's/\/usr\/lib\/ccache\/c++/\/lib\/llvm-16\/bin\/clang++/g' build/compile_commands.json + sed -i -e 's/\/usr\/lib\/ccache\/cc/\/lib\/llvm-16\/bin\/clang/g' build/compile_commands.json parallel -j$(( $(nproc) + 1 )) ./run_clang_tidy.sh ::: ${{steps.list-changed-cpp-files.outputs.files}} - name: check-cores diff --git a/.github/workflows/compiler-support.yml b/.github/workflows/compiler-support.yml new file mode 100644 index 000000000..edb2fc7ff --- /dev/null +++ b/.github/workflows/compiler-support.yml @@ -0,0 +1,65 @@ +# .github/workflows/compiler-support.yml + +name: 'Check supported Compilers' + +on: + workflow_dispatch: + inputs: + use_arm: + description: 'Use ARM64 runners' + required: true + type: boolean + default: false + +jobs: + gcc-build: + name: ${{ matrix.id }} ${{ inputs.use_arm && 'ARM' || 'x86_64' }} + + strategy: + fail-fast: false + matrix: + include: + - id: gcc-12 + base_image: gcc:12-bookworm + - id: gcc-15 + base_image: gcc:15-bookworm + + runs-on: ubuntu-24.04{{ inputs.use_arm && '-arm' || '' }} + + steps: + - name: 'Checkout repository code' + uses: actions/checkout@v4 + + - name: 'Build Project with ${{ matrix.id }}' + run: | + docker build \ + --build-arg BASE_IMAGE=${{ matrix.base_image }} \ + -t minifi-${{ matrix.id }} \ + -f docker/compiler-test/gcc.Dockerfile \ + . + + clang-build: + name: ${{ matrix.id }} ${{ inputs.use_arm && 'ARM' || 'x86_64' }} + + strategy: + fail-fast: false + matrix: + include: + - id: clang-16 + base_image: silkeh/clang:16-bookworm + - id: clang-20 + base_image: silkeh/clang:20-bookworm + + runs-on: ubuntu-24.04{{ inputs.use_arm && '-arm' || '' }} + + steps: + - name: 'Checkout repository code' + uses: actions/checkout@v4 + + - name: 'Build Project with ${{ matrix.id }}' + run: | + docker build \ + --build-arg BASE_IMAGE=${{ matrix.base_image }} \ + -t minifi-${{ matrix.id }} \ + -f docker/compiler-test/clang.Dockerfile \ + . \ No newline at end of file diff --git a/README.md b/README.md index ca7bc7d3d..160d2fd61 100644 --- a/README.md +++ b/README.md @@ -114,8 +114,8 @@ The next table outlines CMAKE flags that correspond with MiNiFi extensions. Exte #### Utilities * CMake 3.24 or greater * Compiler - * g++ 11 or greater - * clang 17 or greater + * g++ 12 or greater + * clang 16 or greater * msvc 19.33 or greater * bison 3.0.x+ (3.2 has been shown to fail builds) * flex 2.6 or greater diff --git a/bootstrap/system_dependency.py b/bootstrap/system_dependency.py index 02050b579..2a3b39386 100644 --- a/bootstrap/system_dependency.py +++ b/bootstrap/system_dependency.py @@ -23,7 +23,7 @@ import platform def _create_system_dependencies(minifi_options: MinifiOptions) -> Dict[str, Set[str]]: - system_dependencies = {'patch': {'patch'}, 'make': {'make'}, 'perl': {'perl'}} + system_dependencies = {'patch': {'patch'}, 'make': {'make'}, 'perl': {'perl'}, 'git': {'git'}} if minifi_options.is_enabled("ENABLE_EXPRESSION_LANGUAGE"): system_dependencies['bison'] = {'bison'} system_dependencies['flex'] = {'flex'} diff --git a/docker/centos/Dockerfile b/docker/centos/Dockerfile deleted file mode 100644 index e2eec731d..000000000 --- a/docker/centos/Dockerfile +++ /dev/null @@ -1,67 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# First stage: the build environment -ARG BASE_IMAGE="centos:7" - -FROM ${BASE_IMAGE} AS build -LABEL maintainer="Apache NiFi <[email protected]>" - -ARG MINIFI_VERSION -ARG UID=1000 -ARG GID=1000 - -# MINIFI_OPTIONS will be passed directly to cmake -# use it to define cmake options (e.g. -DENABLE_AWS=ON -DENABLE_AZURE=ON) -ARG MINIFI_OPTIONS="" -ARG CMAKE_BUILD_TYPE=Release -ARG DOCKER_SKIP_TESTS=ON -ARG DOCKER_MAKE_TARGET="all" - -# Install the system dependencies needed for a build - -ENV MINIFI_BASE_DIR /opt/minifi -ENV MINIFI_HOME $MINIFI_BASE_DIR/nifi-minifi-cpp-$MINIFI_VERSION -ENV USER minificpp - -RUN mkdir -p $MINIFI_BASE_DIR -COPY . ${MINIFI_BASE_DIR} - -# ccache is in EPEL -RUN ulimit -n 1024000 && yum -y install epel-release && yum -y install sudo git which make libarchive ccache ca-certificates perl-IPC-Cmd && \ - if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_PYTHON_SCRIPTING=ON"; then yum -y install python36-devel; fi && \ - if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_SFTP=ON" && [ "${DOCKER_SKIP_TESTS}" == "OFF" ]; then yum -y install java-1.8.0-openjdk maven; fi - -RUN cd $MINIFI_BASE_DIR && \ - ./bootstrap.sh -t && \ - ln -s /usr/bin/ccache /usr/lib64/ccache/c++ - -# Setup minificpp user -RUN groupadd -g ${GID} ${USER} && useradd -g ${GID} ${USER} && \ - chown -R ${USER}:${USER} ${MINIFI_BASE_DIR} - -USER ${USER} - -# Perform the build -RUN cd $MINIFI_BASE_DIR && \ - cd build && \ - source /opt/rh/devtoolset-11/enable && \ - export PATH=/usr/lib64/ccache${PATH:+:${PATH}} && \ - export CCACHE_DIR=${MINIFI_BASE_DIR}/.ccache && \ - cmake -DSTATIC_BUILD= -DSKIP_TESTS=${DOCKER_SKIP_TESTS} ${MINIFI_OPTIONS} -DAWS_ENABLE_UNITY_BUILD=OFF -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" .. && \ - make -j "$(nproc)" ${DOCKER_MAKE_TARGET} diff --git a/docker/compiler-test/clang.Dockerfile b/docker/compiler-test/clang.Dockerfile new file mode 100644 index 000000000..784e4156f --- /dev/null +++ b/docker/compiler-test/clang.Dockerfile @@ -0,0 +1,22 @@ +ARG BASE_IMAGE + +FROM ${BASE_IMAGE} AS build +LABEL maintainer="Apache NiFi <[email protected]>" + +ENV MINIFI_BASE_DIR /opt/minifi +ENV DEBIAN_FRONTEND=noninteractive +ENV CC=clang +ENV CXX=clang++ +ENV CXXFLAGS="-stdlib=libc++" +ENV LDFLAGS="-stdlib=libc++" + +RUN mkdir -p $MINIFI_BASE_DIR +COPY . ${MINIFI_BASE_DIR} + + +RUN apt update && apt install -y sudo python3-venv + + +RUN cd $MINIFI_BASE_DIR/bootstrap && python3 -m venv venv && . venv/bin/activate \ + && pip install -r requirements.txt \ + && python main.py --noninteractive --skip-compiler-install --minifi-options="-DENABLE_ALL=ON -DMINIFI_FAIL_ON_WARNINGS=ON" diff --git a/docker/compiler-test/gcc.Dockerfile b/docker/compiler-test/gcc.Dockerfile new file mode 100644 index 000000000..643e4df99 --- /dev/null +++ b/docker/compiler-test/gcc.Dockerfile @@ -0,0 +1,18 @@ +ARG BASE_IMAGE + +FROM ${BASE_IMAGE} AS build +LABEL maintainer="Apache NiFi <[email protected]>" + +ENV MINIFI_BASE_DIR /opt/minifi +ENV DEBIAN_FRONTEND=noninteractive + +RUN mkdir -p $MINIFI_BASE_DIR +COPY . ${MINIFI_BASE_DIR} + + +RUN apt update && apt install -y sudo python3-venv + + +RUN cd $MINIFI_BASE_DIR/bootstrap && python3 -m venv venv && . venv/bin/activate \ + && pip install -r requirements.txt \ + && python main.py --noninteractive --skip-compiler-install --minifi-options="-DENABLE_ALL=ON -DMINIFI_FAIL_ON_WARNINGS=ON" diff --git a/minifi-api/include/minifi-cpp/utils/Literals.h b/minifi-api/include/minifi-cpp/utils/Literals.h index 20e645185..4736f2c20 100644 --- a/minifi-api/include/minifi-cpp/utils/Literals.h +++ b/minifi-api/include/minifi-cpp/utils/Literals.h @@ -20,42 +20,42 @@ #include <cstdint> -constexpr uint64_t operator""_KiB(const unsigned long long n) { +constexpr uint64_t operator""_KiB(const unsigned long long n) { // NOLINT(runtime/int) return 1024 * n; } -constexpr uint64_t operator""_MiB(const unsigned long long n) { +constexpr uint64_t operator""_MiB(const unsigned long long n) { // NOLINT(runtime/int) return 1024_KiB * n; } -constexpr uint64_t operator""_GiB(const unsigned long long n) { +constexpr uint64_t operator""_GiB(const unsigned long long n) { // NOLINT(runtime/int) return 1024_MiB * n; } -constexpr uint64_t operator""_TiB(const unsigned long long n) { +constexpr uint64_t operator""_TiB(const unsigned long long n) { // NOLINT(runtime/int) return 1024_GiB * n; } -constexpr uint64_t operator""_PiB(const unsigned long long n) { +constexpr uint64_t operator""_PiB(const unsigned long long n) { // NOLINT(runtime/int) return 1024_TiB * n; } -constexpr uint64_t operator""_KB(const unsigned long long n) { +constexpr uint64_t operator""_KB(const unsigned long long n) { // NOLINT(runtime/int) return 1000 * n; } -constexpr uint64_t operator""_MB(const unsigned long long n) { +constexpr uint64_t operator""_MB(const unsigned long long n) { // NOLINT(runtime/int) return 1000_KB * n; } -constexpr uint64_t operator""_GB(const unsigned long long n) { +constexpr uint64_t operator""_GB(const unsigned long long n) { // NOLINT(runtime/int) return 1000_MB * n; } -constexpr uint64_t operator""_TB(const unsigned long long n) { +constexpr uint64_t operator""_TB(const unsigned long long n) { // NOLINT(runtime/int) return 1000_GB * n; } -constexpr uint64_t operator""_PB(const unsigned long long n) { +constexpr uint64_t operator""_PB(const unsigned long long n) { // NOLINT(runtime/int) return 1000_TB * n; }
