diff --git a/.github/actions/fsr/cache-save/action.yml b/.github/actions/fsr/cache-save/action.yml new file mode 100644 index 00000000..57e55553 --- /dev/null +++ b/.github/actions/fsr/cache-save/action.yml @@ -0,0 +1,31 @@ +name: cache-save +description: 'steps to cache R3BRoot and ucesb' + +inputs: + r3b-dev-key: + description: 'key for r3b dev cache' + required: false + default: '' + cache-name: + description: 'repository name' + required: true + +runs: + using: composite + steps: + - name: cache ucesb + id: cache-ucesb + uses: actions/cache/save@v5 + with: + path: | + ${{ env.UCESB_DIR }} + ${{ github.workspace }}/build/_deps + key: build-deps + + - name: cache r3b + if: matrix.save != 'false' + id: cache-r3b + uses: actions/cache/save@v5 + with: + path: .ccache + key: r3b-build-${{ inputs.cache-name }}-${{ inputs.r3b-dev-key }} diff --git a/.github/actions/fsr/ctest-cdash/action.yml b/.github/actions/fsr/ctest-cdash/action.yml new file mode 100644 index 00000000..af92adc8 --- /dev/null +++ b/.github/actions/fsr/ctest-cdash/action.yml @@ -0,0 +1,37 @@ +name: ctest-cdash +description: 'steps to perform ctest and submit the report to cdash' + +inputs: + repo: + description: 'repository name' + required: true + +runs: + using: composite + steps: + - name: set env variables for push + if: github.event_name == 'push' + run: | + echo "TEST_MODEL=Continuous" >> $GITHUB_ENV + echo "TEST_NAME=\"${{ inputs.repo }} (commit ${cacheSHA})\"" >> $GITHUB_ENV + shell: bash + + - name: set env variables for pull request + if: github.event_name != 'push' + run: | + echo "TEST_MODEL=Experimental" >> $GITHUB_ENV + export PULL_NR=${{ github.event.number }} + echo "TEST_NAME=\"${{ inputs.repo }}_${{ matrix.sys }} (pull request No.${PULL_NR})\"" >> $GITHUB_ENV + shell: bash + + - name: running ctest + run: | + source $GITHUB_WORKSPACE/util/generate_geo_test.sh + echo "Running ctest on ${{ matrix.sys }} " + ctest -S cmake/CI_CD/CDash.cmake -DBUILD_J=${NUM_THREADS}\ + -DTEST_MODEL=${TEST_MODEL}\ + -DTEST_NAME=${{ env.TEST_NAME }}\ + -DSITE_NAME="Github hosted (${{ github.repository }})"\ + --force-new-ctest-process \ + -V -E "(run_gen_sim|run_digi|run_aladin_digi|califasim2|landreco|elsim)" + shell: bash diff --git a/.github/actions/fsr/install-deps/action.yml b/.github/actions/fsr/install-deps/action.yml new file mode 100644 index 00000000..0b719b21 --- /dev/null +++ b/.github/actions/fsr/install-deps/action.yml @@ -0,0 +1,44 @@ +name: install-deps +description: 'steps to install deps' + +inputs: + r3b-dev-key: + description: 'key for r3b dev cache' + required: false + default: '' + cache-name: + description: 'repository name' + required: false + default: 'false' + +runs: + using: composite + steps: + - name: cache ucesb + if: github.event_name == 'pull_request' + id: cache-ucesb + uses: actions/cache/restore@v5 + with: + path: | + ${{ env.UCESB_DIR }} + ${{ github.workspace }}/build/_deps + key: build-deps + + - name: cache r3b + if: inputs.cache-name != 'false' && github.event_name == 'pull_request' + id: cache-r3b + uses: actions/cache/restore@v5 + with: + path: .ccache + key: r3b-build-${{ inputs.cache-name }}-${{ inputs.r3b-dev-key }} + restore-keys: | + r3b-build-${{ inputs.cache-name }}- + r3b-build- + + - name: build ucesb + if: steps.cache-ucesb.outputs.cache-hit != 'true' + run: | + export LD_LIBRARY_PATH="${SIMPATH}/lib/:${LD_LIBRARY_PATH}" + git clone https://git.chalmers.se/expsubphys/ucesb.git + cd ucesb && make -j${NUM_THREADS} empty/empty + shell: bash diff --git a/.github/actions/fsr/pre-build/action.yml b/.github/actions/fsr/pre-build/action.yml new file mode 100644 index 00000000..7a758bf9 --- /dev/null +++ b/.github/actions/fsr/pre-build/action.yml @@ -0,0 +1,31 @@ +name: pre build +description: 'steps before building R3BRoot with Sofia' + +runs: + using: composite + steps: + - name: set env variables + run: | + git config --global --add safe.directory $GITHUB_WORKSPACE + echo "UCESB_DIR=$GITHUB_WORKSPACE/ucesb/" >> $GITHUB_ENV + export SIMPATH=$FAIRSOFTPATH + echo "SIMPATH=${SIMPATH}" >> $GITHUB_ENV + echo "FAIRROOTPATH=$FAIRROOTPATH" >> $GITHUB_ENV + echo "${SIMPATH}/bin" >> $GITHUB_PATH + # variables for ccache + echo "CCACHE_BASEDIR=${GITHUB_WORKSPACE}" >> $GITHUB_ENV + echo "CCACHE_DIR=${GITHUB_WORKSPACE}/.ccache" >> $GITHUB_ENV + echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV + echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV + echo "SOURCEDIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV + echo "BUILDDIR=$GITHUB_WORKSPACE/build" >> $GITHUB_ENV + echo "cacheSHA=$([[ ${{github.event_name}} = "push" ]] && git rev-parse --short HEAD || git rev-parse --short HEAD^)" >> $GITHUB_ENV + shell: bash + + - name: update system + run: | + apt-get update + apt-get install --fix-missing -y sudo wget gnupg lsb-release + mkdir -p ${UCESB_DIR} + mkdir -p ${CCACHE_DIR} + shell: bash diff --git a/.github/actions/fsr/r3bbuild-steps/action.yml b/.github/actions/fsr/r3bbuild-steps/action.yml new file mode 100644 index 00000000..6bac5393 --- /dev/null +++ b/.github/actions/fsr/r3bbuild-steps/action.yml @@ -0,0 +1,48 @@ +name: build-steps +description: 'steps to build R3BRoot and ucesb' + + +inputs: + build-needed: + description: 'build process is needed' + required: false + default: 'true' + +runs: + using: composite + steps: + - if: ${{ matrix.url }} + name: add other repos + run: | + cd $GITHUB_WORKSPACE + for url in ${{ matrix.url }}; + do + git clone -b dev ${url} + done + shell: bash + + - name: cmake config ${{ matrix.repos }} + run: | + git config --global --add safe.directory $GITHUB_WORKSPACE + git submodule update --init --recursive + git clone https://github.com/R3BRootGroup/R3BRoot.git + cd .. + mv sofia/R3BRoot . + mv sofia R3BRoot + mv R3BRoot sofia + cd sofia + git clone https://github.com/R3BRootGroup/R3BFileSource.git + mv sofia/ucesb . + export UCESB_DIR=$GITHUB_WORKSPACE/ucesb/ + echo "UCESB_DIR=$GITHUB_WORKSPACE/ucesb/" >> $GITHUB_ENV + echo "" + echo "path environment variable: $PATH\n" + echo "" + cmake --preset ${{ matrix.preset }} . -C "$GITHUB_WORKSPACE/cmake/CI_CD/configure_options.cmake" + shell: bash + + - name: build ${{ matrix.repos }} + if: inputs.build-needed == 'true' + run: | + cmake --build ./build -- -j ${NUM_THREADS} + shell: bash diff --git a/.github/actions/pre-build/action.yml b/.github/actions/pre-build/action.yml index b4b51b6f..c0113380 100644 --- a/.github/actions/pre-build/action.yml +++ b/.github/actions/pre-build/action.yml @@ -7,6 +7,9 @@ runs: - name: set env variables run: | git config --global --add safe.directory $GITHUB_WORKSPACE + echo "UCESB_DIR=$GITHUB_WORKSPACE/ucesb/" >> $GITHUB_ENV + echo "ATIMA_DIR=$GITHUB_WORKSPACE/catima/" >> $GITHUB_ENV + echo "ATIMAPATH=$GITHUB_WORKSPACE/catima/install/" >> $GITHUB_ENV if [ "${{ matrix.cpp }}" == "20" ]; then export SIMPATH=${CVMDIR}/${{ matrix.os }}/fairsoft/cpp20/${{ matrix.fsv }} echo "SIMPATH=${SIMPATH}" >> $GITHUB_ENV @@ -39,6 +42,7 @@ runs: run: | apt-get update apt-get install --fix-missing -y sudo wget gnupg lsb-release + sudo -H pip3 install --ignore-installed -U conan wget https://cernbox.cern.ch/remote.php/dav/public-files/RmnTeeOZpYjCJQb/masterkey.gsi.de.pub mkdir -p /etc/cvmfs/keys mv masterkey.gsi.de.pub /etc/cvmfs/keys @@ -46,5 +50,7 @@ runs: echo "CVMFS_USER=$(whoami)" >> /etc/cvmfs/config.d/fairsoft.gsi.de.conf mkdir -p ${CVMDIR} mount -t cvmfs fairsoft.gsi.de ${CVMDIR} + mkdir -p ${UCESB_DIR} + mkdir -p ${ATIMA_DIR} mkdir -p ${CCACHE_DIR} shell: bash diff --git a/.github/actions/r3bbuild-steps/action.yml b/.github/actions/r3bbuild-steps/action.yml new file mode 100644 index 00000000..6bac5393 --- /dev/null +++ b/.github/actions/r3bbuild-steps/action.yml @@ -0,0 +1,48 @@ +name: build-steps +description: 'steps to build R3BRoot and ucesb' + + +inputs: + build-needed: + description: 'build process is needed' + required: false + default: 'true' + +runs: + using: composite + steps: + - if: ${{ matrix.url }} + name: add other repos + run: | + cd $GITHUB_WORKSPACE + for url in ${{ matrix.url }}; + do + git clone -b dev ${url} + done + shell: bash + + - name: cmake config ${{ matrix.repos }} + run: | + git config --global --add safe.directory $GITHUB_WORKSPACE + git submodule update --init --recursive + git clone https://github.com/R3BRootGroup/R3BRoot.git + cd .. + mv sofia/R3BRoot . + mv sofia R3BRoot + mv R3BRoot sofia + cd sofia + git clone https://github.com/R3BRootGroup/R3BFileSource.git + mv sofia/ucesb . + export UCESB_DIR=$GITHUB_WORKSPACE/ucesb/ + echo "UCESB_DIR=$GITHUB_WORKSPACE/ucesb/" >> $GITHUB_ENV + echo "" + echo "path environment variable: $PATH\n" + echo "" + cmake --preset ${{ matrix.preset }} . -C "$GITHUB_WORKSPACE/cmake/CI_CD/configure_options.cmake" + shell: bash + + - name: build ${{ matrix.repos }} + if: inputs.build-needed == 'true' + run: | + cmake --build ./build -- -j ${NUM_THREADS} + shell: bash diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a73ddff1..f68c83e1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ # Copyright (C) 2019 University of Santiago de Compostela # # Copyright (C) 2019 CEA-DAM-DIF, Université Paris-Saclay # # Copyright (C) 2023 University of Coruña # -# Copyright (C) 2019-2025 Members of R3B Collaboration # +# Copyright (C) 2019-2026 Members of R3B Collaboration # # # # This software is distributed under the terms of the # # GNU General Public Licence (GPL) version 3, # @@ -113,21 +113,7 @@ jobs: # A self-defined composite action for the cmake configuration and build # of r3broot (along with necessary dep repos). - name: Configure-build-sofia - run: | - git clone https://github.com/R3BRootGroup/R3BRoot.git - cd .. - mv sofia/R3BRoot . - mv sofia R3BRoot - mv R3BRoot sofia - cd sofia - git clone https://github.com/R3BRootGroup/macros.git - git clone https://github.com/R3BRootGroup/R3BFileSource.git - mv sofia/ucesb . - export UCESB_DIR=$GITHUB_WORKSPACE/ucesb/ - echo "UCESB_DIR=$GITHUB_WORKSPACE/ucesb/" >> $GITHUB_ENV - cmake --preset ${{ matrix.preset }} . -B build -C cmake/CI_CD/configure_options.cmake -DCMAKE_CXX_STANDARD=${{ matrix.cpp }} - cd build - make -j${NUM_THREADS} + uses: './.github/actions/r3bbuild-steps' # A self-defined composite action to perform the ctest and push the # results to the cdash (cmake-dashborad). To fully show the errors and diff --git a/.github/workflows/main_fsr.yml b/.github/workflows/main_fsr.yml new file mode 100644 index 00000000..a09fc37b --- /dev/null +++ b/.github/workflows/main_fsr.yml @@ -0,0 +1,120 @@ +############################################################################## +# Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH # +# Copyright (C) 2019 University of Santiago de Compostela # +# Copyright (C) 2019 CEA-DAM-DIF, Université Paris-Saclay # +# Copyright (C) 2023 University of Coruña # +# Copyright (C) 2019-2026 Members of R3B Collaboration # +# # +# This software is distributed under the terms of the # +# GNU General Public Licence (GPL) version 3, # +# copied verbatim in the file "LICENSE". # +# # +# In applying this license GSI does not waive the privileges and immunities # +# granted to it by virtue of its status as an Intergovernmental Organization # +# or submit itself to any jurisdiction. # +############################################################################## + +# This is the main CI workflow for pull requests to the sofia dev branch +# See the CI workflow developed for R3BRoot for more details +# SPDX-License-Identifier: LGPL-3.0-or-later + +name: CI-CD + +# Controls when the action will run. +on: + # Triggers the workflow in case of a push or pull request events (but only for + # the dev branch) + push: + branches: [ dev ] + pull_request: + branches: [ dev ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or +# parallelly. As has been specified above, all the jobs below will be +# triggered either by a pull request or a merge of a pull request. +jobs: + build-test: + runs-on: ubuntu-latest + # A strategy matrix gives different settings separately to different jobs + # which are run parallelly. + strategy: + # If fail-fast is true, all jobs running parallelly will be stopped if + # any of them fail. By setting it to false, all jobs will be run + # undisruptively. + fail-fast: false + # Definition of the strategy matrix + matrix: + # Each group is used by only one job. + repos: [ sofia ] + sys: [ debian13_cpp17_feb26p1_v19.0.1 , debian14_cpp17_feb26p1_v19.0.1 , ubuntu2604_cpp17_jan24p6_v19.0.1 ] + include: + - preset: simple + - repos: sofia + cache: sofia + + # Jobs are run inside a Docker container, which provides different compiled + # tool-kits for the building, such as clang-tidy and cvmfs. For more + # information, please visit the Docker repository at Dockerhub. + container: + image: r3bdockers/${{ matrix.sys }} + volumes: + - /tmp:/cvmfs + env: + CVMDIR: /cvmfs/fairsoft.gsi.de + # Specifying the number of threads available for the building and + # testing. Github hosted runners can have at most 4 cores. The number + # of the cores can be increased with a larger runner, thus increasing + # the speed of the run. + NUM_THREADS: 4 + # Options for the Docker container to be run with cvmfs. + options: --user root --privileged --ulimit nofile=10000:10000 --cap-add SYS_ADMIN --device /dev/fuse + + # Each job contains different steps that are executed sequentially. Each + # step could be multiple shell commands or a composite action either from + # another github repo or a self-defined one in .github/actions. + steps: + # Fetch updates from pull request branches using a public github action. + - uses: actions/checkout@v5 + with: + # This allows all commits of all branches to be fetched. + fetch-depth: 0 + + # A self-defined composite action. It sets multiple necessary environment + # variables and mounts the cmvfs folder of fairroot and fairsoft. + - name: Pre-build + uses: './.github/actions/fsr/pre-build' + + # A self-defined composite action, which restores the caches of + # dependencies and builds and install them if the cache doesn't exist. + # The two inputs for this action, r3b-dev-key and cache-name, determine + # the name (key) of the R3BRoot build cache being used in the the run. + # Its name is defined as + # "r3b-build-${cache-name}-${r3b-dev-key}". Apart from r3b build cache, + # there is another cache called "r3b-build-deps", which contains all + # dependencies for the R3BRoot build, such as googletest and ucesb. The + # cache restoring step is only used for the run triggered with + # "pull_request" and disabled for the merge event. + - name: Install dependencies + id: restore-cache + uses: './.github/actions/fsr/install-deps' + with: + cache-name: ${{ matrix.cache }} + r3b-dev-key: ${{ env.cacheSHA }} + + # A self-defined composite action for the cmake configuration and build + # of r3broot (along with necessary dep repos). + - name: Configure-build-sofia + uses: './.github/actions/fsr/r3bbuild-steps' + + # A self-defined composite action to perform the ctest and push the + # results to the cdash (cmake-dashborad). To fully show the errors and + # warnings during the configure and build processes, the two processes + # are rerun after 'make clean'. + - name: Ctest-cdash + if: always() + uses: './.github/actions/fsr/ctest-cdash' + with: + repo: ${{ matrix.repos }} diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 68db5541..72fd9909 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -3,7 +3,7 @@ # Copyright (C) 2019 University of Santiago de Compostela # # Copyright (C) 2019 CEA-DAM-DIF, Université Paris-Saclay # # Copyright (C) 2023 University of Coruña # -# Copyright (C) 2019-2025 Members of R3B Collaboration # +# Copyright (C) 2019-2026 Members of R3B Collaboration # # # # This software is distributed under the terms of the # # GNU General Public Licence (GPL) version 3, # diff --git a/README.md b/README.md index cfae2f16..af950b1b 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Please ask your questions, request features, and report issues by [creating a gi The SOFIA project uses clang-format-16 to ensure a common code formatting. The script "apply-format.sh" can be used for this purpose: ~~~bash -bash apply-format.sh +. apply-format.sh ~~~ ## Spell Checking @@ -335,8 +335,10 @@ The following systems are tested regularly. | Debian | x86\_64 | 11 | GCC 10.2.1 | 3.27.4 / 3.30.0 | C++17 | | Debian | x86\_64 | 12 | GCC 12.2.0 | 3.27.4 / 3.30.0 | C++17 / C++20 | | Debian | x86\_64 | 13 | GCC 14.2.0 | 3.31.6 / 4.0.3 | C++17 | +| Debian | x86\_64 | 14 | GCC 15.2.0 | 4.0.3 | C++17 | | Ubuntu | x86\_64 | 24.04 | GCC 13.3.0 | 3.28.3 / 4.0.3 | C++17 / C++20 | | Ubuntu | x86\_64 | 25.04 | GCC 14.2.0 | 3.31.6 / 4.0.3 | C++17 | +| Ubuntu | x86\_64 | 26.04 | GCC 15.2.0 | 4.0.3 | C++17 | ## More Information