blob: 68c5e29f118819a5ceb1ff5c055919b6f1d4a493 [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:
Michal Vasko29721a82021-05-26 12:05:08 +020013 DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-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
18 runs-on: ubuntu-18.04
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
29 echo "::set-output name=branch-name::$GIT_BRANCH"
30
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 - {
40 name: "Release, Ubuntu 18.04, gcc",
41 os: "ubuntu-18.04",
42 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 - {
52 name: "Release, Ubuntu 18.04, clang",
53 os: "ubuntu-18.04",
54 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 - {
64 name: "Debug, Ubuntu 18.04, gcc",
65 os: "ubuntu-18.04",
66 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 - {
76 name: "Debug, Ubuntu 18.04, clang",
77 os: "ubuntu-18.04",
78 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 Vasko0ddf5f72021-05-28 11:06:34 +020082 packages: "valgrind",
83 snaps: "",
84 make-prepend: "",
85 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020086 }
87 - {
88 name: "SSH Only",
89 os: "ubuntu-18.04",
90 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020091 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +020092 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +020093 options: "-DENABLE_TLS=OFF -DENABLE_SSH=ON",
Michal Vasko0ddf5f72021-05-28 11:06:34 +020094 packages: "valgrind",
95 snaps: "",
96 make-prepend: "",
97 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +020098 }
99 - {
100 name: "TLS Only",
101 os: "ubuntu-18.04",
102 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200103 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200104 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +0200105 options: "-DENABLE_TLS=ON -DENABLE_SSH=OFF",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200106 packages: "valgrind",
107 snaps: "",
108 make-prepend: "",
109 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +0200110 }
111 - {
112 name: "No SSH nor TLS",
113 os: "ubuntu-18.04",
114 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200115 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200116 cc: "gcc",
Michal Vasko885f60b2021-05-28 11:15:15 +0200117 options: "-DENABLE_TLS=OFF -DENABLE_SSH=OFF",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200118 packages: "valgrind",
119 snaps: "",
120 make-prepend: "",
121 make-target: ""
Michal Vasko5f861fe2021-05-26 10:55:04 +0200122 }
123 - {
124 name: "ASAN and UBSAN",
125 os: "ubuntu-18.04",
126 build-type: "Debug",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200127 dep-build-type: "Release",
Michal Vasko5f861fe2021-05-26 10:55:04 +0200128 cc: "clang",
129 options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_VALGRIND_TESTS=OFF",
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200130 packages: "",
131 snaps: "",
132 make-prepend: "",
133 make-target: ""
134 }
135 - {
136 name: "ABI Check",
137 os: "ubuntu-latest",
138 build-type: "ABICheck",
139 dep-build-type: "Debug",
140 cc: "gcc",
141 options: "",
142 packages: "abi-dumper abi-compliance-checker",
143 snaps: "core universal-ctags",
144 make-prepend: "",
145 make-target: "abi-check"
146 }
Michal Vasko5f861fe2021-05-26 10:55:04 +0200147
148 steps:
149 - uses: actions/checkout@v2
150
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200151 - name: Deps-packages
152 shell: bash
153 run: |
154 sudo add-apt-repository ppa:kedazo/libssh-0.7.x -y
155 sudo apt-get update
156 sudo apt-get install $DEFAULT_PACKAGES ${{ matrix.config.packages }}
157 if ${{ matrix.config.snaps != '' }}
158 then sudo snap install ${{ matrix.config.snaps }}
159 fi
160
161 - name: Deps-uncrustify
Michal Vasko5f861fe2021-05-26 10:55:04 +0200162 shell: bash
163 working-directory: ${{ github.workspace }}
164 run: |
165 git clone --branch uncrustify-0.71.0 https://github.com/uncrustify/uncrustify
166 cd uncrustify
167 mkdir build
168 cd build
169 CC=${{ matrix.config.cc }} cmake ..
170 make
171 sudo make install
172 if: ${{ matrix.config.name == 'Debug, Ubuntu 18.04, gcc' }}
173
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200174 - name: Deps-libyang
Michal Vasko5f861fe2021-05-26 10:55:04 +0200175 shell: bash
176 run: |
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200177 git clone -b ${{needs.git-branch.outputs.branch-name}} https://github.com/CESNET/libyang.git
Michal Vasko5f861fe2021-05-26 10:55:04 +0200178 cd libyang
179 mkdir build
180 cd build
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200181 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.dep-build-type }} -DENABLE_BUILD_TESTS=OFF ..
Michal Vasko5f861fe2021-05-26 10:55:04 +0200182 make -j2
183 sudo make install
184
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200185 - name: Deps-libval
186 shell: bash
187 run: |
Michal Vasko29721a82021-05-26 12:05:08 +0200188 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 Vasko5f861fe2021-05-26 10:55:04 +0200194 - name: Configure
195 shell: bash
196 working-directory: ${{ github.workspace }}
197 run: |
198 mkdir build
199 cd build
Michal Vasko885f60b2021-05-28 11:15:15 +0200200 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} ${{ matrix.config.options }} ..
Michal Vasko5f861fe2021-05-26 10:55:04 +0200201
202 - name: Build
203 shell: bash
204 working-directory: ${{ github.workspace }}/build
Michal Vasko0ddf5f72021-05-28 11:06:34 +0200205 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 Vasko5f861fe2021-05-26 10:55:04 +0200209
210 - name: Test
211 shell: bash
212 working-directory: ${{ github.workspace }}/build
213 run: ctest --output-on-failure