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