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: |
Michal Vasko | 29721a8 | 2021-05-26 12:05:08 +0200 | [diff] [blame] | 13 | DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 14 | COVERITY_PROJECT: CESNET%2Flibnetconf2 |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 15 | |
| 16 | jobs: |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 17 | 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 Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 32 | build: |
| 33 | name: ${{ matrix.config.name }} |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 34 | runs-on: ${{ matrix.config.os }} |
| 35 | needs: git-branch |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 36 | 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 Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 44 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 45 | cc: "gcc", |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 46 | options: "-DENABLE_BUILD_TESTS=ON -DENABLE_DNSSEC=ON", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 47 | packages: "", |
| 48 | snaps: "", |
| 49 | make-prepend: "", |
| 50 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 51 | } |
| 52 | - { |
| 53 | name: "Release, Ubuntu 18.04, clang", |
| 54 | os: "ubuntu-18.04", |
| 55 | build-type: "Release", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 56 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 57 | cc: "clang", |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 58 | options: "-DENABLE_BUILD_TESTS=ON -DENABLE_DNSSEC=ON", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 59 | packages: "", |
| 60 | snaps: "", |
| 61 | make-prepend: "", |
| 62 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 63 | } |
| 64 | - { |
| 65 | name: "Debug, Ubuntu 18.04, gcc", |
| 66 | os: "ubuntu-18.04", |
| 67 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 68 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 69 | cc: "gcc", |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 70 | options: "-DENABLE_DNSSEC=ON", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 71 | packages: "valgrind", |
| 72 | snaps: "", |
| 73 | make-prepend: "", |
| 74 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 75 | } |
| 76 | - { |
| 77 | name: "Debug, Ubuntu 18.04, clang", |
| 78 | os: "ubuntu-18.04", |
| 79 | build-type: "Debug", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 80 | dep-build-type: "Release", |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 81 | cc: "clang", |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 82 | options: "-DENABLE_DNSSEC=ON", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 83 | packages: "valgrind", |
| 84 | snaps: "", |
| 85 | make-prepend: "", |
| 86 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 87 | } |
| 88 | - { |
| 89 | name: "SSH Only", |
| 90 | os: "ubuntu-18.04", |
| 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", |
| 102 | os: "ubuntu-18.04", |
| 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", |
| 114 | os: "ubuntu-18.04", |
| 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", |
| 126 | os: "ubuntu-18.04", |
| 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", |
| 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 Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 154 | options: "-DENABLE_DNSSEC=ON", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 155 | 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 Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 166 | options: "-DENABLE_COVERAGE=ON -DENABLE_DNSSEC=ON", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 167 | packages: "lcov", |
| 168 | snaps: "", |
| 169 | make-prepend: "", |
| 170 | make-target: "" |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | steps: |
| 174 | - uses: actions/checkout@v2 |
| 175 | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 176 | - 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 Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 187 | 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 Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 199 | - 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 Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 210 | - name: Deps-libyang |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 211 | shell: bash |
| 212 | run: | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 213 | 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] | 214 | cd libyang |
| 215 | mkdir build |
| 216 | cd build |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 217 | CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_BUILD_TESTS=OFF .. |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 218 | make -j2 |
| 219 | sudo make install |
| 220 | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 221 | - name: Deps-libval |
| 222 | shell: bash |
| 223 | run: | |
Michal Vasko | 29721a8 | 2021-05-26 12:05:08 +0200 | [diff] [blame] | 224 | 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 Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 230 | - name: Configure |
| 231 | shell: bash |
| 232 | working-directory: ${{ github.workspace }} |
| 233 | run: | |
| 234 | mkdir build |
| 235 | cd build |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 236 | 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] | 237 | |
| 238 | - name: Build |
| 239 | shell: bash |
| 240 | working-directory: ${{ github.workspace }}/build |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 241 | 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 Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 245 | |
| 246 | - name: Test |
| 247 | shell: bash |
| 248 | working-directory: ${{ github.workspace }}/build |
| 249 | run: ctest --output-on-failure |
| 250 | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 251 | - name: Upload to Coverity.com |
Michal Vasko | e740214 | 2021-05-26 13:45:43 +0200 | [diff] [blame] | 252 | shell: bash |
| 253 | working-directory: ${{ github.workspace }}/build |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 254 | run: | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 255 | 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 Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 266 | |
| 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 Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 271 | if: ${{ matrix.config.name == 'Codecov' && github.event_name == 'push' }} |