diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..a5be522e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +env: + IMAGE_PREFIX: ghcr.io/fairrootgroup/odc-ci + +jobs: + build-and-test: + runs-on: ubuntu-latest + permissions: + contents: read + packages: read + + strategy: + fail-fast: false + matrix: + include: + - fedora: fedora39 + label: fedora-39-x86_64-gcc-13 + - fedora: fedora40 + label: fedora-40-x86_64-gcc-14 + - fedora: fedora41 + label: fedora-41-x86_64-gcc-14 + - fedora: fedora42 + label: fedora-42-x86_64-gcc-15 + - fedora: fedora42-boost190 + label: fedora-42-x86_64-gcc-15-boost-1.90 + - fedora: fedora42 + label: sanitizers + extra: -DENABLE_SANITIZERS=ON + + container: + image: ${{ format('{0}:{1}', 'ghcr.io/fairrootgroup/odc-ci', matrix.fedora) }} + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Build and test + env: + LABEL: ${{ matrix.label }} + run: ctest -S ODCTest.cmake -VV --output-on-failure ${{ matrix.extra }} + + - name: Collect logs on failure + if: failure() + run: | + mkdir -p build/logs + cp -r ~/.ODC/ build/logs/ODC 2>/dev/null || true + cp -r ~/.DDS/ build/logs/DDS 2>/dev/null || true + + - name: Upload logs on failure + if: failure() + uses: actions/upload-artifact@v4 + with: + name: logs-${{ matrix.label }} + path: | + build/logs/ + build/tmp/ + if-no-files-found: ignore + retention-days: 7 diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml new file mode 100644 index 00000000..4e4f2a95 --- /dev/null +++ b/.github/workflows/docker-images.yml @@ -0,0 +1,65 @@ +name: Docker Images + +on: + push: + branches: + - master + paths: + - 'utils/ci/Dockerfile.*' + pull_request: + paths: + - 'utils/ci/Dockerfile.*' + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_PREFIX: ghcr.io/fairrootgroup/odc-ci + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + strategy: + fail-fast: false + matrix: + include: + - image: fedora39 + build-args: FEDORA_VERSION=39 + - image: fedora40 + build-args: FEDORA_VERSION=40 + - image: fedora41 + build-args: FEDORA_VERSION=41 + - image: fedora42 + build-args: FEDORA_VERSION=42 + - image: fedora42-boost190 + build-args: | + FEDORA_VERSION=42 + BOOST_VERSION=90 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: utils/ci + file: utils/ci/Dockerfile.fedora + build-args: ${{ matrix.build-args }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ env.IMAGE_PREFIX }}:${{ matrix.image }} + cache-from: type=registry,ref=${{ env.IMAGE_PREFIX }}:${{ matrix.image }}-cache + cache-to: type=registry,ref=${{ env.IMAGE_PREFIX }}:${{ matrix.image }}-cache,mode=max diff --git a/tests/odc-fixtures.h b/tests/odc-fixtures.h index 6117c667..62a6558a 100644 --- a/tests/odc-fixtures.h +++ b/tests/odc-fixtures.h @@ -115,7 +115,10 @@ struct TopologyFixture path.erase(pos); } mSession.mCollectionDetails.emplace(res.m_collectionID, CollectionDetails{res.m_agentID, res.m_collectionID, path, res.m_host, res.m_wrkDir, "unknown_job_id"}); - mSession.mRuntimeCollectionIndex.at(res.m_collectionID)->mRuntimeCollectionAgents[res.m_collectionID] = res.m_agentID; + auto it = mSession.mRuntimeCollectionIndex.find(res.m_collectionID); + if (it != mSession.mRuntimeCollectionIndex.end()) { + it->second->mRuntimeCollectionAgents[res.m_collectionID] = res.m_agentID; + } } } } diff --git a/utils/ci/Dockerfile.fedora b/utils/ci/Dockerfile.fedora new file mode 100644 index 00000000..26b2c8e4 --- /dev/null +++ b/utils/ci/Dockerfile.fedora @@ -0,0 +1,79 @@ +# Usage: +# docker build -f Dockerfile.fedora . +# docker build -f Dockerfile.fedora --build-arg FEDORA_VERSION=41 --build-arg DDS_VERSION=3.17 . +# docker build -f Dockerfile.fedora --build-arg BOOST_VERSION=90 . + +# Stage 1: Common build environment with shared dnf packages. +ARG FEDORA_VERSION=42 +FROM fedora:${FEDORA_VERSION} AS buildenv + +RUN dnf -y update && \ + dnf -y install abseil-cpp-devel \ + asio-devel \ + ca-certificates \ + cmake \ + flatbuffers-devel \ + flatbuffers-compiler \ + fmt-devel \ + gcc-c++ \ + git \ + grpc-devel \ + grpc-plugins \ + libxml2 \ + ninja-build \ + patch \ + wget \ + zeromq-devel + +# Stage 2: Build custom dependencies from source into /usr/local. +# Source and build trees are discarded with this stage. +FROM buildenv AS build + +ARG BOOST_VERSION= +ARG FAIRCMAKEMODULES_VERSION=v1.0.0 +ARG FAIRLOGGER_VERSION=v2.3.1 +ARG FAIRMQ_VERSION=v1.10.1 +ARG DDS_VERSION=3.18 + +RUN if [ -n "${BOOST_VERSION}" ]; then \ + wget -O /boost.tar.gz "https://archives.boost.io/release/1.${BOOST_VERSION}.0/source/boost_1_${BOOST_VERSION}_0.tar.gz" && \ + tar xzf /boost.tar.gz && \ + cd /boost_1_${BOOST_VERSION}_0 && \ + ./bootstrap.sh --prefix=/usr/local && \ + ./b2 install -j$(nproc) --without-python --without-mpi && \ + cd / && rm -rf /boost.tar.gz /boost_1_${BOOST_VERSION}_0; \ + else \ + dnf -y install boost-devel; \ + fi + +ADD --keep-git-dir=true https://github.com/FairRootGroup/FairCMakeModules.git#${FAIRCMAKEMODULES_VERSION} /FairCMakeModules +RUN cmake -GNinja -S FairCMakeModules -B FairCMakeModules_build -DCMAKE_INSTALL_PREFIX=/usr/local && \ + cmake --build FairCMakeModules_build --target install + +ADD --keep-git-dir=true https://github.com/FairRootGroup/FairLogger.git#${FAIRLOGGER_VERSION} /FairLogger +RUN cmake -GNinja -S FairLogger -B FairLogger_build -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release && \ + cmake --build FairLogger_build --target install + +ADD --keep-git-dir=true https://github.com/FairRootGroup/FairMQ.git#${FAIRMQ_VERSION} /FairMQ +RUN cmake -GNinja -S FairMQ -B FairMQ_build -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release && \ + cmake --build FairMQ_build --target install + +ADD https://github.com/FairRootGroup/DDS.git#${DDS_VERSION} /DDS +RUN echo "${DDS_VERSION}" > /DDS/version && \ + cmake -GNinja -S DDS -B DDS_build -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DBUILD_dds-tutorials=OFF && \ + cmake --build DDS_build --target wn_bin && \ + cmake --build DDS_build --target install + +# Stage 3: Final image with ODC-specific build dependencies +# and the install trees of the custom-built dependencies from stage 2. +FROM buildenv AS final + +ARG BOOST_VERSION= +RUN if [ -z "${BOOST_VERSION}" ]; then dnf -y install boost-devel; fi && \ + dnf -y install clang-tools-extra \ + libasan \ + liblsan \ + libubsan && \ + dnf -y clean all + +COPY --from=build /usr/local /usr/local diff --git a/utils/ci/centos.8stream.alice.def b/utils/ci/centos.8stream.alice.def deleted file mode 100644 index 133805e5..00000000 --- a/utils/ci/centos.8stream.alice.def +++ /dev/null @@ -1,27 +0,0 @@ -Bootstrap: docker -From: quay.io/centos/centos:stream8 - -%post - dnf -y update - dnf -y install epel-release - dnf -y install dnf-plugins-core - dnf config-manager --set-enabled powertools - dnf -y update - dnf -y group install "Development Tools" - cat << EOF > /etc/yum.repos.d/alice-system-deps.repo -[alice-system-deps] -name=alice-system-deps -baseurl=https://s3.cern.ch/swift/v1/alibuild-repo/RPMS/o2-full-deps_el8.x86-64/ -enabled=1 -gpgcheck=0 -EOF - cat << EOF > /etc/profile.d/alibuild.sh -#!/bin/bash -export ALIBUILD_WORK_DIR=/root/sw -EOF - dnf install -y alice-o2-full-deps alibuild - cd /root - git clone -b odc_ci https://github.com/FairRootGroup/alidist - aliBuild analytics off - aliBuild init --defaults o2 ODC --debug - aliBuild build --defaults o2 ODC --debug diff --git a/utils/ci/fedora36_dds3.7.22.def b/utils/ci/fedora36_dds3.7.22.def deleted file mode 100644 index f797ba9b..00000000 --- a/utils/ci/fedora36_dds3.7.22.def +++ /dev/null @@ -1,35 +0,0 @@ -Bootstrap: docker -From: fedora:36 - -%post - dnf -y update - dnf -y install https://alfa-ci.gsi.de/packages/rpm/fedora-36-x86_64/fairsoft-release-dev.rpm - dnf -y install abseil-cpp-devel \ - asio-devel \ - boost-devel \ - ca-certificates \ - clang-tools-extra \ - cmake \ - faircmakemodules \ - fairlogger-devel \ - fairmq-devel \ - flatbuffers-devel \ - flatbuffers-compiler \ - gcc-c++ \ - git \ - grpc-devel \ - grpc-plugins \ - libasan \ - liblsan \ - libubsan \ - libxml2 \ - ninja-build \ - patch \ - wget - dnf -y clean all - - git clone -b 3.7.22 https://github.com/FairRootGroup/DDS - cmake -GNinja -S DDS -B DDS_build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_dds-tutorials=OFF - cmake --build DDS_build --target wn_bin - cmake --build DDS_build --target install - rm -rf DDS DDS_build diff --git a/utils/ci/fedora37_dds3.7.22.def b/utils/ci/fedora37_dds3.7.22.def deleted file mode 100644 index 6bb537dd..00000000 --- a/utils/ci/fedora37_dds3.7.22.def +++ /dev/null @@ -1,35 +0,0 @@ -Bootstrap: docker -From: fedora:37 - -%post - dnf -y update - dnf -y install https://alfa-ci.gsi.de/packages/rpm/fedora-37-x86_64/fairsoft-release-dev.rpm - dnf -y install abseil-cpp-devel \ - asio-devel \ - boost-devel \ - ca-certificates \ - clang-tools-extra \ - cmake \ - faircmakemodules \ - fairlogger-devel \ - fairmq-devel \ - flatbuffers-devel \ - flatbuffers-compiler \ - gcc-c++ \ - git \ - grpc-devel \ - grpc-plugins \ - libasan \ - liblsan \ - libubsan \ - libxml2 \ - ninja-build \ - patch \ - wget - dnf -y clean all - - git clone -b 3.7.22 https://github.com/FairRootGroup/DDS - cmake -GNinja -S DDS -B DDS_build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_dds-tutorials=OFF - cmake --build DDS_build --target wn_bin - cmake --build DDS_build --target install - rm -rf DDS DDS_build diff --git a/utils/ci/fedora38_dds3.12.def b/utils/ci/fedora38_dds3.12.def deleted file mode 100644 index 0ded022b..00000000 --- a/utils/ci/fedora38_dds3.12.def +++ /dev/null @@ -1,48 +0,0 @@ -Bootstrap: docker -From: fedora:38 - -%post - dnf -y update - dnf -y install abseil-cpp-devel \ - asio-devel \ - boost-devel \ - ca-certificates \ - clang-tools-extra \ - cmake \ - flatbuffers-devel \ - flatbuffers-compiler \ - fmt-devel \ - gcc-c++ \ - git \ - grpc-devel \ - grpc-plugins \ - libasan \ - liblsan \ - libubsan \ - libxml2 \ - ninja-build \ - patch \ - wget \ - zeromq-devel - dnf -y clean all - - git clone https://github.com/FairRootGroup/FairCMakeModules - cmake -GNinja -S FairCMakeModules -B FairCMakeModules_build -DCMAKE_INSTALL_PREFIX=/usr - cmake --build FairCMakeModules_build --target install - rm -rf FairCMakeModules FairCMakeModules_build - - git clone -b v2.1.0 https://github.com/FairRootGroup/FairLogger - cmake -GNinja -S FairLogger -B FairLogger_build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release - cmake --build FairLogger_build --target install - rm -rf FairLogger FairLogger_build - - git clone -b v1.9.2 https://github.com/FairRootGroup/FairMQ - cmake -GNinja -S FairMQ -B FairMQ_build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release - cmake --build FairMQ_build --target install - rm -rf FairMQ FairMQ_build - - git clone -b 3.12 https://github.com/FairRootGroup/DDS - cmake -GNinja -S DDS -B DDS_build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_dds-tutorials=OFF - cmake --build DDS_build --target wn_bin - cmake --build DDS_build --target install - rm -rf DDS DDS_build