-
Notifications
You must be signed in to change notification settings - Fork 23
148 lines (136 loc) · 6.17 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# This is the main CI workflow for pull requests to the sofia dev branch
# See the CI workflow developed for R3BRoot for more details
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:
# Here are the groups of repositories that need to be downloaded inside
# r3broot. Each group is used by only one job.
repos: [ sofia ]
# The list under "include" defines some properties for each group:
#
# repos: the name of the group. It must exist in matrix.repos as
# defined above.
#
# cache: the name of the cache file that will be created/used for the
# job. Each group can have their own cache file. But the total size of
# the cache files are limited to 10 GB per project. Therefore, the
# number of caches should be kept to a minimum. If there isn't too
# much difference between glad-tpc and the base r3broot, the cache file
# generated from r3broot build can be used.
#
# skip-save: whether to save the cache or not. Cache saving is disabled
# when true. This is neccessary when two parellel jobs share one cache
# name.
#
# url: the github repository urls that need to be downloaded during the
# run
include:
# This job is only for testing R3BRoot without downloading any
# dependencies.
- 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: yanzhaowang/cvmfs_clang:v15
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 2 cores. The number
# of the cores can be increased with a larger runner, thus increasing
# the speed of the run.
NUM_THREADS: 2
# 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@v3
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/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/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
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
mv sofia/ucesb .
cmake . -B build -C cmake/CI_CD/configure_options.cmake
cmake --build ./build -- -j ${NUM_THREADS}
# 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/ctest-cdash'
with:
repo: ${{ matrix.repos }}
# A composite action to save the ccaahe created from the merge events.
# Cache names (key) should be consistent with the names used in the
# cache restoring step.
- name: save-cache
if: github.event_name == 'push' && matrix.skip-save != true
id: save-cache
uses: './.github/actions/cache-save'
with:
cache-name: ${{ matrix.cache }}
r3b-dev-key: ${{ env.cacheSHA }}
# Show the cache hit rate from ccache.
- name: ccache stats
if: github.event_name == 'pull_request' && always()
run: ccache --show-stats