blob: 77ec83e8684a423dff6eb7ed9ec0dade25183944 [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
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 - {
Michal Vasko1d69b0d2022-11-09 11:06:12 +010040 name: "Release, gcc",
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",
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 - {
Michal Vasko1d69b0d2022-11-09 11:06:12 +010052 name: "Release, clang",
Michal Vaskof931c492022-11-09 10:55:26 +010053 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +020054 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 - {
Michal Vasko1d69b0d2022-11-09 11:06:12 +010064 name: "Debug, gcc",
Michal Vaskof931c492022-11-09 10:55:26 +010065 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +020066 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 - {
Michal Vasko1d69b0d2022-11-09 11:06:12 +010076 name: "Debug, clang",
Michal Vaskof931c492022-11-09 10:55:26 +010077 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +020078 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 Vasko5f5edc12022-11-09 11:27:08 +010082 # no valgrind because it does not support DWARF5 yet generated by clang 14
83 packages: "",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020084 snaps: "",
85 make-prepend: "",
86 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020087 }
88 - {
Michal Vaskof931c492022-11-09 10:55:26 +010089 name: "SSH Only",
roman6a8947b2022-07-21 11:31:44 +020090 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +020091 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",
Michal Vaskof931c492022-11-09 10:55:26 +0100102 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200103 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",
Michal Vaskof931c492022-11-09 10:55:26 +0100114 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200115 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",
Michal Vaskof931c492022-11-09 10:55:26 +0100126 os: "ubuntu-22.04",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200127 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",
Michal Vaskof931c492022-11-09 10:55:26 +0100138 os: "ubuntu-22.04",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200139 build-type: "ABICheck",
140 dep-build-type: "Debug",
141 cc: "gcc",
142 options: "",
Michal Vaskoe53d2602021-07-26 10:19:30 +0200143 packages: "abi-dumper abi-compliance-checker snap",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200144 snaps: "core universal-ctags",
145 make-prepend: "",
146 make-target: "abi-check"
147 }
Michal Vasko5f861fe2021-05-26 10:55:04 +0200148
149 steps:
Michal Vaskof931c492022-11-09 10:55:26 +0100150 - uses: actions/checkout@v3
roman6a8947b2022-07-21 11:31:44 +0200151
152 - name: Deps-packages
153 shell: bash
154 run: |
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200155 sudo apt-get update
156 sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }}
157 if ${{ matrix.config.snaps != '' }}
Michal Vaskoe53d2602021-07-26 10:19:30 +0200158 then sudo snap refresh; sudo snap install ${{ matrix.config.snaps }}
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200159 fi
160
161 - name: Deps-uncrustify
Michal Vasko5f861fe2021-05-26 10:55:04 +0200162 shell: bash
163 working-directory: ${{ github.workspace }}
164 run: |
Michal Vaskoac1786b2023-05-19 11:28:31 +0200165 git clone --branch uncrustify-0.77.1 https://github.com/uncrustify/uncrustify
Michal Vasko5f861fe2021-05-26 10:55:04 +0200166 cd uncrustify
167 mkdir build
168 cd build
169 CC=${{ matrix.config.cc }} cmake ..
170 make
171 sudo make install
Michal Vasko1d69b0d2022-11-09 11:06:12 +0100172 if: ${{ matrix.config.name == 'Debug, gcc' }}
Michal Vasko5f861fe2021-05-26 10:55:04 +0200173
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200174 - name: Deps-libyang
Michal Vasko5f861fe2021-05-26 10:55:04 +0200175 shell: bash
176 run: |
Michal Vasko1d69b0d2022-11-09 11:06:12 +0100177 git clone -b ${{ needs.git-branch.outputs.branch-name }} https://github.com/CESNET/libyang.git
Michal Vasko5f861fe2021-05-26 10:55:04 +0200178 cd libyang
179 mkdir build
180 cd build
Michal Vaskoe2298282021-11-12 15:36:24 +0100181 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_TESTS=OFF ..
Michal Vasko5f861fe2021-05-26 10:55:04 +0200182 make -j2
183 sudo make install
184
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200185 - name: Deps-libval
186 shell: bash
187 run: |
Michal Vasko29721a82021-05-26 12:05:08 +0200188 git clone https://github.com/DNSSEC-Tools/DNSSEC-Tools.git dnssec-tools
189 cd dnssec-tools/dnssec-tools/validator
190 ./configure
191 make -j2
192 sudo make install
193
Michal Vasko5f861fe2021-05-26 10:55:04 +0200194 - name: Configure
195 shell: bash
196 working-directory: ${{ github.workspace }}
197 run: |
198 mkdir build
199 cd build
Michal Vasko885f60b2021-05-28 11:15:15 +0200200 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
Michal Vasko5f861fe2021-05-26 10:55:04 +0200201
202 - name: Build
203 shell: bash
204 working-directory: ${{ github.workspace }}/build
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200205 run: |
206 export LC_ALL=C.UTF-8
207 export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH
208 ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }}
Michal Vasko5f861fe2021-05-26 10:55:04 +0200209
210 - name: Test
211 shell: bash
212 working-directory: ${{ github.workspace }}/build
roman6a8947b2022-07-21 11:31:44 +0200213 run: |
214 export LSAN_OPTIONS=suppressions=${{ github.workspace }}/tests/library_lsan.supp
215 ctest --output-on-failure