Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 1 | name: libnetconf2 CI |
| 2 | on: |
| 3 | push: |
| 4 | branches: |
Michal Vasko | 7678c5d | 2021-05-27 10:32:13 +0200 | [diff] [blame] | 5 | - master |
| 6 | - devel |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 7 | pull_request: |
| 8 | branches: |
Michal Vasko | 7678c5d | 2021-05-27 10:32:13 +0200 | [diff] [blame] | 9 | - master |
| 10 | - devel |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 11 | |
| 12 | env: |
roman | d72bc32 | 2023-10-26 15:46:01 +0200 | [diff] [blame] | 13 | DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev libpam0g-dev libcurl4-openssl-dev |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 14 | |
| 15 | jobs: |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 16 | git-branch: |
| 17 | name: Get git branch |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 18 | runs-on: ubuntu-latest |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 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 |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 29 | echo "branch-name=$GIT_BRANCH" >> $GITHUB_OUTPUT |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 30 | |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 31 | build: |
| 32 | name: ${{ matrix.config.name }} |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 33 | runs-on: ${{ matrix.config.os }} |
| 34 | needs: git-branch |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 35 | strategy: |
| 36 | fail-fast: false |
| 37 | matrix: |
| 38 | config: |
| 39 | - { |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 40 | name: "Release, gcc, OpenSSL", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 41 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 42 | build-type: "Release", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 43 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 44 | cc: "gcc", |
Michal Vasko | 2cd7163 | 2021-06-04 12:03:12 +0200 | [diff] [blame] | 45 | options: "-DENABLE_TESTS=ON -DENABLE_DNSSEC=ON", |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 46 | 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 Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 60 | packages: "", |
| 61 | snaps: "", |
| 62 | make-prepend: "", |
| 63 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 64 | } |
| 65 | - { |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 66 | name: "Release, clang", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 67 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 68 | build-type: "Release", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 69 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 70 | cc: "clang", |
Michal Vasko | 2cd7163 | 2021-06-04 12:03:12 +0200 | [diff] [blame] | 71 | options: "-DENABLE_TESTS=ON -DENABLE_DNSSEC=ON", |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 72 | tls-lib: "OpenSSL", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 73 | packages: "", |
| 74 | snaps: "", |
| 75 | make-prepend: "", |
| 76 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 77 | } |
| 78 | - { |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 79 | name: "Debug, gcc, OpenSSL", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 80 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 81 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 82 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 83 | cc: "gcc", |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 84 | options: "-DENABLE_DNSSEC=ON", |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 85 | 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 Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 99 | packages: "valgrind", |
| 100 | snaps: "", |
| 101 | make-prepend: "", |
| 102 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 103 | } |
| 104 | - { |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 105 | name: "Debug, clang", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 106 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 107 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 108 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 109 | cc: "clang", |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 110 | options: "-DENABLE_DNSSEC=ON", |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 111 | tls-lib: "OpenSSL", |
Michal Vasko | 5f5edc1 | 2022-11-09 11:27:08 +0100 | [diff] [blame] | 112 | # no valgrind because it does not support DWARF5 yet generated by clang 14 |
| 113 | packages: "", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 114 | snaps: "", |
| 115 | make-prepend: "", |
| 116 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 117 | } |
| 118 | - { |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 119 | name: "No SSH nor TLS", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 120 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 121 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 122 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 123 | cc: "gcc", |
roman | 3e72ab6 | 2023-10-26 16:11:12 +0200 | [diff] [blame] | 124 | options: "-DENABLE_SSH_TLS=OFF", |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 125 | tls-lib: "", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 126 | packages: "valgrind", |
| 127 | snaps: "", |
| 128 | make-prepend: "", |
| 129 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 130 | } |
| 131 | - { |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 132 | name: "ASAN and UBSAN, OpenSSL", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 133 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 134 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 135 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 136 | cc: "clang", |
| 137 | options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_VALGRIND_TESTS=OFF", |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 138 | 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 Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 152 | packages: "", |
| 153 | snaps: "", |
| 154 | make-prepend: "", |
| 155 | make-target: "" |
| 156 | } |
| 157 | - { |
| 158 | name: "ABI Check", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 159 | os: "ubuntu-22.04", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 160 | build-type: "ABICheck", |
| 161 | dep-build-type: "Debug", |
| 162 | cc: "gcc", |
| 163 | options: "", |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 164 | tls-lib: "OpenSSL", |
Michal Vasko | e53d260 | 2021-07-26 10:19:30 +0200 | [diff] [blame] | 165 | packages: "abi-dumper abi-compliance-checker snap", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 166 | snaps: "core universal-ctags", |
| 167 | make-prepend: "", |
| 168 | make-target: "abi-check" |
| 169 | } |
Michal Vasko | 1d8a20b | 2024-08-01 13:42:00 +0200 | [diff] [blame^] | 170 | - { |
| 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 Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 183 | |
| 184 | steps: |
Michal Vasko | fd20a50 | 2024-07-04 09:14:34 +0200 | [diff] [blame] | 185 | - uses: actions/checkout@main |
Michal Vasko | 1d8a20b | 2024-08-01 13:42:00 +0200 | [diff] [blame^] | 186 | with: |
| 187 | fetch-depth: 100 |
roman | 6a8947b | 2022-07-21 11:31:44 +0200 | [diff] [blame] | 188 | |
| 189 | - name: Deps-packages |
| 190 | shell: bash |
| 191 | run: | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 192 | sudo apt-get update |
| 193 | sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }} |
| 194 | if ${{ matrix.config.snaps != '' }} |
Michal Vasko | e53d260 | 2021-07-26 10:19:30 +0200 | [diff] [blame] | 195 | then sudo snap refresh; sudo snap install ${{ matrix.config.snaps }} |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 196 | fi |
Michal Vasko | 1d8a20b | 2024-08-01 13:42:00 +0200 | [diff] [blame^] | 197 | if ${{ matrix.config.name == 'DEB Package' }}; then |
| 198 | pip install apkg |
| 199 | apkg system-setup |
| 200 | fi |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 201 | |
| 202 | - name: Deps-uncrustify |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 203 | shell: bash |
| 204 | working-directory: ${{ github.workspace }} |
| 205 | run: | |
Michal Vasko | ac1786b | 2023-05-19 11:28:31 +0200 | [diff] [blame] | 206 | git clone --branch uncrustify-0.77.1 https://github.com/uncrustify/uncrustify |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 207 | cd uncrustify |
| 208 | mkdir build |
| 209 | cd build |
| 210 | CC=${{ matrix.config.cc }} cmake .. |
| 211 | make |
| 212 | sudo make install |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 213 | if: ${{ matrix.config.name == 'Debug, gcc, OpenSSL' || matrix.config.name == 'Debug, gcc, MbedTLS' }} |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 214 | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 215 | - name: Deps-libyang |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 216 | shell: bash |
| 217 | run: | |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 218 | git clone -b ${{ needs.git-branch.outputs.branch-name }} https://github.com/CESNET/libyang.git |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 219 | cd libyang |
Michal Vasko | 1d8a20b | 2024-08-01 13:42:00 +0200 | [diff] [blame^] | 220 | 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 Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 238 | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 239 | - name: Deps-libval |
| 240 | shell: bash |
| 241 | run: | |
Michal Vasko | 29721a8 | 2021-05-26 12:05:08 +0200 | [diff] [blame] | 242 | 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 Vasko | 1d8a20b | 2024-08-01 13:42:00 +0200 | [diff] [blame^] | 247 | if: ${{ matrix.config.name != 'DEB Package' }} |
Michal Vasko | 29721a8 | 2021-05-26 12:05:08 +0200 | [diff] [blame] | 248 | |
roman | b16f349 | 2024-05-13 14:22:17 +0200 | [diff] [blame] | 249 | - 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 Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 261 | - name: Configure |
| 262 | shell: bash |
| 263 | working-directory: ${{ github.workspace }} |
| 264 | run: | |
| 265 | mkdir build |
| 266 | cd build |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 267 | CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} .. |
Michal Vasko | 1d8a20b | 2024-08-01 13:42:00 +0200 | [diff] [blame^] | 268 | if: ${{ matrix.config.name != 'DEB Package' }} |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 269 | |
| 270 | - name: Build |
| 271 | shell: bash |
| 272 | working-directory: ${{ github.workspace }}/build |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 273 | 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 Vasko | 1d8a20b | 2024-08-01 13:42:00 +0200 | [diff] [blame^] | 277 | if: ${{ matrix.config.name != 'DEB Package' }} |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 278 | |
| 279 | - name: Test |
| 280 | shell: bash |
| 281 | working-directory: ${{ github.workspace }}/build |
roman | 6a8947b | 2022-07-21 11:31:44 +0200 | [diff] [blame] | 282 | run: | |
| 283 | export LSAN_OPTIONS=suppressions=${{ github.workspace }}/tests/library_lsan.supp |
Jan Kundrát | 957d8ec | 2024-04-08 12:16:25 +0200 | [diff] [blame] | 284 | ctest -j4 --output-on-failure |
Michal Vasko | 1d8a20b | 2024-08-01 13:42:00 +0200 | [diff] [blame^] | 285 | if: ${{ matrix.config.name != 'DEB Package' }} |