|
| 1 | +# This is the main CI workflow for nightly simulation tests with the R3BRoot dev branch. |
| 2 | +# |
| 3 | +# To have successful and fast compilation and build processes, a Docker |
| 4 | +# container embedded with the cvmfs is also used in the workflow. The cvmfs is |
| 5 | +# very similar to sshfs which directly mounts a remote folder to the local |
| 6 | +# filesystem. Using cvmfs inside a docker container further improves the speed |
| 7 | +# of the workflow: saving install time for some essential dependencies (gcc, |
| 8 | +# llvm clang, cvmfs etc.). |
| 9 | + |
| 10 | +# It must be also noted that the speed of the worksflow varies a lot depending |
| 11 | +# on the CPUs of the Github hosted servers. Current servers (free version) have at |
| 12 | +# most 4 cores for each run and bigger servers (paid version) can have up |
| 13 | +# to 4, 8 or even 16 cores. |
| 14 | + |
| 15 | +# The workflow also submits the configure, build and test results to CDash |
| 16 | +# (cmake dashborad) with two different models: Experimental and Continuous for |
| 17 | +# the pull request and merge respectively. For the pull request (Experimental), |
| 18 | +# the project is built with the cache files from ccache while for the merge |
| 19 | +# (Continuous) it's built from scratch without using any cache files. |
| 20 | +# |
| 21 | +# SPDX-License-Identifier: LGPL-3.0-or-later |
| 22 | + |
| 23 | +name: CI-CD-nightly-sim |
| 24 | + |
| 25 | +# Controls when the action will run. |
| 26 | +on: |
| 27 | + schedule: |
| 28 | + - cron: '0 21 * * 3' |
| 29 | + - cron: '0 21 * * 6' |
| 30 | + # Allows you to run this workflow manually from the Actions tab |
| 31 | + workflow_dispatch: |
| 32 | + |
| 33 | +# A workflow run is made up of one or more jobs that can run sequentially or |
| 34 | +# parallelly. As has been specified above, all the jobs below will be |
| 35 | +# triggered either by a pull request or a merge of a pull request. |
| 36 | +jobs: |
| 37 | + # The job to clean the old caches before new caches are created when the PR is merged. |
| 38 | + cache-cleanup: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + fetch-depth: 0 |
| 44 | + submodules: 'true' |
| 45 | + - name: clean-cache |
| 46 | + if: github.event_name == 'push' |
| 47 | + uses: './.github/actions/cache-clean' |
| 48 | + with: |
| 49 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + |
| 51 | + # The job to run the main CI pipelines |
| 52 | + build-test: |
| 53 | + needs: cache-cleanup |
| 54 | + runs-on: ubuntu-latest |
| 55 | + # A strategy matrix gives different settings separately to different jobs |
| 56 | + # which are run parallelly. |
| 57 | + strategy: |
| 58 | + # If fail-fast is true, all jobs running parallelly will be stopped if |
| 59 | + # any of them fail. By setting it to false, all jobs will be run |
| 60 | + # undisruptively. |
| 61 | + fail-fast: false |
| 62 | + # Definition of the strategy matrix. See |
| 63 | + # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow |
| 64 | + matrix: |
| 65 | + # Here are the groups of repositories that need to be downloaded inside |
| 66 | + # r3broot. Each group is used by only one job. |
| 67 | + repos: [ r3broot, glad-tpc, sofia-frs-asy ] |
| 68 | + os: [ debian10, debian11, debian12 ] # ubuntu24.04 ] |
| 69 | + |
| 70 | + # The list under "include" defines some properties for each group: |
| 71 | + # |
| 72 | + # repos: the name of the group. It must exist in matrix.repos as |
| 73 | + # defined above. |
| 74 | + # |
| 75 | + # cache: the name of the cache file that will be created/used for the |
| 76 | + # job. Each group can have their own cache file. But the total size of |
| 77 | + # the cache files are limited to 10 GB per project. Therefore, the |
| 78 | + # number of caches should be kept to a minimum. If there isn't too |
| 79 | + # much difference between glad-tpc and the base r3broot, the cache file |
| 80 | + # generated from r3broot build can be used. |
| 81 | + # |
| 82 | + # skip-save: whether to save the cache or not. Cache saving is disabled |
| 83 | + # when true. This is neccessary when two parellel jobs share one cache |
| 84 | + # name. |
| 85 | + # |
| 86 | + # url: the github repository urls that need to be downloaded during the |
| 87 | + # run |
| 88 | + include: |
| 89 | + # The R3BFileSource repo is used for testing unpacking. |
| 90 | + - cache: r3broot |
| 91 | + # disable conan build by default |
| 92 | + - preset: simple |
| 93 | + |
| 94 | + # This job is only for testing R3BRoot without downloading any |
| 95 | + # dependencies. |
| 96 | + - repos: r3broot |
| 97 | + # The job for testing with glad-tpc |
| 98 | + - repos: glad-tpc |
| 99 | + url: https://github.com/R3BRootGroup/glad-tpc.git |
| 100 | + cache: glad-tpc |
| 101 | + # skip-save: true |
| 102 | + # The job for testing with sofia, frs and asyeos dependencies. All three |
| 103 | + # repositories are downloaded and run together in the job. |
| 104 | + - repos: sofia-frs-asy |
| 105 | + # If more than one repos needs to be downloaded in a job. "url" needs |
| 106 | + # to be a space separated list of urls using the operator ">-". Append |
| 107 | + # more urls to this list if more repos need to be added. |
| 108 | + # The R3BFileSource repo is used for testing unpacking. |
| 109 | + url: >- |
| 110 | + https://github.com/R3BRootGroup/sofia.git |
| 111 | + https://github.com/R3BRootGroup/frs.git |
| 112 | + https://github.com/R3BRootGroup/asyeos.git |
| 113 | + # Using own cache file |
| 114 | + cache: other-repos |
| 115 | + |
| 116 | + # Jobs are run inside a Docker container, which provides different compiled |
| 117 | + # tool-kits for the building, such as clang-tidy and cvmfs. For more |
| 118 | + # information, please visit the Docker repository at Dockerhub. |
| 119 | + container: |
| 120 | + image: r3bdockers/${{ matrix.os }} |
| 121 | + volumes: |
| 122 | + - /tmp:/cvmfs |
| 123 | + env: |
| 124 | + CVMDIR: /cvmfs/fairsoft.gsi.de |
| 125 | + # Specifying the number of threads available for the building and |
| 126 | + # testing. Github hosted runners can have at most 4 cores. The number |
| 127 | + # of the cores can be increased with a larger runner, thus increasing |
| 128 | + # the speed of the run. |
| 129 | + NUM_THREADS: 4 |
| 130 | + # Options for the Docker container to be run with cvmfs. |
| 131 | + options: --user root --privileged --ulimit nofile=10000:10000 --cap-add SYS_ADMIN --device /dev/fuse |
| 132 | + |
| 133 | + # Each job contains different steps that are executed sequentially. Each |
| 134 | + # step could be multiple shell commands or a composite action either from |
| 135 | + # another github repo or a self-defined one in .github/actions. |
| 136 | + steps: |
| 137 | + # Fetch updates from pull request branches using a public github action. |
| 138 | + - uses: actions/checkout@v4 |
| 139 | + with: |
| 140 | + # This allows all commits of all branches to be fetched. |
| 141 | + fetch-depth: 0 |
| 142 | + |
| 143 | + # A self-defined composite action. It sets multiple necessary environment |
| 144 | + # variables and mounts the cmvfs folder of fairroot and fairsoft. |
| 145 | + - name: pre-build |
| 146 | + uses: './.github/actions/pre-build' |
| 147 | + |
| 148 | + - name: set custom CMake path |
| 149 | + run: echo "/usr/local/bin" >> $GITHUB_PATH && cmake --version && export PATH=/usr/local/bin:$PATH && cmake --version |
| 150 | + |
| 151 | + # A self-defined composite action, which restores the caches of |
| 152 | + # dependencies and builds and install them if the cache doesn't exist. |
| 153 | + # The two inputs for this action, r3b-dev-key and cache-name, determine |
| 154 | + # the name (key) of the R3BRoot build cache being used in the the run. |
| 155 | + # Its name is defined as |
| 156 | + # "r3b-build-${cache-name}-${r3b-dev-key}". Apart from r3b build cache, |
| 157 | + # there is another cache called "r3b-build-deps", which contains all |
| 158 | + # dependencies for the R3BRoot build, such as googletest and ucesb. The |
| 159 | + # cache restoring step is only used for the run triggered with |
| 160 | + # "pull_request" and disabled for the merge event. |
| 161 | +# - name: install dependencies |
| 162 | +# id: restore-cache |
| 163 | +# uses: './.github/actions/install-deps' |
| 164 | +# with: |
| 165 | +# cache-name: ${{ matrix.cache }} |
| 166 | + - name: unset UCESB_DIR for simulation tests |
| 167 | + run: echo "UCESB_DIR=" >> $GITHUB_ENV |
| 168 | + shell: bash |
| 169 | + |
| 170 | + # A self-defined composite action for the cmake configuration and build |
| 171 | + # of r3broot (along with necessary dep repos). |
| 172 | + - name: configure-build |
| 173 | + uses: './.github/actions/r3bbuild-steps' |
| 174 | + |
| 175 | + # A self-defined composite action to perform the ctest and push the |
| 176 | + # results to the cdash (cmake-dashborad). To fully show the errors and |
| 177 | + # warnings during the configure and build processes, the two processes |
| 178 | + # are rerun after 'make clean'. |
| 179 | + - name: ctest-cdash |
| 180 | + if: always() |
| 181 | + uses: './.github/actions/ctest-cdash' |
| 182 | + with: |
| 183 | + repo: ${{ matrix.repos }} |
| 184 | + |
| 185 | + # A composite action to save the ccaahe created from the merge events. |
| 186 | + # Cache names (key) should be consistent with the names used in the |
| 187 | + # cache restoring step. |
| 188 | + - name: save-cache |
| 189 | + if: github.event_name == 'push' && matrix.skip-save != true |
| 190 | + id: save-cache |
| 191 | + uses: './.github/actions/cache-save' |
| 192 | + with: |
| 193 | + cache-name: ${{ matrix.cache }} |
| 194 | + r3b-dev-key: ${{ env.cacheSHA }} |
| 195 | + |
| 196 | + # Show the cache hit rate from ccache. |
| 197 | + - name: ccache stats |
| 198 | + if: github.event_name == 'pull_request' && always() |
| 199 | + run: ccache --show-stats |
0 commit comments