forked from sysrepo/sysrepo
-
Notifications
You must be signed in to change notification settings - Fork 0
271 lines (256 loc) · 9.71 KB
/
ci.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
name: sysrepo CI
on:
push:
branches:
- master
- devel
pull_request:
branches:
- master
- devel
jobs:
git-branch:
name: Get git branch
runs-on: ubuntu-latest
outputs:
branch-name: ${{ steps.get-git-branch.outputs.branch-name }}
steps:
- id: get-git-branch
run: |
if ${{ github.event_name == 'push' }}
then export GIT_BRANCH=`echo ${{ github.ref }} | cut -d'/' -f 3`
else
export GIT_BRANCH=${{ github.base_ref }}
fi
echo "branch-name=$GIT_BRANCH" >> $GITHUB_OUTPUT
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }} # mac-OS does not implement robust mutexes so it is not supported
needs: git-branch
strategy:
fail-fast: false
matrix:
config:
- {
name: "Release, gcc",
os: "ubuntu-22.04",
build-type: "Release",
dep-build-type: "Release",
cc: "gcc",
options: "-DENABLE_TESTS=ON",
packages: "libcmocka-dev",
snaps: "",
make-target: ""
}
- {
name: "Release, clang",
os: "ubuntu-22.04",
build-type: "Release",
dep-build-type: "Release",
cc: "clang",
options: "-DENABLE_TESTS=ON",
packages: "libcmocka-dev",
snaps: "",
make-target: ""
}
- {
name: "Debug, gcc",
os: "ubuntu-22.04",
build-type: "Debug",
dep-build-type: "Debug",
cc: "gcc",
options: "",
packages: "libcmocka-dev valgrind",
snaps: "",
make-target: ""
}
- {
name: "Debug, clang",
os: "ubuntu-22.04",
build-type: "Debug",
dep-build-type: "Debug",
cc: "clang",
options: "",
# no valgrind because it does not support DWARF5 yet generated by clang 14
packages: "libcmocka-dev",
snaps: "",
make-target: ""
}
- {
name: "ASAN and UBSAN",
os: "ubuntu-22.04",
build-type: "Debug",
dep-build-type: "Debug",
cc: "clang",
options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF",
packages: "libcmocka-dev",
snaps: "",
make-target: "",
ubsan-options: "print_stacktrace=1:halt_on_error=1",
}
- {
name: "ABI Check",
os: "ubuntu-latest",
build-type: "ABICheck",
dep-build-type: "Debug",
cc: "gcc",
options: "",
packages: "libcmocka-dev abi-dumper abi-compliance-checker",
snaps: "core universal-ctags",
make-target: "abi-check"
}
- {
name: "MONGO DS plugin",
os: "ubuntu-22.04",
build-type: "Debug",
dep-build-type: "Debug",
cc: "gcc",
options: "-DDEFAULT_STARTUP_DS_PLG=\"MONGO DS\" -DDEFAULT_RUNNING_DS_PLG=\"MONGO DS\" -DDEFAULT_CANDIDATE_DS_PLG=\"MONGO DS\" -DDEFAULT_OPERATIONAL_DS_PLG=\"MONGO DS\" -DDEFAULT_FACTORY_DEFAULT_DS_PLG=\"MONGO DS\"",
packages: "libcmocka-dev valgrind",
snaps: "",
make-target: ""
}
- {
name: "MONGO DS plugin latest",
os: "ubuntu-22.04",
build-type: "Debug",
dep-build-type: "Debug",
cc: "gcc",
options: "-DDEFAULT_STARTUP_DS_PLG=\"MONGO DS\" -DDEFAULT_RUNNING_DS_PLG=\"MONGO DS\" -DDEFAULT_CANDIDATE_DS_PLG=\"MONGO DS\" -DDEFAULT_OPERATIONAL_DS_PLG=\"MONGO DS\" -DDEFAULT_FACTORY_DEFAULT_DS_PLG=\"MONGO DS\"",
packages: "libcmocka-dev valgrind",
snaps: "",
make-target: ""
}
- {
name: "REDIS DS plugin",
os: "ubuntu-22.04",
build-type: "Debug",
dep-build-type: "Debug",
cc: "gcc",
options: "-DDEFAULT_STARTUP_DS_PLG=\"REDIS DS\" -DDEFAULT_RUNNING_DS_PLG=\"REDIS DS\" -DDEFAULT_CANDIDATE_DS_PLG=\"REDIS DS\" -DDEFAULT_OPERATIONAL_DS_PLG=\"REDIS DS\" -DDEFAULT_FACTORY_DEFAULT_DS_PLG=\"REDIS DS\"",
packages: "libcmocka-dev valgrind",
snaps: "",
make-target: ""
}
- {
name: "REDIS DS plugin latest",
os: "ubuntu-22.04",
build-type: "Debug",
dep-build-type: "Debug",
cc: "gcc",
options: "-DDEFAULT_STARTUP_DS_PLG=\"REDIS DS\" -DDEFAULT_RUNNING_DS_PLG=\"REDIS DS\" -DDEFAULT_CANDIDATE_DS_PLG=\"REDIS DS\" -DDEFAULT_OPERATIONAL_DS_PLG=\"REDIS DS\" -DDEFAULT_FACTORY_DEFAULT_DS_PLG=\"REDIS DS\"",
packages: "libcmocka-dev valgrind",
snaps: "",
make-target: ""
}
env:
UBSAN_OPTIONS: ${{ matrix.config.ubsan-options }}
steps:
- uses: actions/checkout@main
- name: Deps-packages
shell: bash
run: |
sudo apt-get update
if ${{ matrix.config.packages != '' }}
then sudo apt-get install ${{ matrix.config.packages }}
fi
if ${{ matrix.config.snaps != '' }}
then sudo snap install ${{ matrix.config.snaps }}
fi
- name: Deps-uncrustify
shell: bash
working-directory: ${{ github.workspace }}
run: |
git clone --branch uncrustify-0.77.1 https://github.com/uncrustify/uncrustify
cd uncrustify
mkdir build
cd build
CC=${{ matrix.config.cc }} cmake ..
make
sudo make install
if: ${{ matrix.config.name == 'Debug, gcc' }}
- name: Deps-libyang
shell: bash
run: |
git clone -b ${{ needs.git-branch.outputs.branch-name }} https://github.com/CESNET/libyang.git
cd libyang
mkdir build
cd build
CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_TESTS=OFF ..
make -j2
sudo make install
- name: Deps-MongoDB
shell: bash
run: |
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
if: ${{ matrix.config.name == 'MONGO DS plugin' || matrix.config.name == 'MONGO DS plugin latest' }}
- name: Deps-libmongoc
shell: bash
run: |
wget https://github.com/mongodb/mongo-c-driver/releases/download/1.24.0/mongo-c-driver-1.24.0.tar.gz
tar xzf mongo-c-driver-1.24.0.tar.gz
cd mongo-c-driver-1.24.0
mkdir cmake-build
cd cmake-build
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
cmake --build .
sudo cmake --build . --target install
if: ${{ matrix.config.name == 'MONGO DS plugin' }}
- name: Deps-libmongoc-latest
shell: bash
run: |
git clone https://github.com/mongodb/mongo-c-driver.git
cd mongo-c-driver
cmake -S . -B ./_build -D ENABLE_EXTRA_ALIGNMENT=OFF -D ENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -D CMAKE_BUILD_TYPE=RelWithDebInfo -D ENABLE_MONGOC=ON
cmake --build ./_build --config RelWithDebInfo --parallel
sudo cmake --install "./_build" --prefix "/usr/local"
if: ${{ matrix.config.name == 'MONGO DS plugin latest' }}
- name: Deps-RedisDB
shell: bash
run: |
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
sudo apt-get update
sudo apt-get install redis-stack-server
sudo service redis-stack-server start
if: ${{ matrix.config.name == 'REDIS DS plugin' || matrix.config.name == 'REDIS DS plugin latest' }}
- name: Deps-libhiredis
shell: bash
run: |
wget https://github.com/redis/hiredis/archive/refs/tags/v1.1.0.tar.gz
tar xzf v1.1.0.tar.gz
cd hiredis-1.1.0
make
sudo make install
if: ${{ matrix.config.name == 'REDIS DS plugin' }}
- name: Deps-libhiredis-latest
shell: bash
run: |
git clone https://github.com/redis/hiredis.git
cd hiredis
make
sudo make install
if: ${{ matrix.config.name == 'REDIS DS plugin latest' }}
- name: Configure
shell: bash
working-directory: ${{ github.workspace }}
run: |
mkdir build
cd build
CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
- name: Build
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
export LC_ALL=C.UTF-8
export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH
make ${{ matrix.config.make-target }}
- name: Test
shell: bash
working-directory: ${{ github.workspace }}/build
run: ctest --output-on-failure