| 1 |
name: static-analysis |
| 2 |
|
| 3 |
on: |
| 4 |
workflow_run: |
| 5 |
# Perform static analysis together with build workflow. Build triggers of "build" workflow do not need to be repeated here. |
| 6 |
workflows: |
| 7 |
- build |
| 8 |
types: |
| 9 |
- requested |
| 10 |
|
| 11 |
jobs: |
| 12 |
PVS-Studio: |
| 13 |
runs-on: ubuntu-22.04 |
| 14 |
steps: |
| 15 |
- uses: actions/checkout@v4 |
| 16 |
with: |
| 17 |
fetch-depth: 1 |
| 18 |
|
| 19 |
- name: Install Dependencies |
| 20 |
env: |
| 21 |
# The Secret variable setup in GitHub must be in format: "name_or_email key", on a single line |
| 22 |
PVS_STUDIO_LICENSE: ${{ secrets.PVS_STUDIO_LICENSE }} |
| 23 |
run: | |
| 24 |
if [[ "$PVS_STUDIO_LICENSE" != "" ]]; |
| 25 |
then |
| 26 |
wget -q https://files.viva64.com/etc/pubkey.txt |
| 27 |
sudo apt-key add pubkey.txt |
| 28 |
sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list |
| 29 |
sudo apt-get update |
| 30 |
sudo apt-get install -y pvs-studio |
| 31 |
pvs-studio-analyzer credentials -o pvs-studio.lic $PVS_STUDIO_LICENSE |
| 32 |
fi |
| 33 |
|
| 34 |
- name: PVS-Studio static analysis |
| 35 |
run: | |
| 36 |
if [[ ! -f pvs-studio.lic ]]; |
| 37 |
then |
| 38 |
echo "PVS Studio license is missing. No analysis will be performed." |
| 39 |
echo "If you have a PVS Studio license please create a project secret named PVS_STUDIO_LICENSE with your license." |
| 40 |
echo "You may use a free license. More information at https://www.viva64.com/en/b/0457/" |
| 41 |
exit 0 |
| 42 |
fi |
| 43 |
cd examples/example_null |
| 44 |
pvs-studio-analyzer trace -- make WITH_EXTRA_WARNINGS=1 |
| 45 |
pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log |
| 46 |
plog-converter -a 'GA:1,2;OP:1' -d V1071 -t errorfile -w pvs-studio.log |