9
9
- master
10
10
- devel
11
11
12
+ env :
13
+ COVERITY_PROJECT : CESNET%2Flibyang
14
+
12
15
jobs :
16
+ 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"
13
30
build :
14
31
name : ${{ matrix.config.name }}
15
32
runs-on : ${{ matrix.config.os }}
33
+ needs : git-branch
16
34
strategy :
17
35
fail-fast : false
18
36
matrix :
24
42
cc : " gcc" ,
25
43
options : " -DENABLE_BUILD_TESTS=ON" ,
26
44
packager : " sudo apt-get" ,
27
- packages : " libcmocka-dev shunit2"
45
+ packages : " libcmocka-dev shunit2" ,
46
+ snaps : " " ,
47
+ make-prepend : " " ,
48
+ make-target : " "
28
49
}
29
50
- {
30
51
name : " Release, Ubuntu 18.04, clang" ,
33
54
cc : " clang" ,
34
55
options : " -DENABLE_BUILD_TESTS=ON" ,
35
56
packager : " sudo apt-get" ,
36
- packages : " libcmocka-dev shunit2"
57
+ packages : " libcmocka-dev shunit2" ,
58
+ snaps : " " ,
59
+ make-prepend : " " ,
60
+ make-target : " "
37
61
}
38
62
- {
39
63
name : " Debug, Ubuntu 18.04, gcc" ,
42
66
cc : " gcc" ,
43
67
options : " " ,
44
68
packager : " sudo apt-get" ,
45
- packages : " libcmocka-dev valgrind shunit2"
69
+ packages : " libcmocka-dev valgrind shunit2" ,
70
+ snaps : " " ,
71
+ make-prepend : " " ,
72
+ make-target : " "
46
73
}
47
74
- {
48
75
name : " Debug, Ubuntu 18.04, clang" ,
51
78
cc : " clang" ,
52
79
options : " " ,
53
80
packager : " sudo apt-get" ,
54
- packages : " libcmocka-dev valgrind shunit2"
81
+ packages : " libcmocka-dev valgrind shunit2" ,
82
+ snaps : " " ,
83
+ make-prepend : " " ,
84
+ make-target : " "
55
85
}
56
86
- {
57
87
name : " Release, macOS 10.15, clang" ,
60
90
cc : " clang" ,
61
91
options : " -DENABLE_BUILD_TESTS=ON" ,
62
92
packager : " brew" ,
63
- packages : " cmocka shunit2"
93
+ packages : " cmocka shunit2" ,
94
+ snaps : " " ,
95
+ make-prepend : " " ,
96
+ make-target : " "
64
97
}
65
98
- {
66
99
name : " ASAN and UBSAN" ,
@@ -69,13 +102,60 @@ jobs:
69
102
cc : " clang" ,
70
103
options : " -DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_BUILD_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF" ,
71
104
packager : " sudo apt-get" ,
72
- packages : " libcmocka-dev"
105
+ packages : " libcmocka-dev" ,
106
+ snaps : " " ,
107
+ make-prepend : " " ,
108
+ make-target : " "
109
+ }
110
+ - {
111
+ name : " ABI Check" ,
112
+ os : " ubuntu-latest" ,
113
+ build-type : " ABICheck" ,
114
+ cc : " gcc" ,
115
+ options : " " ,
116
+ packages : " libcmocka-dev abi-dumper abi-compliance-checker" ,
117
+ snaps : " core universal-ctags" ,
118
+ make-prepend : " " ,
119
+ make-target : " abi-check"
120
+ }
121
+ - {
122
+ name : " Coverity" ,
123
+ os : " ubuntu-latest" ,
124
+ build-type : " Debug" ,
125
+ cc : " clang" ,
126
+ options : " " ,
127
+ packages : " " ,
128
+ snaps : " " ,
129
+ make-prepend : " cov-build --dir cov-int" ,
130
+ make-target : " "
131
+ }
132
+ - {
133
+ name : " Codecov" ,
134
+ os : " ubuntu-latest" ,
135
+ build-type : " Debug" ,
136
+ cc : " gcc" ,
137
+ options : " -DENABLE_COVERAGE=ON" ,
138
+ packages : " libcmocka-dev lcov" ,
139
+ snaps : " " ,
140
+ make-prepend : " " ,
141
+ make-target : " "
73
142
}
74
143
75
144
steps :
76
145
- uses : actions/checkout@v2
77
146
78
- - name : Uncrustify
147
+ - name : Deps-packages
148
+ shell : bash
149
+ run : |
150
+ ${{ matrix.config.packager }} update
151
+ if ${{ matrix.config.packages != '' }}
152
+ then ${{ matrix.config.packager }} install ${{ matrix.config.packages }}
153
+ fi
154
+ if ${{ matrix.config.snaps != '' }}
155
+ then sudo snap install ${{ matrix.config.snaps }}
156
+ fi
157
+
158
+ - name : Deps-uncrustify
79
159
shell : bash
80
160
working-directory : ${{ github.workspace }}
81
161
run : |
@@ -88,11 +168,22 @@ jobs:
88
168
sudo make install
89
169
if : ${{ matrix.config.name == 'Debug, Ubuntu 18.04, gcc' }}
90
170
91
- - name : Dependencies
171
+ - name : Deps-coverity
92
172
shell : bash
173
+ working-directory : ${{ github.workspace }}
93
174
run : |
94
- ${{ matrix.config.packager }} update
95
- ${{ matrix.config.packager }} install ${{ matrix.config.packages }}
175
+ wget -q https://scan.coverity.com/download/linux64 --post-data "token=$TOKEN&project=$COVERITY_PROJECT" -O coverity-tools.tar.gz
176
+ mkdir coverity-tools
177
+ tar xzf coverity-tools.tar.gz --strip 1 -C coverity-tools
178
+ env :
179
+ TOKEN : ${{ secrets.COVERITY_SCAN_TOKEN }}
180
+ if : ${{ matrix.config.name == 'Coverity' }}
181
+
182
+ - name : Deps-coverity-fix-permissions
183
+ run : |
184
+ chmod go-w $HOME
185
+ sudo chmod -R go-w /usr/share
186
+ if : ${{ matrix.config.name == 'Coverity' }}
96
187
97
188
- name : Configure
98
189
shell : bash
@@ -105,66 +196,34 @@ jobs:
105
196
- name : Build
106
197
shell : bash
107
198
working-directory : ${{ github.workspace }}/build
108
- run : make
199
+ run : |
200
+ export LC_ALL=C.UTF-8
201
+ export PATH=/snap/bin:${{ github.workspace }}/coverity-tools/bin:$PATH
202
+ ${{ matrix.config.make-prepend }} make ${{ matrix.config.make-target }}
109
203
110
204
- name : Test
111
205
shell : bash
112
206
working-directory : ${{ github.workspace }}/build
113
207
run : ctest --output-on-failure
114
208
115
- abi :
116
- runs-on : ubuntu-latest
117
- steps :
118
- - uses : actions/checkout@v2
119
-
120
- - name : Dependencies
121
- shell : bash
122
- run : |
123
- sudo apt-get install abi-dumper abi-compliance-checker
124
- sudo snap install core universal-ctags
125
-
126
- - name : Configure
127
- shell : bash
128
- working-directory : ${{ github.workspace }}
129
- run : |
130
- mkdir build
131
- cd build
132
- CC=gcc cmake -DCMAKE_BUILD_TYPE=ABICheck ..
133
-
134
- - name : Build
209
+ - name : Upload to Coverity.com
135
210
shell : bash
136
211
working-directory : ${{ github.workspace }}/build
137
- run : LC_ALL=C.UTF-8 PATH=/snap/bin:$PATH make abi-check
138
-
139
- coverage :
140
- runs-on : ubuntu-latest
141
- steps :
142
- - uses : actions/checkout@v2
143
-
144
- - name : Dependencies
145
- shell : bash
146
212
run : |
147
- sudo apt-get install libcmocka-dev lcov
148
-
149
- - name : Configure
150
- shell : bash
151
- working-directory : ${{ github.workspace }}
152
- run : |
153
- mkdir build
154
- cd build
155
- CC=gcc cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ..
156
-
157
- - name : Build
158
- shell : bash
159
- working-directory : ${{ github.workspace }}/build
160
- run : make
161
-
162
- - name : Test
163
- shell : bash
164
- working-directory : ${{ github.workspace }}/build
165
- run : ctest --output-on-failure
213
+ tar czvf libyang.tgz cov-int
214
+ curl \
215
+ --form token=$TOKEN \
216
+
217
+ --form file=libyang.tgz \
218
+ --form version="`./yanglint -v | cut -d\" \" -f2`" \
219
+ --form description="libyang YANG library" \
220
+ https://scan.coverity.com/builds?project=$COVERITY_PROJECT
221
+ env :
222
+ TOKEN : ${{ secrets.COVERITY_SCAN_TOKEN }}
223
+ if : ${{ matrix.config.name == 'Coverity' && github.event_name == 'push' && needs.git-branch.outputs.branch-name == 'devel' }}
166
224
167
225
- name : Upload to Codecov.io
168
226
shell : bash
169
227
working-directory : ${{ github.workspace }}/build
170
228
run : bash <(curl -s https://codecov.io/bash)
229
+ if : ${{ matrix.config.name == 'Codecov' && github.event_name == 'push' }}
0 commit comments