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 | 41a11e4 | 2022-06-22 09:27:08 +0200 | [diff] [blame] | 13 | DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev libpam0g-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 | - { |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 40 | name: "Release, gcc", |
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", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 46 | packages: "", |
| 47 | snaps: "", |
| 48 | make-prepend: "", |
| 49 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 50 | } |
| 51 | - { |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 52 | name: "Release, clang", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 53 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 54 | build-type: "Release", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 55 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 56 | cc: "clang", |
Michal Vasko | 2cd7163 | 2021-06-04 12:03:12 +0200 | [diff] [blame] | 57 | options: "-DENABLE_TESTS=ON -DENABLE_DNSSEC=ON", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 58 | packages: "", |
| 59 | snaps: "", |
| 60 | make-prepend: "", |
| 61 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 62 | } |
| 63 | - { |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 64 | name: "Debug, gcc", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 65 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 66 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 67 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 68 | cc: "gcc", |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 69 | options: "-DENABLE_DNSSEC=ON", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 70 | packages: "valgrind", |
| 71 | snaps: "", |
| 72 | make-prepend: "", |
| 73 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 74 | } |
| 75 | - { |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 76 | name: "Debug, clang", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 77 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 78 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 79 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 80 | cc: "clang", |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 81 | options: "-DENABLE_DNSSEC=ON", |
Michal Vasko | 5f5edc1 | 2022-11-09 11:27:08 +0100 | [diff] [blame] | 82 | # no valgrind because it does not support DWARF5 yet generated by clang 14 |
| 83 | packages: "", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 84 | snaps: "", |
| 85 | make-prepend: "", |
| 86 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 87 | } |
| 88 | - { |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 89 | name: "SSH Only", |
roman | 6a8947b | 2022-07-21 11:31:44 +0200 | [diff] [blame] | 90 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 91 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 92 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 93 | cc: "gcc", |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 94 | options: "-DENABLE_TLS=OFF -DENABLE_SSH=ON", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 95 | packages: "valgrind", |
| 96 | snaps: "", |
| 97 | make-prepend: "", |
| 98 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 99 | } |
| 100 | - { |
| 101 | name: "TLS Only", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 102 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 103 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 104 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 105 | cc: "gcc", |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 106 | options: "-DENABLE_TLS=ON -DENABLE_SSH=OFF", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 107 | packages: "valgrind", |
| 108 | snaps: "", |
| 109 | make-prepend: "", |
| 110 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 111 | } |
| 112 | - { |
| 113 | name: "No SSH nor TLS", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 114 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 115 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 116 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 117 | cc: "gcc", |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 118 | options: "-DENABLE_TLS=OFF -DENABLE_SSH=OFF", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 119 | packages: "valgrind", |
| 120 | snaps: "", |
| 121 | make-prepend: "", |
| 122 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 123 | } |
| 124 | - { |
| 125 | name: "ASAN and UBSAN", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 126 | os: "ubuntu-22.04", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 127 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 128 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 129 | cc: "clang", |
| 130 | options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_VALGRIND_TESTS=OFF", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 131 | packages: "", |
| 132 | snaps: "", |
| 133 | make-prepend: "", |
| 134 | make-target: "" |
| 135 | } |
| 136 | - { |
| 137 | name: "ABI Check", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 138 | os: "ubuntu-22.04", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 139 | build-type: "ABICheck", |
| 140 | dep-build-type: "Debug", |
| 141 | cc: "gcc", |
| 142 | options: "", |
Michal Vasko | e53d260 | 2021-07-26 10:19:30 +0200 | [diff] [blame] | 143 | packages: "abi-dumper abi-compliance-checker snap", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 144 | snaps: "core universal-ctags", |
| 145 | make-prepend: "", |
| 146 | make-target: "abi-check" |
| 147 | } |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 148 | |
| 149 | steps: |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 150 | - uses: actions/checkout@v3 |
roman | 6a8947b | 2022-07-21 11:31:44 +0200 | [diff] [blame] | 151 | |
| 152 | - name: Deps-packages |
| 153 | shell: bash |
| 154 | run: | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 155 | sudo apt-get update |
| 156 | sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }} |
| 157 | if ${{ matrix.config.snaps != '' }} |
Michal Vasko | e53d260 | 2021-07-26 10:19:30 +0200 | [diff] [blame] | 158 | then sudo snap refresh; sudo snap install ${{ matrix.config.snaps }} |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 159 | fi |
| 160 | |
| 161 | - name: Deps-uncrustify |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 162 | shell: bash |
| 163 | working-directory: ${{ github.workspace }} |
| 164 | run: | |
Michal Vasko | 6ce8e82 | 2022-08-02 15:09:17 +0200 | [diff] [blame] | 165 | git clone --branch uncrustify-0.75.1 https://github.com/uncrustify/uncrustify |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 166 | cd uncrustify |
| 167 | mkdir build |
| 168 | cd build |
| 169 | CC=${{ matrix.config.cc }} cmake .. |
| 170 | make |
| 171 | sudo make install |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 172 | if: ${{ matrix.config.name == 'Debug, gcc' }} |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 173 | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 174 | - name: Deps-libyang |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 175 | shell: bash |
| 176 | run: | |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 177 | 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] | 178 | cd libyang |
| 179 | mkdir build |
| 180 | cd build |
Michal Vasko | e229828 | 2021-11-12 15:36:24 +0100 | [diff] [blame] | 181 | CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_TESTS=OFF .. |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 182 | make -j2 |
| 183 | sudo make install |
| 184 | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 185 | - name: Deps-libval |
| 186 | shell: bash |
| 187 | run: | |
Michal Vasko | 29721a8 | 2021-05-26 12:05:08 +0200 | [diff] [blame] | 188 | 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 Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 194 | - name: Configure |
| 195 | shell: bash |
| 196 | working-directory: ${{ github.workspace }} |
| 197 | run: | |
| 198 | mkdir build |
| 199 | cd build |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 200 | CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} .. |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 201 | |
| 202 | - name: Build |
| 203 | shell: bash |
| 204 | working-directory: ${{ github.workspace }}/build |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 205 | 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 Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 209 | |
| 210 | - name: Test |
| 211 | shell: bash |
| 212 | working-directory: ${{ github.workspace }}/build |
roman | 6a8947b | 2022-07-21 11:31:44 +0200 | [diff] [blame] | 213 | run: | |
| 214 | export LSAN_OPTIONS=suppressions=${{ github.workspace }}/tests/library_lsan.supp |
| 215 | ctest --output-on-failure |