Skip to content

Commit 0ede411

Browse files
committed
actions FEATURE coverity scan on push
1 parent 69d9fff commit 0ede411

File tree

4 files changed

+150
-117
lines changed

4 files changed

+150
-117
lines changed

.github/workflows/ci.yml

+118-59
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,28 @@ on:
99
- master
1010
- devel
1111

12+
env:
13+
COVERITY_PROJECT: CESNET%2Flibyang
14+
1215
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"
1330
build:
1431
name: ${{ matrix.config.name }}
1532
runs-on: ${{ matrix.config.os }}
33+
needs: git-branch
1634
strategy:
1735
fail-fast: false
1836
matrix:
@@ -24,7 +42,10 @@ jobs:
2442
cc: "gcc",
2543
options: "-DENABLE_BUILD_TESTS=ON",
2644
packager: "sudo apt-get",
27-
packages: "libcmocka-dev shunit2"
45+
packages: "libcmocka-dev shunit2",
46+
snaps: "",
47+
make-prepend: "",
48+
make-target: ""
2849
}
2950
- {
3051
name: "Release, Ubuntu 18.04, clang",
@@ -33,7 +54,10 @@ jobs:
3354
cc: "clang",
3455
options: "-DENABLE_BUILD_TESTS=ON",
3556
packager: "sudo apt-get",
36-
packages: "libcmocka-dev shunit2"
57+
packages: "libcmocka-dev shunit2",
58+
snaps: "",
59+
make-prepend: "",
60+
make-target: ""
3761
}
3862
- {
3963
name: "Debug, Ubuntu 18.04, gcc",
@@ -42,7 +66,10 @@ jobs:
4266
cc: "gcc",
4367
options: "",
4468
packager: "sudo apt-get",
45-
packages: "libcmocka-dev valgrind shunit2"
69+
packages: "libcmocka-dev valgrind shunit2",
70+
snaps: "",
71+
make-prepend: "",
72+
make-target: ""
4673
}
4774
- {
4875
name: "Debug, Ubuntu 18.04, clang",
@@ -51,7 +78,10 @@ jobs:
5178
cc: "clang",
5279
options: "",
5380
packager: "sudo apt-get",
54-
packages: "libcmocka-dev valgrind shunit2"
81+
packages: "libcmocka-dev valgrind shunit2",
82+
snaps: "",
83+
make-prepend: "",
84+
make-target: ""
5585
}
5686
- {
5787
name: "Release, macOS 10.15, clang",
@@ -60,7 +90,10 @@ jobs:
6090
cc: "clang",
6191
options: "-DENABLE_BUILD_TESTS=ON",
6292
packager: "brew",
63-
packages: "cmocka shunit2"
93+
packages: "cmocka shunit2",
94+
snaps: "",
95+
make-prepend: "",
96+
make-target: ""
6497
}
6598
- {
6699
name: "ASAN and UBSAN",
@@ -69,13 +102,60 @@ jobs:
69102
cc: "clang",
70103
options: "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -DENABLE_BUILD_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF",
71104
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: ""
73142
}
74143

75144
steps:
76145
- uses: actions/checkout@v2
77146

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
79159
shell: bash
80160
working-directory: ${{ github.workspace }}
81161
run: |
@@ -88,11 +168,22 @@ jobs:
88168
sudo make install
89169
if: ${{ matrix.config.name == 'Debug, Ubuntu 18.04, gcc' }}
90170

91-
- name: Dependencies
171+
- name: Deps-coverity
92172
shell: bash
173+
working-directory: ${{ github.workspace }}
93174
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' }}
96187

97188
- name: Configure
98189
shell: bash
@@ -105,66 +196,34 @@ jobs:
105196
- name: Build
106197
shell: bash
107198
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 }}
109203
110204
- name: Test
111205
shell: bash
112206
working-directory: ${{ github.workspace }}/build
113207
run: ctest --output-on-failure
114208

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
135210
shell: bash
136211
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
146212
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' }}
166224

167225
- name: Upload to Codecov.io
168226
shell: bash
169227
working-directory: ${{ github.workspace }}/build
170228
run: bash <(curl -s https://codecov.io/bash)
229+
if: ${{ matrix.config.name == 'Codecov' && github.event_name == 'push' }}

.github/workflows/coverity-scan.yml

-57
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
[![BSD license](https://img.shields.io/badge/License-BSD-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
44
[![Build](https://github.com/CESNET/libyang/workflows/libyang%20CI/badge.svg)](https://github.com/CESNET/libyang/actions?query=workflow%3A%22libyang+CI%22)
55
[![Docs](https://img.shields.io/badge/docs-link-blue)](https://netopeer.liberouter.org/doc/libyang/)
6-
[![codecov.io](https://codecov.io/github/CESNET/libyang/coverage.svg?branch=master)](https://codecov.io/github/CESNET/libyang?branch=master)
76
[![Coverity Scan Build Status](https://scan.coverity.com/projects/5259/badge.svg)](https://scan.coverity.com/projects/5259)
7+
[![codecov.io](https://codecov.io/github/CESNET/libyang/coverage.svg?branch=master)](https://codecov.io/github/CESNET/libyang?branch=master)
88
[![Ohloh Project Status](https://www.openhub.net/p/libyang/widgets/project_thin_badge.gif)](https://www.openhub.net/p/libyang)
99

1010
libyang is a YANG data modelling language parser and toolkit written (and

codecov.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
comment:
2+
layout: header, changes, diff
3+
4+
coverage:
5+
precision: 2
6+
round: nearest
7+
8+
ignore:
9+
- compat/.*
10+
- tests/.*
11+
12+
status:
13+
project:
14+
default:
15+
target: auto
16+
if_no_uploads: error
17+
18+
patch:
19+
default:
20+
if_no_uploads: error
21+
22+
changes: true
23+
24+
parsers:
25+
gcov:
26+
branch_detection:
27+
macro: no
28+
loop: no
29+
conditional: no
30+
method: no
31+

0 commit comments

Comments
 (0)