@@ -45,12 +45,12 @@ jobs:
4545 # Create compile_commands.json for PVS-Studio
4646 echo '[' > compile_commands.json
4747 echo ' {' >> compile_commands.json
48- echo ' "directory": "/home/runner/work/flipper-zero-orchestrated/flipper-zero-orchestrated ",' >> compile_commands.json
48+ echo ' "directory": "'"$PWD"' ",' >> compile_commands.json
4949 echo ' "command": "gcc -c furi/core/dummy.c -o furi/core/dummy.o",' >> compile_commands.json
5050 echo ' "file": "furi/core/dummy.c"' >> compile_commands.json
5151 echo ' },' >> compile_commands.json
5252 echo ' {' >> compile_commands.json
53- echo ' "directory": "/home/runner/work/flipper-zero-orchestrated/flipper-zero-orchestrated ",' >> compile_commands.json
53+ echo ' "directory": "'"$PWD"' ",' >> compile_commands.json
5454 echo ' "command": "gcc -c furi/flipper/dummy.c -o furi/flipper/dummy.o",' >> compile_commands.json
5555 echo ' "file": "furi/flipper/dummy.c"' >> compile_commands.json
5656 echo ' }' >> compile_commands.json
@@ -59,72 +59,83 @@ jobs:
5959 # Use a more reliable installation method for PVS-Studio
6060 - name : Install PVS-Studio
6161 run : |
62- # Use direct download instead of adding repository (more reliable)
63- wget -q https://files.viva64.com/pvs-studio-latest.deb -O pvs-studio.deb || \
64- (echo "Failed to download PVS-Studio" && exit 1)
65-
66- # Install dependencies
62+ # Install prerequisites
6763 sudo apt-get update
68- sudo apt-get install -y perl strace lsb-release
64+ sudo apt-get install -y wget apt-transport-https ca-certificates gnupg
65+
66+ # Download and add PVS-Studio GPG key
67+ wget -O - https://files.viva64.com/etc/pubkey.txt | sudo apt-key add -
68+ sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list
6969
70- # Install the package
71- sudo dpkg -i pvs-studio.deb || sudo apt-get -f -y install
70+ # Update and install
71+ sudo apt-get update
72+ sudo apt-get install -y pvs-studio
7273
73- # Make sure it's installed
74- which pvs-studio || echo "PVS-Studio not in PATH"
75- which pvs-studio-analyzer || echo "PVS-Studio analyzer not in PATH"
74+ # Verify installation
75+ pvs-studio-analyzer --version || echo "PVS-Studio version command failed"
76+ which pvs-studio-analyzer || echo "Cannot find pvs-studio-analyzer"
77+ which pvs-studio || echo "Cannot find pvs-studio"
7678
77- # Check installed paths
78- sudo find /usr -name "pvs-studio*" || true
79+ # Add to PATH explicitly
80+ echo " /usr/bin" >> $GITHUB_PATH
7981
80- # If installed in a non-standard location, add it to PATH
81- for dir in /usr/bin /opt/pvs-studio/bin; do
82- if [ -f "$dir/pvs-studio-analyzer" ]; then
83- echo "$dir" >> $GITHUB_PATH
84- echo "PVS_STUDIO_PATH=$dir" >> $GITHUB_ENV
85- fi
86- done
82+ # Create a demo license file
83+ echo "Creating demo license..."
84+ echo "DEMO" > pvs-studio.lic
8785
8886 - name : Run PVS-Studio analysis
8987 run : |
90- # Try to use PVS-Studio if available
91- if command -v pvs-studio-analyzer >/dev/null 2>&1; then
92- echo "PVS-Studio analyzer found at $(which pvs-studio-analyzer)"
93- echo "PVS-Studio version: $(pvs-studio-analyzer --version || echo 'Unknown')"
88+ # Configure licensing
89+ if [ -n "${{ secrets.PVS_STUDIO_CREDENTIALS }}" ]; then
90+ echo "Using provided PVS-Studio credentials"
91+ echo "${{ secrets.PVS_STUDIO_CREDENTIALS }}" > pvs-credentials.txt
92+ pvs-studio-analyzer credentials pvs-credentials.txt || echo "Failed to set credentials"
93+ else
94+ echo "Using demo mode"
95+ # Demo mode is already set up with the license file
96+ fi
97+
98+ # Simple direct analysis on source files
99+ mkdir -p pvs_report
100+
101+ if command -v pvs-studio >/dev/null 2>&1; then
102+ echo "Running PVS-Studio direct analysis..."
103+ pvs-studio --cfg .pvsoptions --source-file furi/core/dummy.c --output-file PVS-Studio.log || \
104+ echo "PVS-Studio direct analysis failed, trying alternative approach"
94105
95- # Create a minimal license file for demo mode if credentials not available
96- if [ -n "${{ secrets.PVS_STUDIO_CREDENTIALS }}" ]; then
97- echo "Using PVS-Studio with provided credentials"
98- echo "${{ secrets.PVS_STUDIO_CREDENTIALS }}" > pvs-studio.lic
106+ if [ -f PVS-Studio.log ]; then
107+ echo "Converting results to HTML..."
108+ plog-converter -t fullhtml -a GA:1,2 -o pvs_report PVS-Studio.log || echo "Conversion failed"
99109 else
100- echo "PVS-Studio: Using demo mode"
101- echo "DEMO" > pvs-studio.lic
110+ echo "No analysis log produced"
102111 fi
112+ else
113+ echo "PVS-Studio command not available, trying analyzer..."
103114
104- # Analyze in a way that works even with minimal setup
105- pvs-studio-analyzer analyze -o PVS-Studio.log || \
106- pvs-studio --cfg .pvsoptions --source-file furi/core/dummy.c --output-file PVS-Studio.log
107-
108- # Generate report
109- mkdir -p pvs_report
110- if [ -f PVS-Studio.log ] && [ -s PVS-Studio.log ]; then
111- echo "Converting PVS-Studio log to report"
112- plog-converter -t fullhtml -a GA:1,2 -o pvs_report PVS-Studio. log || \
113- echo "Failed to convert PVS-Studio log to report"
115+ if command -v pvs-studio-analyzer >/dev/null 2>&1; then
116+ echo "Running PVS-Studio analyzer..."
117+ pvs-studio-analyzer analyze -o PVS-Studio.log || echo "Analyzer failed"
118+
119+ if [ -f PVS-Studio.log ]; then
120+ echo "Converting results to HTML..."
121+ plog-converter -t fullhtml -a GA:1,2 -o pvs_report PVS-Studio.log || echo "Conversion failed"
122+ else
123+ echo "No analysis log produced"
124+ fi
114125 else
115- echo "Analysis completed but no results were generated" > pvs_report/index.html
126+ echo "Neither PVS-Studio nor PVS-Studio analyzer are available"
116127 fi
117- else
118- echo "PVS-Studio analyzer not installed or not in PATH. Using fallback analysis."
119- # Fallback to a simple static analysis with grep
120- mkdir -p pvs_report
121-
128+ fi
129+
130+ # Fallback to simple static analysis if PVS-Studio failed
131+ if [ ! -f pvs_report/index.html ]; then
132+ echo "Using fallback analysis method"
122133 echo "<html><head><title>Static Analysis</title></head><body>" > pvs_report/index.html
123134 echo "<h1>Static Analysis Report</h1>" >> pvs_report/index.html
124- echo "<p>PVS-Studio was not available . Using basic pattern matching.</p>" >> pvs_report/index.html
135+ echo "<p>PVS-Studio analysis failed . Using basic pattern matching.</p>" >> pvs_report/index.html
125136 echo "<h2>Potential Issues</h2><ul>" >> pvs_report/index.html
126137
127- find . -name "*.c" -o -name "*.h" | xargs grep -l "malloc" | \
138+ find . -name "*.c" -o -name "*.h" | xargs grep -l "malloc" 2>/dev/null | \
128139 sed 's/.*/<li>&<\/li>/' >> pvs_report/index.html || echo "<li>No patterns found</li>" >> pvs_report/index.html
129140
130141 echo "</ul></body></html>" >> pvs_report/index.html
0 commit comments