Skip to content

feat: update release workflow #346

feat: update release workflow

feat: update release workflow #346

name: Static Analysis
on:
pull_request:
branches: [main]
concurrency:
group: analysis-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Detect source changes
runs-on: ubuntu-latest
outputs:
relevant: ${{ steps.filter.outputs.relevant }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Detect relevant file changes
id: filter
shell: bash
run: |
if [ "${{ github.event_name }}" != "pull_request" ]; then
echo "relevant=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q '^src/'; then
echo "relevant=true" >> "$GITHUB_OUTPUT"
else
echo "relevant=false" >> "$GITHUB_OUTPUT"
fi
cppcheck:
name: Cppcheck
needs: changes
if: needs.changes.outputs.relevant == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Install Cppcheck
run: sudo apt-get update && sudo apt-get install -y cppcheck
- name: Run Cppcheck
run: |
cppcheck \
--enable=warning,style,performance,portability \
--suppress=missingIncludeSystem \
--suppress=missingInclude \
--suppress=unmatchedSuppression \
--inline-suppr \
--std=c++17 \
--language=c++ \
--error-exitcode=1 \
--template='{file}:{line}: {severity}: {message} [{id}]' \
-j $(nproc) \
-I src/common \
-I src/states \
src/ 2>&1 | tee cppcheck-report.txt
- name: Upload Cppcheck report
if: always()
uses: actions/upload-artifact@v6
with:
name: cppcheck-report
path: cppcheck-report.txt
retention-days: 30