blob: fc36cb753b17a728a9aa04afcc20b7b61b0b4e55 [file] [log] [blame]
Michal Vasko5f861fe2021-05-26 10:55:04 +02001name: libnetconf2 CI
2on:
3 push:
4 branches:
Michal Vasko7678c5d2021-05-27 10:32:13 +02005 - master
6 - devel
Michal Vasko5f861fe2021-05-26 10:55:04 +02007 pull_request:
8 branches:
Michal Vasko7678c5d2021-05-27 10:32:13 +02009 - master
10 - devel
Michal Vasko5f861fe2021-05-26 10:55:04 +020011
12env:
romand72bc322023-10-26 15:46:01 +020013 DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev libpam0g-dev libcurl4-openssl-dev
Michal Vasko5f861fe2021-05-26 10:55:04 +020014
15jobs:
Michal Vasko0ddf5f72021-05-28 11:06:34 +020016 git-branch:
17 name: Get git branch
Michal Vaskof931c492022-11-09 10:55:26 +010018 runs-on: ubuntu-latest
Michal Vasko0ddf5f72021-05-28 11:06:34 +020019 outputs:
20 branch-name: ${{ steps.get-git-branch.outputs.branch-name }}
21 steps:
22 - id: get-git-branch
23 run: |
24 if ${{ github.event_name == 'push' }}
25 then export GIT_BRANCH=`echo ${{ github.ref }} | cut -d'/' -f 3`
26 else
27 export GIT_BRANCH=${{ github.base_ref }}
28 fi
Michal Vasko1d69b0d2022-11-09 11:06:12 +010029 echo "branch-name=$GIT_BRANCH" >> $GITHUB_OUTPUT
Michal Vasko0ddf5f72021-05-28 11:06:34 +020030
Michal Vasko5f861fe2021-05-26 10:55:04 +020031 build:
32 name: ${{ matrix.config.name }}
Michal Vasko0ddf5f72021-05-28 11:06:34 +020033 runs-on: ${{ matrix.config.os }}
34 needs: git-branch
Michal Vasko5f861fe2021-05-26 10:55:04 +020035 strategy:
36 fail-fast: false
37 matrix:
38 config:
39 - {
romanb16f3492024-05-13 14:22:17 +020040 name: "Release, gcc, OpenSSL",
Michal Vaskof931c492022-11-09 10:55:26 +010041 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +020042 build-type: "Release",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020043 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020044 cc: "gcc",
Michal Vasko2cd71632021-06-04 12:03:12 +020045 options: "-DENABLE_TESTS=ON -DENABLE_DNSSEC=ON",
romanb16f3492024-05-13 14:22:17 +020046 tls-lib: "OpenSSL",
47 packages: "",
48 snaps: "",
49 make-prepend: "",
50 make-target: ""
51 }
52 - {
53 name: "Release, gcc, MbedTLS",
54 os: "ubuntu-22.04",
55 build-type: "Release",
56 dep-build-type: "Release",
57 cc: "gcc",
58 options: "-DENABLE_TESTS=ON -DENABLE_DNSSEC=ON",
59 tls-lib: "MbedTLS",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020060 packages: "",
61 snaps: "",
62 make-prepend: "",
63 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020064 }
65 - {
Michal Vasko1d69b0d2022-11-09 11:06:12 +010066 name: "Release, clang",
Michal Vaskof931c492022-11-09 10:55:26 +010067 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +020068 build-type: "Release",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020069 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020070 cc: "clang",
Michal Vasko2cd71632021-06-04 12:03:12 +020071 options: "-DENABLE_TESTS=ON -DENABLE_DNSSEC=ON",
romanb16f3492024-05-13 14:22:17 +020072 tls-lib: "OpenSSL",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020073 packages: "",
74 snaps: "",
75 make-prepend: "",
76 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020077 }
78 - {
romanb16f3492024-05-13 14:22:17 +020079 name: "Debug, gcc, OpenSSL",
Michal Vaskof931c492022-11-09 10:55:26 +010080 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +020081 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020082 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020083 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +020084 options: "-DENABLE_DNSSEC=ON",
romanb16f3492024-05-13 14:22:17 +020085 tls-lib: "OpenSSL",
86 packages: "valgrind",
87 snaps: "",
88 make-prepend: "",
89 make-target: ""
90 }
91 - {
92 name: "Debug, gcc, MbedTLS",
93 os: "ubuntu-22.04",
94 build-type: "Debug",
95 dep-build-type: "Release",
96 cc: "gcc",
97 options: "-DENABLE_DNSSEC=ON",
98 tls-lib: "MbedTLS",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020099 packages: "valgrind",
100 snaps: "",
101 make-prepend: "",
102 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +0200103 }
104 - {
Michal Vasko1d69b0d2022-11-09 11:06:12 +0100105 name: "Debug, clang",
Michal Vaskof931c492022-11-09 10:55:26 +0100106 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200107 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200108 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200109 cc: "clang",
Michal Vasko885f60b2021-05-28 11:15:15 +0200110 options: "-DENABLE_DNSSEC=ON",
romanb16f3492024-05-13 14:22:17 +0200111 tls-lib: "OpenSSL",
Michal Vasko5f5edc12022-11-09 11:27:08 +0100112 # no valgrind because it does not support DWARF5 yet generated by clang 14
113 packages: "",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200114 snaps: "",
115 make-prepend: "",
116 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +0200117 }
118 - {
Michal Vasko5f861fe2021-05-26 10:55:04 +0200119 name: "No SSH nor TLS",
Michal Vaskof931c492022-11-09 10:55:26 +0100120 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200121 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200122 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200123 cc: "gcc",
roman3e72ab62023-10-26 16:11:12 +0200124 options: "-DENABLE_SSH_TLS=OFF",
romanb16f3492024-05-13 14:22:17 +0200125 tls-lib: "",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200126 packages: "valgrind",
127 snaps: "",
128 make-prepend: "",
129 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +0200130 }
131 - {
romanb16f3492024-05-13 14:22:17 +0200132 name: "ASAN and UBSAN, OpenSSL",
Michal Vaskof931c492022-11-09 10:55:26 +0100133 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200134 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200135 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200136 cc: "clang",
137 options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_VALGRIND_TESTS=OFF",
romanb16f3492024-05-13 14:22:17 +0200138 tls-lib: "OpenSSL",
139 packages: "",
140 snaps: "",
141 make-prepend: "",
142 make-target: ""
143 }
144 - {
145 name: "ASAN and UBSAN, MbedTLS",
146 os: "ubuntu-22.04",
147 build-type: "Debug",
148 dep-build-type: "Release",
149 cc: "clang",
150 options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_VALGRIND_TESTS=OFF",
151 tls-lib: "MbedTLS",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200152 packages: "",
153 snaps: "",
154 make-prepend: "",
155 make-target: ""
156 }
157 - {
158 name: "ABI Check",
Michal Vaskof931c492022-11-09 10:55:26 +0100159 os: "ubuntu-22.04",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200160 build-type: "ABICheck",
161 dep-build-type: "Debug",
162 cc: "gcc",
163 options: "",
romanb16f3492024-05-13 14:22:17 +0200164 tls-lib: "OpenSSL",
Michal Vaskoe53d2602021-07-26 10:19:30 +0200165 packages: "abi-dumper abi-compliance-checker snap",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200166 snaps: "core universal-ctags",
167 make-prepend: "",
168 make-target: "abi-check"
169 }
Michal Vasko1d8a20b2024-08-01 13:42:00 +0200170 - {
171 name: "DEB Package",
172 os: "ubuntu-22.04",
173 build-type: "Release",
174 dep-build-type: "Release",
175 cc: "gcc",
176 options: "",
177 tls-lib: "OpenSSL",
178 packages: "cmake debhelper valgrind python3-pip",
179 snaps: "",
180 make-prepend: "",
181 make-target: ""
182 }
Michal Vasko5f861fe2021-05-26 10:55:04 +0200183
184 steps:
Michal Vaskofd20a502024-07-04 09:14:34 +0200185 - uses: actions/checkout@main
Michal Vasko1d8a20b2024-08-01 13:42:00 +0200186 with:
187 fetch-depth: 100
roman6a8947b2022-07-21 11:31:44 +0200188
189 - name: Deps-packages
190 shell: bash
191 run: |
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200192 sudo apt-get update
193 sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }}
194 if ${{ matrix.config.snaps != '' }}
Michal Vaskoe53d2602021-07-26 10:19:30 +0200195 then sudo snap refresh; sudo snap install ${{ matrix.config.snaps }}
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200196 fi
Michal Vasko1d8a20b2024-08-01 13:42:00 +0200197 if ${{ matrix.config.name == 'DEB Package' }}; then
198 pip install apkg
199 apkg system-setup
200 fi
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200201
202 - name: Deps-uncrustify
Michal Vasko5f861fe2021-05-26 10:55:04 +0200203 shell: bash
204 working-directory: ${{ github.workspace }}
205 run: |
Michal Vaskoac1786b2023-05-19 11:28:31 +0200206 git clone --branch uncrustify-0.77.1 https://github.com/uncrustify/uncrustify
Michal Vasko5f861fe2021-05-26 10:55:04 +0200207 cd uncrustify
208 mkdir build
209 cd build
210 CC=${{ matrix.config.cc }} cmake ..
211 make
212 sudo make install
romanb16f3492024-05-13 14:22:17 +0200213 if: ${{ matrix.config.name == 'Debug, gcc, OpenSSL' || matrix.config.name == 'Debug, gcc, MbedTLS' }}
Michal Vasko5f861fe2021-05-26 10:55:04 +0200214
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200215 - name: Deps-libyang
Michal Vasko5f861fe2021-05-26 10:55:04 +0200216 shell: bash
217 run: |
Michal Vasko1d69b0d2022-11-09 11:06:12 +0100218 git clone -b ${{ needs.git-branch.outputs.branch-name }} https://github.com/CESNET/libyang.git
Michal Vasko5f861fe2021-05-26 10:55:04 +0200219 cd libyang
Michal Vasko1d8a20b2024-08-01 13:42:00 +0200220 if ${{ matrix.config.name == 'DEB Package' }}; then
221 apkg build
222 apkg install
223 else
224 mkdir build
225 cd build
226 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_TESTS=OFF ..
227 make -j2
228 sudo make install
229 fi
230
231 - name: Build-and-install-package
232 shell: bash
233 working-directory: ${{ github.workspace }}
234 run: |
235 apkg build
236 apkg install
237 if: ${{ matrix.config.name == 'DEB Package' }}
Michal Vasko5f861fe2021-05-26 10:55:04 +0200238
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200239 - name: Deps-libval
240 shell: bash
241 run: |
Michal Vasko29721a82021-05-26 12:05:08 +0200242 git clone https://github.com/DNSSEC-Tools/DNSSEC-Tools.git dnssec-tools
243 cd dnssec-tools/dnssec-tools/validator
244 ./configure
245 make -j2
246 sudo make install
Michal Vasko1d8a20b2024-08-01 13:42:00 +0200247 if: ${{ matrix.config.name != 'DEB Package' }}
Michal Vasko29721a82021-05-26 12:05:08 +0200248
romanb16f3492024-05-13 14:22:17 +0200249 - name: Deps-MbedTLS
250 shell: bash
251 run: |
252 git clone -b mbedtls-3.5.2 https://github.com/Mbed-TLS/mbedtls.git
253 cd mbedtls
254 mkdir build
255 cd build
256 CC=${{ matrix.config.cc }} cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On -DENABLE_TESTING=Off ..
257 make -j2
258 sudo make install
259 if: ${{ matrix.config.tls-lib == 'MbedTLS' }}
260
Michal Vasko5f861fe2021-05-26 10:55:04 +0200261 - name: Configure
262 shell: bash
263 working-directory: ${{ github.workspace }}
264 run: |
265 mkdir build
266 cd build
Michal Vasko885f60b2021-05-28 11:15:15 +0200267 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
Michal Vasko1d8a20b2024-08-01 13:42:00 +0200268 if: ${{ matrix.config.name != 'DEB Package' }}
Michal Vasko5f861fe2021-05-26 10:55:04 +0200269
270 - name: Build
271 shell: bash
272 working-directory: ${{ github.workspace }}/build
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200273 run: |
274 export LC_ALL=C.UTF-8
275 export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH
276 ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }}
Michal Vasko1d8a20b2024-08-01 13:42:00 +0200277 if: ${{ matrix.config.name != 'DEB Package' }}
Michal Vasko5f861fe2021-05-26 10:55:04 +0200278
279 - name: Test
280 shell: bash
281 working-directory: ${{ github.workspace }}/build
roman6a8947b2022-07-21 11:31:44 +0200282 run: |
283 export LSAN_OPTIONS=suppressions=${{ github.workspace }}/tests/library_lsan.supp
Jan Kundrát957d8ec2024-04-08 12:16:25 +0200284 ctest -j4 --output-on-failure
Michal Vasko1d8a20b2024-08-01 13:42:00 +0200285 if: ${{ matrix.config.name != 'DEB Package' }}