Skip to content

Commit 2479ded

Browse files
committed
fix Coverity Scan error : Check Coverity Token
1 parent ed55fd9 commit 2479ded

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/coverity_scan.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,46 @@ jobs:
1717
sudo apt-get update
1818
sudo apt-get install -y curl build-essential cmake pkg-config libsystemd-dev
1919
20+
- name: Check Coverity Token
21+
id: check-token
22+
env:
23+
COVERITY_TOKEN: ${{ secrets.COVERITY_TOKEN }}
24+
run: |
25+
if [ -z "${COVERITY_TOKEN}" ]; then
26+
echo "COVERITY_TOKEN secret is not set. Skipping Coverity scan."
27+
echo "skip=true" >> $GITHUB_OUTPUT
28+
else
29+
echo "skip=false" >> $GITHUB_OUTPUT
30+
fi
31+
2032
- name: Download Coverity Tool
33+
if: steps.check-token.outputs.skip == 'false'
2134
run: |
35+
echo "Downloading Coverity tool..."
2236
curl -s -L --output coverity_tool.tgz "https://scan.coverity.com/download/linux64?token=${{ secrets.COVERITY_TOKEN }}&project=gabime%2Fspdlog"
37+
38+
# Verify the downloaded file is a valid tar archive
39+
if ! file coverity_tool.tgz | grep -q "gzip compressed"; then
40+
echo "Error: Downloaded file is not a valid gzip archive"
41+
echo "File content (first 200 bytes):"
42+
head -c 200 coverity_tool.tgz
43+
exit 1
44+
fi
45+
2346
mkdir coverity_tool
2447
tar -C coverity_tool --strip-components=1 -xf coverity_tool.tgz
2548
echo "$PWD/coverity_tool/bin" >> $GITHUB_PATH
2649
2750
- name: Build with Coverity
51+
if: steps.check-token.outputs.skip == 'false'
2852
run: |
2953
mkdir build && cd build
3054
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17
3155
cd ..
3256
cov-build --dir cov-int make -C build -j4
3357
3458
- name: Submit results to Coverity
59+
if: steps.check-token.outputs.skip == 'false'
3560
run: |
3661
tar czf cov-int.tgz cov-int
3762
response=$(curl --silent --show-error --fail \

0 commit comments

Comments
 (0)