Skip to content

Commit 09c4c4b

Browse files
authored
Coverity Scan Workflow Fix (FreeRTOS#891)
Currently the Coverity Scan attempts to run on every fork that pulls the file. This leads to anybody who pulls this file getting emails that their workflow failed to run when the cron job attempts to run. This PR sets the scan to only run if the repo is FreeRTOS/FreeRTOS-Kernel. Also, change the scan from a cron job to a job that runs on a commit to mainline, or if triggered manually.
1 parent cb196dd commit 09c4c4b

File tree

1 file changed

+54
-14
lines changed

1 file changed

+54
-14
lines changed

.github/workflows/coverity_scan.yml

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,87 @@
1-
name: FreeRTOS-Kernel Coverity Scan
1+
name: Coverity Scan
22
on:
3-
schedule: ## Scheduled to run at 1:15 AM UTC daily.
4-
- cron: '15 1 * * *'
3+
# Run on every commit to mainline
4+
push:
5+
branches: main
6+
# Allow manual running of the scan
7+
workflow_dispatch:
58

9+
env:
10+
bashPass: \033[32;1mPASSED -
11+
bashInfo: \033[33;1mINFO -
12+
bashFail: \033[31;1mFAILED -
13+
bashEnd: \033[0m
614

715
jobs:
8-
916
Coverity-Scan:
17+
if: ( github.repository == 'FreeRTOS/FreeRTOS-Kernel' )
1018
name: Coverity Scan
1119
runs-on: ubuntu-latest
1220
steps:
1321
- name: Checkout the Repository
1422
uses: actions/checkout@v3
1523

16-
- name: Install Build Essentials
24+
- env:
25+
stepName: Install Build Essentials
1726
shell: bash
1827
run: |
28+
# ${{ env.stepName }}
29+
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
30+
1931
sudo apt-get -y update
2032
sudo apt-get -y install build-essential
2133
22-
- name: Install Coverity Build
23-
shell: bash
24-
env:
34+
echo "::endgroup::"
35+
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
36+
37+
- env:
38+
stepName: Install Coverity Build
2539
COVERITY_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
40+
shell: bash
2641
run: |
42+
# ${{ env.stepName }}
43+
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
44+
2745
wget -nv -qO- https://scan.coverity.com/download/linux64 --post-data "token=${COVERITY_TOKEN}&project=FreeRTOS-Kernel" | tar -zx --one-top-level=cov_scan --strip-components 1
2846
echo "cov_scan_path=$(pwd)/cov_scan/bin" >> $GITHUB_ENV
2947
30-
- name: Coverity Build & Upload for Scan
31-
shell: bash
32-
env:
48+
echo "::endgroup::"
49+
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
50+
51+
- env:
52+
stepName: Coverity Build & Upload for Scan
3353
COVERITY_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
3454
COVERITY_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
55+
shell: bash
3556
run: |
57+
# ${{ env.stepName }}
58+
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
59+
3660
export PATH="$PATH:${{env.cov_scan_path}}"
3761
cmake -S ./examples/cmake_example/ -B build
3862
cd build
3963
cov-build --dir cov-int make -j
40-
tar czvf gcc_freertos_kerenl_sample_build.tgz cov-int
64+
tar czvf gcc_freertos_kernel_sample_build.tgz cov-int
65+
66+
echo "::endgroup::"
67+
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
68+
69+
- env:
70+
stepName: Upload Coverity Report for Scan
71+
COVERITY_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
72+
COVERITY_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
73+
shell: bash
74+
run: |
75+
# ${{ env.stepName }}
76+
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
77+
4178
COV_SCAN_UPLOAD_STATUS=$(curl --form token=${COVERITY_TOKEN} \
4279
--form email=${COVERITY_EMAIL} \
43-
--form file=@gcc_freertos_kerenl_sample_build.tgz \
80+
--form file=@gcc_freertos_kernel_sample_build.tgz \
4481
--form version="Mainline" \
45-
--form description="FreeRTOS Kernel Nightly Scan" \
82+
--form description="FreeRTOS Kernel Commit Scan" \
4683
https://scan.coverity.com/builds?project=FreeRTOS-Kernel)
84+
85+
echo "::endgroup::"
86+
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
4787
echo "${COV_SCAN_UPLOAD_STATUS}" | grep -q -e 'Build successfully submitted' || echo >&2 "Error submitting build for analysis: ${COV_SCAN_UPLOAD_STATUS}"

0 commit comments

Comments
 (0)