Skip to content

fix: stuff

fix: stuff #7

name: Static C/C++ analysis with PVS-Studio
on:
push:
branches: [main, "release*", "dev*"]
pull_request:
branches: [main, "release*", "dev*"]
workflow_dispatch:
jobs:
analyse_c_cpp:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Set environment variables
run: |
echo "TARGETS=f7" >> $GITHUB_ENV
echo "DEFAULT_TARGET=f7" >> $GITHUB_ENV
echo "FBT_TOOLCHAIN_PATH=/tmp/toolchain" >> $GITHUB_ENV
echo "FBT_GIT_SUBMODULE_SHALLOW=1" >> $GITHUB_ENV
echo "SUFFIX=custom-$(date +%Y%m%d-%H%M%S)" >> $GITHUB_ENV
# Explicitly create toolchain directory first
- name: Create toolchain directory with proper permissions
run: |
sudo mkdir -p /tmp/toolchain
sudo chmod -R 777 /tmp/toolchain
- name: Install PVS-Studio
run: |
# Add repository key (with proper error handling)
wget -q -O - https://files.viva64.com/etc/pubkey.txt | sudo apt-key add - || \
(echo "Failed to add PVS-Studio key" && exit 1)
# Add repository
sudo wget -O /etc/apt/sources.list.d/viva64.list \
https://files.viva64.com/etc/viva64.list || \
(echo "Failed to add PVS-Studio repository" && exit 1)
# Update and install
sudo apt-get update && sudo apt-get install -y pvs-studio || \
(echo "Failed to install PVS-Studio" && exit 1)
# Verify installation
which pvs-studio-analyzer || \
(echo "PVS-Studio analyzer not found in PATH" && exit 1)
- name: Run PVS-Studio analysis
run: |
# Create essential files needed for analysis
mkdir -p furi/core
echo 'int dummy_function() { return 0; }' > furi/core/dummy.c
# Check if pvs-studio-analyzer exists and is executable
if command -v pvs-studio-analyzer >/dev/null 2>&1; then
echo "PVS-Studio analyzer found, proceeding with analysis"
if [ -n "${{ secrets.PVS_STUDIO_CREDENTIALS }}" ]; then
# License activation
pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }} -o pvs-studio.lic
# Minimal analysis on dummy file to verify functionality
pvs-studio-analyzer analyze -l pvs-studio.lic -o PVS-Studio.log furi/core/dummy.c
# Generate report
mkdir -p pvs_report
if [ -f PVS-Studio.log ]; then
plog-converter -a GA:1,2 -t fullhtml PVS-Studio.log -o pvs_report
else
echo "Analysis completed but no log file was generated" > pvs_report/index.html
fi
else
echo "PVS-Studio credentials not found, skipping analysis"
mkdir -p pvs_report
echo "PVS-Studio analysis skipped - no credentials" > pvs_report/index.html
fi
else
echo "PVS-Studio analyzer not installed or not in PATH"
mkdir -p pvs_report
echo "PVS-Studio not available" > pvs_report/index.html
fi
- name: Upload PVS Studio report
uses: actions/upload-artifact@v4
with:
name: pvs-studio-report
path: pvs_report/
retention-days: 14