Skip to content

Commit

Permalink
Some more work on scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Zang3th committed Jul 3, 2024
1 parent c6687ae commit e5b6c3e
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 91 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Static Analysis

on: [push, pull_request]

jobs:
static_analysis:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install pvs tools
run: |
wget -q -O - https://files.pvs-studio.com/etc/pubkey.txt \
| sudo apt-key add -
sudo wget -O /etc/apt/sources.list.d/viva64.list \
https://files.pvs-studio.com/etc/viva64.list
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install libglu1-mesa-dev mesa-common-dev
sudo apt-get install pvs-studio
pvs-studio-analyzer credentials ${{secrets.PVS_STUDIO_CREDENTIALS}}
- name: Build debug config
run: |
cmake -B ${{github.workspace}}/Debug_Build_PVS -D CMAKE_BUILD_TYPE=Debug -D CMAKE_CXX_FLAGS="-g" -D CMAKE_EXPORT_COMPILE_COMMANDS=On
cmake --build ${{github.workspace}}/Debug_Build_PVS -j
- name: Analyze debug config
run: |
pvs-studio-analyzer analyze -f ${{github.workspace}}/Debug_Build_PVS/compile_commands.json -j -e Vendor/
- name: Convert report
run: plog-converter -t sarif -o pvs-report.sarif PVS-Studio.log

- name: Publish report
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: pvs-report.sarif
category: PVS-Studio
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Fetch updates
run: sudo apt-get update && sudo apt-get upgrade

- name: Install OpenGL
run: sudo apt-get install libglu1-mesa-dev mesa-common-dev

- name: Install X virtual framebuffer
run: sudo apt-get install xvfb

- name: Build debug config
run: |
cmake -B ${{github.workspace}}/Debug_Build -D CMAKE_BUILD_TYPE=Debug -D CMAKE_CXX_FLAGS="-g"
cmake --build ${{github.workspace}}/Debug_Build -j
- name: Run GreenWorld_Debug
working-directory: ${{github.workspace}}/Debug_Build
run: xvfb-run -a ./GreenWorld & sleep 20 ; kill $!

- name: Run CellSim_Debug
working-directory: ${{github.workspace}}/Debug_Build
run: xvfb-run -a ./CellSim & sleep 20 ; kill $!

- name: Run Liquefied_Debug
working-directory: ${{github.workspace}}/Debug_Build
run: xvfb-run -a ./Liquefied & sleep 20 ; kill $!

- name: Build release config
run: |
cmake -B ${{github.workspace}}/Release_Build -D CMAKE_BUILD_TYPE=Release -D CMAKE_CXX_FLAGS="-O3 -Wno-unused-but-set-variable -Wno-unused-result"
cmake --build ${{github.workspace}}/Release_Build -j
- name: Run GreenWorld_Release
working-directory: ${{github.workspace}}/Release_Build
run: xvfb-run -a ./GreenWorld & sleep 20 ; kill $!

- name: Run CellSim_Release
working-directory: ${{github.workspace}}/Release_Build
run: xvfb-run -a ./CellSim & sleep 20 ; kill $!

- name: Run Liquefied_Release
working-directory: ${{github.workspace}}/Release_Build
run: xvfb-run -a ./Liquefied & sleep 20 ; kill $!
88 changes: 0 additions & 88 deletions .github/workflows/build_and_analyze.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/Release_Build
/.idea
/.PVS-Studio
/PVS-Report
PVS-Studio.log
.i
.cfg
myeasylog.log
3 changes: 0 additions & 3 deletions Scripts/CppCheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ cd "$PROJECT_ROOT" || exit

clear
cppcheck Apps/ Engine/ --enable=all --suppress=cstyleCast --suppress=unusedFunction --suppress=missingInclude --suppress=unknownMacro

# pvs-studio-analyzer analyze -f .PVS-Studio/depend_info.json -j -e Vendor/
# plog-converter -a GA:1,2 -t tasklist -o project.tasks PVS-Studio.log
6 changes: 6 additions & 0 deletions Scripts/LoC.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

loc_engine=$(find ./Engine -type f | xargs cat | wc -l)
echo "Lines in ./Engine: $loc_engine"
loc_apps=$(find ./Apps -type f | xargs cat | wc -l)
echo "Lines in ./Apps: $loc_apps"
14 changes: 14 additions & 0 deletions Scripts/PVS.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

SCRIPT_DIR=$(dirname "$(realpath "$0")")
PROJECT_ROOT=$(realpath "$SCRIPT_DIR/..")
cd "$PROJECT_ROOT" || exit

GREEN='\033[0;32m'
NC='\033[0m'

echo -e "${GREEN}Running PVS-Studio analysis...${NC}"
pvs-studio-analyzer analyze -f Debug_Build/compile_commands.json -j -e Vendor/

echo -e "${GREEN}Converting PVS-Studio log to HTML...${NC}"
plog-converter -t fullhtml -o PVS-Report PVS-Studio.log

0 comments on commit e5b6c3e

Please sign in to comment.