blob: 5dda0adf89087ec4023a348a463fb14b08a7ebd0 [file] [log] [blame]
Michal Vasko5f861fe2021-05-26 10:55:04 +02001name: libnetconf2 CI
2on:
3 push:
4 branches:
5 - libyang2
6 pull_request:
7 branches:
8 - libyang2
9
10env:
11 DEFAULT_OPTIONS: -DENABLE_BUILD_TESTS=ON -DENABLE_DNSSEC=ON
Michal Vasko29721a82021-05-26 12:05:08 +020012 DEFAULT_PACKAGES: libcmocka-dev zlib1g-dev libssh-dev libssl-dev
Michal Vasko5f861fe2021-05-26 10:55:04 +020013
14jobs:
15 build:
16 name: ${{ matrix.config.name }}
17 runs-on: ${{ matrix.config.os }} # mac-OS does not implement robust mutexes so it is not supported
18 strategy:
19 fail-fast: false
20 matrix:
21 config:
22 - {
23 name: "Release, Ubuntu 18.04, gcc",
24 os: "ubuntu-18.04",
25 build-type: "Release",
26 cc: "gcc",
27 options: "",
28 packager: "sudo apt-get",
29 packages: ""
30 }
31 - {
32 name: "Release, Ubuntu 18.04, clang",
33 os: "ubuntu-18.04",
34 build-type: "Release",
35 cc: "clang",
36 options: "",
37 packager: "sudo apt-get",
38 packages: ""
39 }
40 - {
41 name: "Debug, Ubuntu 18.04, gcc",
42 os: "ubuntu-18.04",
43 build-type: "Debug",
44 cc: "gcc",
45 options: "",
46 packager: "sudo apt-get",
47 packages: "valgrind"
48 }
49 - {
50 name: "Debug, Ubuntu 18.04, clang",
51 os: "ubuntu-18.04",
52 build-type: "Debug",
53 cc: "clang",
54 options: "",
55 packager: "sudo apt-get",
56 packages: "valgrind"
57 }
58 - {
59 name: "SSH Only",
60 os: "ubuntu-18.04",
61 build-type: "Debug",
62 cc: "gcc",
63 options: "DENABLE_TLS=OFF -DENABLE_SSH=ON",
64 packager: "sudo apt-get",
65 packages: "valgrind"
66 }
67 - {
68 name: "TLS Only",
69 os: "ubuntu-18.04",
70 build-type: "Debug",
71 cc: "gcc",
72 options: "DENABLE_TLS=ON -DENABLE_SSH=OFF",
73 packager: "sudo apt-get",
74 packages: "valgrind"
75 }
76 - {
77 name: "No SSH nor TLS",
78 os: "ubuntu-18.04",
79 build-type: "Debug",
80 cc: "gcc",
81 options: "DENABLE_TLS=OFF -DENABLE_SSH=OFF",
82 packager: "sudo apt-get",
83 packages: "valgrind"
84 }
85 - {
86 name: "ASAN and UBSAN",
87 os: "ubuntu-18.04",
88 build-type: "Debug",
89 cc: "clang",
90 options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_VALGRIND_TESTS=OFF",
91 packager: "sudo apt-get",
92 packages: ""
93 }
94
95 steps:
96 - uses: actions/checkout@v2
97
98 - name: Uncrustify
99 shell: bash
100 working-directory: ${{ github.workspace }}
101 run: |
102 git clone --branch uncrustify-0.71.0 https://github.com/uncrustify/uncrustify
103 cd uncrustify
104 mkdir build
105 cd build
106 CC=${{ matrix.config.cc }} cmake ..
107 make
108 sudo make install
109 if: ${{ matrix.config.name == 'Debug, Ubuntu 18.04, gcc' }}
110
111 - name: Dependencies
112 shell: bash
113 run: |
114 ${{ matrix.config.packager }} update
115 ${{ matrix.config.packager }} install $DEFAULT_PACKAGES ${{ matrix.config.packages }}
116
117 GIT_BRANCH=`echo ${{ github.ref }} | cut -d'/' -f 3`
118 git clone -b $GIT_BRANCH https://github.com/CESNET/libyang.git
119 cd libyang
120 mkdir build
121 cd build
122 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} -DENABLE_BUILD_TESTS=OFF ..
123 make -j2
124 sudo make install
125
Michal Vasko29721a82021-05-26 12:05:08 +0200126 git clone https://github.com/DNSSEC-Tools/DNSSEC-Tools.git dnssec-tools
127 cd dnssec-tools/dnssec-tools/validator
128 ./configure
129 make -j2
130 sudo make install
131
132
Michal Vasko5f861fe2021-05-26 10:55:04 +0200133 - name: Configure
134 shell: bash
135 working-directory: ${{ github.workspace }}
136 run: |
137 mkdir build
138 cd build
139 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} $DEFAULT_OPTIONS ${{ matrix.config.options }} ..
140
141 - name: Build
142 shell: bash
143 working-directory: ${{ github.workspace }}/build
144 run: make
145
146 - name: Test
147 shell: bash
148 working-directory: ${{ github.workspace }}/build
149 run: ctest --output-on-failure
150
151 coverage:
152 runs-on: ubuntu-latest
153 steps:
154 - uses: actions/checkout@v2
155
156 - name: Dependencies
157 shell: bash
158 run: |
159 sudo apt-get install $DEFAULT_PACKAGES lcov
160
161 GIT_BRANCH=`echo ${{ github.ref }} | cut -d'/' -f 3`
162 git clone -b $GIT_BRANCH https://github.com/CESNET/libyang.git
163 cd libyang
164 mkdir build
165 cd build
166 CC=${{ matrix.config.cc }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.config.build-type }} -DENABLE_BUILD_TESTS=OFF ..
167 make -j2
168 sudo make install
169
170 - name: Configure
171 shell: bash
172 working-directory: ${{ github.workspace }}
173 run: |
174 mkdir build
175 cd build
176 CC=gcc cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ..
177
178 - name: Build
179 shell: bash
180 working-directory: ${{ github.workspace }}/build
181 run: make
182
183 - name: Test
184 shell: bash
185 working-directory: ${{ github.workspace }}/build
186 run: ctest --output-on-failure
187
188 - name: Upload to Codecov.io
189 shell: bash
190 working-directory: ${{ github.workspace }}/build
191 run: bash <(curl -s https://codecov.io/bash)