[FL-3056] Prevent merging of PRs if there are warnings from PVS-studio (#2176)

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Max Andreev 2022-12-26 22:33:44 +03:00 committed by GitHub
parent 8582670a34
commit a34fbf6976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,11 +63,20 @@ jobs:
-f build/f7-firmware-DC/compile_commands.json \ -f build/f7-firmware-DC/compile_commands.json \
-o PVS-Studio.log -o PVS-Studio.log
- name: 'Convert PVS-Studio output to html page' - name: 'Convert PVS-Studio output to html and detect warnings'
run: plog-converter -a GA:1,2,3 -t fullhtml PVS-Studio.log -o reports/${DEFAULT_TARGET}-${SUFFIX} id: pvs-warn
run: |
WARNINGS=0
plog-converter \
-a GA:1,2,3 \
-t fullhtml \
--indicate-warnings \
PVS-Studio.log \
-o reports/${DEFAULT_TARGET}-${SUFFIX} || WARNINGS=1
echo "warnings=${WARNINGS}" >> $GITHUB_OUTPUT
- name: 'Upload artifacts to update server' - name: 'Upload artifacts to update server'
if: ${{ !github.event.pull_request.head.repo.fork }} if: ${{ !github.event.pull_request.head.repo.fork && (steps.pvs-warn.outputs.warnings != 0) }}
run: | run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
ssh-keyscan -p ${{ secrets.RSYNC_DEPLOY_PORT }} -H ${{ secrets.RSYNC_DEPLOY_HOST }} > ~/.ssh/known_hosts ssh-keyscan -p ${{ secrets.RSYNC_DEPLOY_PORT }} -H ${{ secrets.RSYNC_DEPLOY_HOST }} > ~/.ssh/known_hosts
@ -79,8 +88,8 @@ jobs:
rm ./deploy_key; rm ./deploy_key;
- name: 'Find Previous Comment' - name: 'Find Previous Comment'
if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request }} if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request && (steps.pvs-warn.outputs.warnings != 0) }}
uses: peter-evans/find-comment@v1 uses: peter-evans/find-comment@v2
id: fc id: fc
with: with:
issue-number: ${{ github.event.pull_request.number }} issue-number: ${{ github.event.pull_request.number }}
@ -88,7 +97,7 @@ jobs:
body-includes: 'PVS-Studio report for commit' body-includes: 'PVS-Studio report for commit'
- name: 'Create or update comment' - name: 'Create or update comment'
if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request}} if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request && (steps.pvs-warn.outputs.warnings != 0) }}
uses: peter-evans/create-or-update-comment@v1 uses: peter-evans/create-or-update-comment@v1
with: with:
comment-id: ${{ steps.fc.outputs.comment-id }} comment-id: ${{ steps.fc.outputs.comment-id }}
@ -97,3 +106,10 @@ jobs:
**PVS-Studio report for commit `${{steps.names.outputs.commit_sha}}`:** **PVS-Studio report for commit `${{steps.names.outputs.commit_sha}}`:**
- [Report](https://update.flipperzero.one/builds/firmware-pvs-studio-report/${{steps.names.outputs.branch_name}}/${{steps.names.outputs.default_target}}-${{steps.names.outputs.suffix}}/index.html) - [Report](https://update.flipperzero.one/builds/firmware-pvs-studio-report/${{steps.names.outputs.branch_name}}/${{steps.names.outputs.default_target}}-${{steps.names.outputs.suffix}}/index.html)
edit-mode: replace edit-mode: replace
- name: 'Raise exception'
if: ${{ steps.pvs-warn.outputs.warnings != 0 }}
run: |
echo "Please fix all PVS varnings before merge"
exit 1