blob: adac04ddc9fa7dba895df0cf9573a7163e345447 [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:
romand72bc322023-10-26 15:46:01 +020013 DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev libpam0g-dev libcurl4-openssl-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 Vasko5f861fe2021-05-26 10:55:04 +020089 name: "No SSH nor TLS",
Michal Vaskof931c492022-11-09 10:55:26 +010090 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",
romand72bc322023-10-26 15:46:01 +020094 options: "-DENABLE_SSH_TLS=OFF,
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: "ASAN and UBSAN",
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: "clang",
106 options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_VALGRIND_TESTS=OFF",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200107 packages: "",
108 snaps: "",
109 make-prepend: "",
110 make-target: ""
111 }
112 - {
113 name: "ABI Check",
Michal Vaskof931c492022-11-09 10:55:26 +0100114 os: "ubuntu-22.04",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200115 build-type: "ABICheck",
116 dep-build-type: "Debug",
117 cc: "gcc",
118 options: "",
Michal Vaskoe53d2602021-07-26 10:19:30 +0200119 packages: "abi-dumper abi-compliance-checker snap",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200120 snaps: "core universal-ctags",
121 make-prepend: "",
122 make-target: "abi-check"
123 }
Michal Vasko5f861fe2021-05-26 10:55:04 +0200124
125 steps:
Michal Vaskof931c492022-11-09 10:55:26 +0100126 - uses: actions/checkout@v3
roman6a8947b2022-07-21 11:31:44 +0200127
128 - name: Deps-packages
129 shell: bash
130 run: |
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200131 sudo apt-get update
132 sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }}
133 if ${{ matrix.config.snaps != '' }}
Michal Vaskoe53d2602021-07-26 10:19:30 +0200134 then sudo snap refresh; sudo snap install ${{ matrix.config.snaps }}
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200135 fi
136
137 - name: Deps-uncrustify
Michal Vasko5f861fe2021-05-26 10:55:04 +0200138 shell: bash
139 working-directory: ${{ github.workspace }}
140 run: |
Michal Vaskoac1786b2023-05-19 11:28:31 +0200141 git clone --branch uncrustify-0.77.1 https://github.com/uncrustify/uncrustify
Michal Vasko5f861fe2021-05-26 10:55:04 +0200142 cd uncrustify
143 mkdir build
144 cd build
145 CC=${{ matrix.config.cc }} cmake ..
146 make
147 sudo make install
Michal Vasko1d69b0d2022-11-09 11:06:12 +0100148 if: ${{ matrix.config.name == 'Debug, gcc' }}
Michal Vasko5f861fe2021-05-26 10:55:04 +0200149
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200150 - name: Deps-libyang
Michal Vasko5f861fe2021-05-26 10:55:04 +0200151 shell: bash
152 run: |
Michal Vasko1d69b0d2022-11-09 11:06:12 +0100153 git clone -b ${{ needs.git-branch.outputs.branch-name }} https://github.com/CESNET/libyang.git
Michal Vasko5f861fe2021-05-26 10:55:04 +0200154 cd libyang
155 mkdir build
156 cd build
Michal Vaskoe2298282021-11-12 15:36:24 +0100157 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_TESTS=OFF ..
Michal Vasko5f861fe2021-05-26 10:55:04 +0200158 make -j2
159 sudo make install
160
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200161 - name: Deps-libval
162 shell: bash
163 run: |
Michal Vasko29721a82021-05-26 12:05:08 +0200164 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 Vasko5f861fe2021-05-26 10:55:04 +0200170 - name: Configure
171 shell: bash
172 working-directory: ${{ github.workspace }}
173 run: |
174 mkdir build
175 cd build
Michal Vasko885f60b2021-05-28 11:15:15 +0200176 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
Michal Vasko5f861fe2021-05-26 10:55:04 +0200177
178 - name: Build
179 shell: bash
180 working-directory: ${{ github.workspace }}/build
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200181 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 Vasko5f861fe2021-05-26 10:55:04 +0200185
186 - name: Test
187 shell: bash
188 working-directory: ${{ github.workspace }}/build
roman6a8947b2022-07-21 11:31:44 +0200189 run: |
190 export LSAN_OPTIONS=suppressions=${{ github.workspace }}/tests/library_lsan.supp
191 ctest --output-on-failure