2024-09-04 06:51:45 +08:00
|
|
|
#
|
|
|
|
# Copyright (c) 2006-2024, RT-Thread Development Team
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
#
|
|
|
|
# Change Logs:
|
|
|
|
# Date Author Notes
|
|
|
|
# 2024-09-04 Supperthomas add cppcheck use the latest release version
|
|
|
|
#
|
2023-04-06 19:43:44 +08:00
|
|
|
name: Static code analysis
|
|
|
|
|
2023-05-16 07:51:16 +08:00
|
|
|
on:
|
2024-09-04 06:51:45 +08:00
|
|
|
workflow_dispatch:
|
2023-04-06 19:43:44 +08:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2023-07-23 18:52:08 +08:00
|
|
|
paths-ignore:
|
|
|
|
- documentation/**
|
|
|
|
- '**/README.md'
|
|
|
|
- '**/README_zh.md'
|
2023-04-06 19:43:44 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
scancode_job:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Static code analysis
|
2023-07-11 08:09:08 +08:00
|
|
|
if: github.repository_owner == 'RT-Thread'
|
2023-04-06 19:43:44 +08:00
|
|
|
steps:
|
2023-12-26 23:42:58 +08:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-06 19:43:44 +08:00
|
|
|
- name: Set up Python
|
2024-09-12 09:41:22 +08:00
|
|
|
uses: actions/setup-python@main
|
2023-04-06 19:43:44 +08:00
|
|
|
with:
|
|
|
|
python-version: 3.8
|
|
|
|
|
|
|
|
- name: cppcheck
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2023-05-16 07:51:16 +08:00
|
|
|
pip install click PyYaml
|
2024-09-09 14:13:43 +08:00
|
|
|
git remote -v
|
|
|
|
git fetch origin
|
|
|
|
ls
|
|
|
|
git branch -a
|
2024-09-04 06:51:45 +08:00
|
|
|
git clone https://github.com/danmar/cppcheck.git
|
|
|
|
cd cppcheck
|
|
|
|
git fetch --tags
|
|
|
|
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
|
|
|
|
echo "Latest release tag: $latest_tag"
|
|
|
|
git checkout $latest_tag
|
2024-09-09 14:13:43 +08:00
|
|
|
make FILESDIR=/usr/local/share/Cppcheck -j2
|
|
|
|
sudo make install FILESDIR=/usr/local/share/Cppcheck
|
2024-09-04 06:51:45 +08:00
|
|
|
cppcheck --version
|
2024-09-09 14:13:43 +08:00
|
|
|
cd ..
|
|
|
|
python tools/ci/cpp_check.py check
|