Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
467 changes: 249 additions & 218 deletions .github/workflows/action.yml

Large diffs are not rendered by default.

89 changes: 17 additions & 72 deletions .github/workflows/action_tools.yml
Original file line number Diff line number Diff line change
@@ -1,79 +1,24 @@
name: ToolsCI
name: cpp-linter

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
# Runs at 16:00 UTC (BeiJing 00:00) on the 1st of every month
schedule:
- cron: '0 16 1 * *'
push:
branches:
- master
paths-ignore:
- documentation/**
- '**/README.md'
- '**/README_zh.md'
- '**/*.c'
- '**/*.h'
- '**/*.cpp'
pull_request:
branches:
- master
paths-ignore:
- documentation/**
- '**/README.md'
- '**/README_zh.md'
- '**/*.c'
- '**/*.h'
- '**/*.cpp'

permissions:
contents: read # to fetch code (actions/checkout)
types: [opened, reopened]
push:

jobs:
test:
cpp-linter:
runs-on: ubuntu-latest
name: Tools
strategy:
fail-fast: false
env:
TEST_BSP_ROOT: bsp/stm32/stm32f407-atk-explorer
steps:
- uses: actions/checkout@v3

- name: Install Tools
shell: bash
run: |
sudo apt-get update
sudo apt-get -yqq install scons

- name: Install Arm ToolChains
if: ${{ success() }}
shell: bash
run: |
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.3/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version
echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_ENV

- name: Build Tools
run: |
scons --pyconfig-silent -C $TEST_BSP_ROOT
scons -j$(nproc) -C $TEST_BSP_ROOT

- name: Project generate Tools
if: ${{ success() }}
run: |
echo "Test to generate eclipse project"
scons --target=eclipse -s -C $TEST_BSP_ROOT
echo "Test to generate cmake project"
scons --target=cmake -s -C $TEST_BSP_ROOT
echo "Test to generate makefile project"
scons --target=makefile -s -C $TEST_BSP_ROOT

- name: Project dist Tools
if: ${{ success() }}
run: |
echo "Test to dist project"
scons --dist -C $TEST_BSP_ROOT
scons --dist-ide -C $TEST_BSP_ROOT
- uses: actions/checkout@v3
- uses: cpp-linter/cpp-linter-action@v1
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: file

- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
run: |
echo "Some files failed the linting checks!"
exit 1
35 changes: 35 additions & 0 deletions .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Static code analysis

on: [pull_request]

jobs:
scancode_job:
runs-on: ubuntu-latest
name: Static code analysis
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8

- name: cppcheck
shell: bash
run: |
sudo apt-get update
sudo apt-get -qq install cppcheck
git remote -v
git fetch origin
cppcheck --version
ls
git branch -a
changed_files=$(git diff --name-only HEAD origin/master | grep -E '\.(c|cpp|cc|cxx)$')
echo $changed_files
if [ -n "$changed_files" ];then
cppcheck --enable=warning,performance,portability --inline-suppr --error-exitcode=1 --force $changed_files
#cppcheck --enable=warning,style,performance,portability,information --template="{file}:{line}:{severity}:{id}:{message}" --language=c --std=misra-c2012 $changed_files
err=$?
if [ $err -ne 0 ]; then
echo "Hello! we found a obvious fault, please fix the error then commit again"
fi
fi
Loading