blob: 26699ef9b9aa77f26a3b0a34e5ee1c208f3feb71 [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:
roman41a11e42022-06-22 09:27:08 +020013 DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev libpam0g-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
18 runs-on: ubuntu-18.04
19 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
29 echo "::set-output name=branch-name::$GIT_BRANCH"
30
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 - {
40 name: "Release, Ubuntu 18.04, gcc",
41 os: "ubuntu-18.04",
42 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",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020046 packages: "",
47 snaps: "",
48 make-prepend: "",
49 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020050 }
51 - {
52 name: "Release, Ubuntu 18.04, clang",
53 os: "ubuntu-18.04",
54 build-type: "Release",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020055 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020056 cc: "clang",
Michal Vasko2cd71632021-06-04 12:03:12 +020057 options: "-DENABLE_TESTS=ON -DENABLE_DNSSEC=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020058 packages: "",
59 snaps: "",
60 make-prepend: "",
61 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020062 }
63 - {
64 name: "Debug, Ubuntu 18.04, gcc",
65 os: "ubuntu-18.04",
66 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020067 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020068 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +020069 options: "-DENABLE_DNSSEC=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020070 packages: "valgrind",
71 snaps: "",
72 make-prepend: "",
73 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020074 }
75 - {
76 name: "Debug, Ubuntu 18.04, clang",
77 os: "ubuntu-18.04",
78 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020079 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020080 cc: "clang",
Michal Vasko885f60b2021-05-28 11:15:15 +020081 options: "-DENABLE_DNSSEC=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020082 packages: "valgrind",
83 snaps: "",
84 make-prepend: "",
85 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020086 }
87 - {
roman6a8947b2022-07-21 11:31:44 +020088 name: "SSH Only, Ubuntu 22.04",
89 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +020090 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020091 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020092 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +020093 options: "-DENABLE_TLS=OFF -DENABLE_SSH=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020094 packages: "valgrind",
95 snaps: "",
96 make-prepend: "",
97 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020098 }
99 - {
100 name: "TLS Only",
101 os: "ubuntu-18.04",
102 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200103 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200104 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +0200105 options: "-DENABLE_TLS=ON -DENABLE_SSH=OFF",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200106 packages: "valgrind",
107 snaps: "",
108 make-prepend: "",
109 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +0200110 }
111 - {
112 name: "No SSH nor TLS",
113 os: "ubuntu-18.04",
114 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200115 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200116 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +0200117 options: "-DENABLE_TLS=OFF -DENABLE_SSH=OFF",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200118 packages: "valgrind",
119 snaps: "",
120 make-prepend: "",
121 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +0200122 }
123 - {
124 name: "ASAN and UBSAN",
125 os: "ubuntu-18.04",
126 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200127 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200128 cc: "clang",
129 options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_VALGRIND_TESTS=OFF",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200130 packages: "",
131 snaps: "",
132 make-prepend: "",
133 make-target: ""
134 }
135 - {
136 name: "ABI Check",
roman6a8947b2022-07-21 11:31:44 +0200137 os: "ubuntu-18.04",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200138 build-type: "ABICheck",
139 dep-build-type: "Debug",
140 cc: "gcc",
141 options: "",
Michal Vaskoe53d2602021-07-26 10:19:30 +0200142 packages: "abi-dumper abi-compliance-checker snap",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200143 snaps: "core universal-ctags",
144 make-prepend: "",
145 make-target: "abi-check"
146 }
Michal Vasko5f861fe2021-05-26 10:55:04 +0200147
148 steps:
149 - uses: actions/checkout@v2
150
roman6a8947b2022-07-21 11:31:44 +0200151 - name: libssh 0.7 repo
152 if: matrix.config.os == 'ubuntu-18.04' || matrix.config.os == 'ubuntu-20.04'
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200153 shell: bash
154 run: |
155 sudo add-apt-repository ppa:kedazo/libssh-0.7.x -y
roman6a8947b2022-07-21 11:31:44 +0200156
157 - name: Deps-packages
158 shell: bash
159 run: |
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200160 sudo apt-get update
161 sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }}
162 if ${{ matrix.config.snaps != '' }}
Michal Vaskoe53d2602021-07-26 10:19:30 +0200163 then sudo snap refresh; sudo snap install ${{ matrix.config.snaps }}
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200164 fi
165
166 - name: Deps-uncrustify
Michal Vasko5f861fe2021-05-26 10:55:04 +0200167 shell: bash
168 working-directory: ${{ github.workspace }}
169 run: |
Michal Vasko6ce8e822022-08-02 15:09:17 +0200170 git clone --branch uncrustify-0.75.1 https://github.com/uncrustify/uncrustify
Michal Vasko5f861fe2021-05-26 10:55:04 +0200171 cd uncrustify
172 mkdir build
173 cd build
174 CC=${{ matrix.config.cc }} cmake ..
175 make
176 sudo make install
177 if: ${{ matrix.config.name == 'Debug, Ubuntu 18.04, gcc' }}
178
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200179 - name: Deps-libyang
Michal Vasko5f861fe2021-05-26 10:55:04 +0200180 shell: bash
181 run: |
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200182 git clone -b ${{needs.git-branch.outputs.branch-name}} https://github.com/CESNET/libyang.git
Michal Vasko5f861fe2021-05-26 10:55:04 +0200183 cd libyang
184 mkdir build
185 cd build
Michal Vaskoe2298282021-11-12 15:36:24 +0100186 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_TESTS=OFF ..
Michal Vasko5f861fe2021-05-26 10:55:04 +0200187 make -j2
188 sudo make install
189
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200190 - name: Deps-libval
191 shell: bash
192 run: |
Michal Vasko29721a82021-05-26 12:05:08 +0200193 git clone https://github.com/DNSSEC-Tools/DNSSEC-Tools.git dnssec-tools
194 cd dnssec-tools/dnssec-tools/validator
195 ./configure
196 make -j2
197 sudo make install
198
Michal Vasko5f861fe2021-05-26 10:55:04 +0200199 - name: Configure
200 shell: bash
201 working-directory: ${{ github.workspace }}
202 run: |
203 mkdir build
204 cd build
Michal Vasko885f60b2021-05-28 11:15:15 +0200205 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
Michal Vasko5f861fe2021-05-26 10:55:04 +0200206
207 - name: Build
208 shell: bash
209 working-directory: ${{ github.workspace }}/build
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200210 run: |
211 export LC_ALL=C.UTF-8
212 export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH
213 ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }}
Michal Vasko5f861fe2021-05-26 10:55:04 +0200214
215 - name: Test
216 shell: bash
217 working-directory: ${{ github.workspace }}/build
roman6a8947b2022-07-21 11:31:44 +0200218 run: |
219 export LSAN_OPTIONS=suppressions=${{ github.workspace }}/tests/library_lsan.supp
220 ctest --output-on-failure