blob: d1a64bda1b1ed4391906bf2ab7448e3ffb4a837e [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:
Michal Vasko29721a82021-05-26 12:05:08 +020013 DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev
Michal Vasko885f60b2021-05-28 11:15:15 +020014 COVERITY_PROJECT: CESNET%2Flibnetconf2
Michal Vasko5f861fe2021-05-26 10:55:04 +020015
16jobs:
Michal Vasko0ddf5f72021-05-28 11:06:34 +020017 git-branch:
18 name: Get git branch
19 runs-on: ubuntu-18.04
20 outputs:
21 branch-name: ${{ steps.get-git-branch.outputs.branch-name }}
22 steps:
23 - id: get-git-branch
24 run: |
25 if ${{ github.event_name == 'push' }}
26 then export GIT_BRANCH=`echo ${{ github.ref }} | cut -d'/' -f 3`
27 else
28 export GIT_BRANCH=${{ github.base_ref }}
29 fi
30 echo "::set-output name=branch-name::$GIT_BRANCH"
31
Michal Vasko5f861fe2021-05-26 10:55:04 +020032 build:
33 name: ${{ matrix.config.name }}
Michal Vasko0ddf5f72021-05-28 11:06:34 +020034 runs-on: ${{ matrix.config.os }}
35 needs: git-branch
Michal Vasko5f861fe2021-05-26 10:55:04 +020036 strategy:
37 fail-fast: false
38 matrix:
39 config:
40 - {
41 name: "Release, Ubuntu 18.04, gcc",
42 os: "ubuntu-18.04",
43 build-type: "Release",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020044 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020045 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +020046 options: "-DENABLE_BUILD_TESTS=ON -DENABLE_DNSSEC=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020047 packages: "",
48 snaps: "",
49 make-prepend: "",
50 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020051 }
52 - {
53 name: "Release, Ubuntu 18.04, clang",
54 os: "ubuntu-18.04",
55 build-type: "Release",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020056 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020057 cc: "clang",
Michal Vasko885f60b2021-05-28 11:15:15 +020058 options: "-DENABLE_BUILD_TESTS=ON -DENABLE_DNSSEC=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020059 packages: "",
60 snaps: "",
61 make-prepend: "",
62 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020063 }
64 - {
65 name: "Debug, Ubuntu 18.04, gcc",
66 os: "ubuntu-18.04",
67 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020068 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020069 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +020070 options: "-DENABLE_DNSSEC=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020071 packages: "valgrind",
72 snaps: "",
73 make-prepend: "",
74 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020075 }
76 - {
77 name: "Debug, Ubuntu 18.04, clang",
78 os: "ubuntu-18.04",
79 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020080 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020081 cc: "clang",
Michal Vasko885f60b2021-05-28 11:15:15 +020082 options: "-DENABLE_DNSSEC=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020083 packages: "valgrind",
84 snaps: "",
85 make-prepend: "",
86 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020087 }
88 - {
89 name: "SSH Only",
90 os: "ubuntu-18.04",
91 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020092 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020093 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +020094 options: "-DENABLE_TLS=OFF -DENABLE_SSH=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020095 packages: "valgrind",
96 snaps: "",
97 make-prepend: "",
98 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020099 }
100 - {
101 name: "TLS Only",
102 os: "ubuntu-18.04",
103 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200104 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200105 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +0200106 options: "-DENABLE_TLS=ON -DENABLE_SSH=OFF",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200107 packages: "valgrind",
108 snaps: "",
109 make-prepend: "",
110 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +0200111 }
112 - {
113 name: "No SSH nor TLS",
114 os: "ubuntu-18.04",
115 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200116 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200117 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +0200118 options: "-DENABLE_TLS=OFF -DENABLE_SSH=OFF",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200119 packages: "valgrind",
120 snaps: "",
121 make-prepend: "",
122 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +0200123 }
124 - {
125 name: "ASAN and UBSAN",
126 os: "ubuntu-18.04",
127 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200128 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200129 cc: "clang",
130 options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_VALGRIND_TESTS=OFF",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200131 packages: "",
132 snaps: "",
133 make-prepend: "",
134 make-target: ""
135 }
136 - {
137 name: "ABI Check",
138 os: "ubuntu-latest",
139 build-type: "ABICheck",
140 dep-build-type: "Debug",
141 cc: "gcc",
142 options: "",
143 packages: "abi-dumper abi-compliance-checker",
144 snaps: "core universal-ctags",
145 make-prepend: "",
146 make-target: "abi-check"
147 }
148 - {
149 name: "Coverity",
150 os: "ubuntu-latest",
151 build-type: "Debug",
152 dep-build-type: "Debug",
153 cc: "clang",
Michal Vasko885f60b2021-05-28 11:15:15 +0200154 options: "-DENABLE_DNSSEC=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200155 packages: "",
156 snaps: "",
157 make-prepend: "cov-build --dir cov-int",
158 make-target: ""
159 }
160 - {
161 name: "Codecov",
162 os: "ubuntu-latest",
163 build-type: "Debug",
164 dep-build-type: "Debug",
165 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +0200166 options: "-DENABLE_COVERAGE=ON -DENABLE_DNSSEC=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200167 packages: "lcov",
168 snaps: "",
169 make-prepend: "",
170 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +0200171 }
172
173 steps:
174 - uses: actions/checkout@v2
175
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200176 - name: Deps-packages
177 shell: bash
178 run: |
179 sudo add-apt-repository ppa:kedazo/libssh-0.7.x -y
180 sudo apt-get update
181 sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }}
182 if ${{ matrix.config.snaps != '' }}
183 then sudo snap install ${{ matrix.config.snaps }}
184 fi
185
186 - name: Deps-uncrustify
Michal Vasko5f861fe2021-05-26 10:55:04 +0200187 shell: bash
188 working-directory: ${{ github.workspace }}
189 run: |
190 git clone --branch uncrustify-0.71.0 https://github.com/uncrustify/uncrustify
191 cd uncrustify
192 mkdir build
193 cd build
194 CC=${{ matrix.config.cc }} cmake ..
195 make
196 sudo make install
197 if: ${{ matrix.config.name == 'Debug, Ubuntu 18.04, gcc' }}
198
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200199 - name: Deps-coverity
200 shell: bash
201 working-directory: ${{ github.workspace }}
202 run: |
203 wget -q https://scan.coverity.com/download/linux64 --post-data "token=$TOKEN&project=$COVERITY_PROJECT" -O coverity-tools.tar.gz
204 mkdir coverity-tools
205 tar xzf coverity-tools.tar.gz --strip 1 -C coverity-tools
206 env:
207 TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
208 if: ${{ matrix.config.name == 'Coverity' }}
209
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200210 - name: Deps-libyang
Michal Vasko5f861fe2021-05-26 10:55:04 +0200211 shell: bash
212 run: |
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200213 git clone -b ${{needs.git-branch.outputs.branch-name}} https://github.com/CESNET/libyang.git
Michal Vasko5f861fe2021-05-26 10:55:04 +0200214 cd libyang
215 mkdir build
216 cd build
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200217 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_BUILD_TESTS=OFF ..
Michal Vasko5f861fe2021-05-26 10:55:04 +0200218 make -j2
219 sudo make install
220
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200221 - name: Deps-libval
222 shell: bash
223 run: |
Michal Vasko29721a82021-05-26 12:05:08 +0200224 git clone https://github.com/DNSSEC-Tools/DNSSEC-Tools.git dnssec-tools
225 cd dnssec-tools/dnssec-tools/validator
226 ./configure
227 make -j2
228 sudo make install
229
Michal Vasko5f861fe2021-05-26 10:55:04 +0200230 - name: Configure
231 shell: bash
232 working-directory: ${{ github.workspace }}
233 run: |
234 mkdir build
235 cd build
Michal Vasko885f60b2021-05-28 11:15:15 +0200236 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
Michal Vasko5f861fe2021-05-26 10:55:04 +0200237
238 - name: Build
239 shell: bash
240 working-directory: ${{ github.workspace }}/build
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200241 run: |
242 export LC_ALL=C.UTF-8
243 export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH
244 ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }}
Michal Vasko5f861fe2021-05-26 10:55:04 +0200245
246 - name: Test
247 shell: bash
248 working-directory: ${{ github.workspace }}/build
249 run: ctest --output-on-failure
250
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200251 - name: Upload to Coverity.com
Michal Vaskoe7402142021-05-26 13:45:43 +0200252 shell: bash
253 working-directory: ${{ github.workspace }}/build
Michal Vasko5f861fe2021-05-26 10:55:04 +0200254 run: |
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200255 tar czvf libnetconf2.tgz cov-int
256 curl \
257 --form token=$TOKEN \
258 --form email=mvasko@cesnet.cz \
259 --form file=@libnetconf2.tgz \
260 --form version="`grep Version ./libnetconf2.pc | cut -d' ' -f 2`" \
261 --form description="libnetconf2 NETCONF library" \
262 https://scan.coverity.com/builds?project=$COVERITY_PROJECT
263 env:
264 TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
265 if: ${{ matrix.config.name == 'Coverity' && github.event_name == 'push' && needs.git-branch.outputs.branch-name == 'devel' }}
Michal Vasko5f861fe2021-05-26 10:55:04 +0200266
267 - name: Upload to Codecov.io
268 shell: bash
269 working-directory: ${{ github.workspace }}/build
270 run: bash <(curl -s https://codecov.io/bash)
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200271 if: ${{ matrix.config.name == 'Codecov' && github.event_name == 'push' }}