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 | - { |
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 | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 89 | name: "No SSH nor TLS", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [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", |
roman | d72bc32 | 2023-10-26 15:46:01 +0200 | [diff] [blame^] | 94 | options: "-DENABLE_SSH_TLS=OFF, |
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: "ASAN and UBSAN", |
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: "clang", |
| 106 | options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_VALGRIND_TESTS=OFF", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 107 | packages: "", |
| 108 | snaps: "", |
| 109 | make-prepend: "", |
| 110 | make-target: "" |
| 111 | } |
| 112 | - { |
| 113 | name: "ABI Check", |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 114 | os: "ubuntu-22.04", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 115 | build-type: "ABICheck", |
| 116 | dep-build-type: "Debug", |
| 117 | cc: "gcc", |
| 118 | options: "", |
Michal Vasko | e53d260 | 2021-07-26 10:19:30 +0200 | [diff] [blame] | 119 | packages: "abi-dumper abi-compliance-checker snap", |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 120 | snaps: "core universal-ctags", |
| 121 | make-prepend: "", |
| 122 | make-target: "abi-check" |
| 123 | } |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 124 | |
| 125 | steps: |
Michal Vasko | f931c49 | 2022-11-09 10:55:26 +0100 | [diff] [blame] | 126 | - uses: actions/checkout@v3 |
roman | 6a8947b | 2022-07-21 11:31:44 +0200 | [diff] [blame] | 127 | |
| 128 | - name: Deps-packages |
| 129 | shell: bash |
| 130 | run: | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 131 | sudo apt-get update |
| 132 | sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }} |
| 133 | if ${{ matrix.config.snaps != '' }} |
Michal Vasko | e53d260 | 2021-07-26 10:19:30 +0200 | [diff] [blame] | 134 | then sudo snap refresh; sudo snap install ${{ matrix.config.snaps }} |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 135 | fi |
| 136 | |
| 137 | - name: Deps-uncrustify |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 138 | shell: bash |
| 139 | working-directory: ${{ github.workspace }} |
| 140 | run: | |
Michal Vasko | ac1786b | 2023-05-19 11:28:31 +0200 | [diff] [blame] | 141 | git clone --branch uncrustify-0.77.1 https://github.com/uncrustify/uncrustify |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 142 | cd uncrustify |
| 143 | mkdir build |
| 144 | cd build |
| 145 | CC=${{ matrix.config.cc }} cmake .. |
| 146 | make |
| 147 | sudo make install |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 148 | if: ${{ matrix.config.name == 'Debug, gcc' }} |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 149 | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 150 | - name: Deps-libyang |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 151 | shell: bash |
| 152 | run: | |
Michal Vasko | 1d69b0d | 2022-11-09 11:06:12 +0100 | [diff] [blame] | 153 | 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] | 154 | cd libyang |
| 155 | mkdir build |
| 156 | cd build |
Michal Vasko | e229828 | 2021-11-12 15:36:24 +0100 | [diff] [blame] | 157 | 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] | 158 | make -j2 |
| 159 | sudo make install |
| 160 | |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 161 | - name: Deps-libval |
| 162 | shell: bash |
| 163 | run: | |
Michal Vasko | 29721a8 | 2021-05-26 12:05:08 +0200 | [diff] [blame] | 164 | git clone https://github.com/DNSSEC-Tools/DNSSEC-Tools.git dnssec-tools |
| 165 | cd dnssec-tools/dnssec-tools/validator |
| 166 | ./configure |
| 167 | make -j2 |
| 168 | sudo make install |
| 169 | |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 170 | - name: Configure |
| 171 | shell: bash |
| 172 | working-directory: ${{ github.workspace }} |
| 173 | run: | |
| 174 | mkdir build |
| 175 | cd build |
Michal Vasko | 885f60b | 2021-05-28 11:15:15 +0200 | [diff] [blame] | 176 | 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] | 177 | |
| 178 | - name: Build |
| 179 | shell: bash |
| 180 | working-directory: ${{ github.workspace }}/build |
Michal Vasko | 0ddf5f7 | 2021-05-28 11:06:34 +0200 | [diff] [blame] | 181 | run: | |
| 182 | export LC_ALL=C.UTF-8 |
| 183 | export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH |
| 184 | ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }} |
Michal Vasko | 5f861fe | 2021-05-26 10:55:04 +0200 | [diff] [blame] | 185 | |
| 186 | - name: Test |
| 187 | shell: bash |
| 188 | working-directory: ${{ github.workspace }}/build |
roman | 6a8947b | 2022-07-21 11:31:44 +0200 | [diff] [blame] | 189 | run: | |
| 190 | export LSAN_OPTIONS=suppressions=${{ github.workspace }}/tests/library_lsan.supp |
| 191 | ctest --output-on-failure |