Skip to content

Commit 76daf49

Browse files
committed
ci: add coverity to the build workflow
* For main branch, download toolbox, build wsbrd using coverity then publish results. * Make sure cov commands are stored in /opt/coverity and accessible by creating a symlink to /usr/local/bin.
1 parent 40c652b commit 76daf49

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/build.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,39 @@ jobs:
6060
-D AUTH_LEGACY=OFF \
6161
-G Ninja
6262
ninja -C build-auth wsbrd
63+
- name: Download Coverity
64+
if: github.ref == 'refs/heads/main'
65+
env:
66+
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
67+
run: |
68+
wget -qO- "https://scan.coverity.com/download/cxx/linux64" \
69+
--post-data "token=${COVERITY_SCAN_TOKEN}&project=wisun-br-linux" \
70+
| tar -xz --one-top-level=/opt/coverity/ --strip-components=1
71+
ln -sfn /opt/coverity/bin/cov* /usr/local/bin
72+
coverity --version
73+
- name: Compile with Coverity
74+
if: github.ref == 'refs/heads/main'
75+
run: |
76+
cmake -S . \
77+
-B build-cov \
78+
-D COMPILE_WSRD=ON \
79+
-D COMPILE_DEVTOOLS=ON \
80+
-D COMPILE_DEMOS=ON \
81+
-D CMAKE_C_FLAGS=-Werror \
82+
-G Ninja
83+
cov-build --dir cov-int ninja -C build-cov
84+
- name: Upload Coverity Scan Results
85+
if: github.ref == 'refs/heads/main'
86+
env:
87+
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
88+
COVERITY_SCAN_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
89+
COVERITY_SCAN_VERSION: ${{ github.sha }}
90+
run: |
91+
tar czf cov-int.tgz cov-int
92+
curl --fail \
93+
--form token="$COVERITY_SCAN_TOKEN" \
94+
--form email="$COVERITY_SCAN_EMAIL" \
95+
96+
--form version="$COVERITY_SCAN_VERSION" \
97+
--form description="Coverity scan results for commit $COVERITY_SCAN_VERSION" \
98+
"https://scan.coverity.com/builds?project=wisun-br-linux"

0 commit comments

Comments
 (0)