[action] add cppcheck project and action debug

This commit is contained in:
Supper Thomas 2024-09-06 08:26:56 +08:00 committed by Meco Man
parent 6fc1fc72b7
commit 0c16568387
1 changed files with 19 additions and 6 deletions

View File

@ -6,6 +6,7 @@
# Change Logs: # Change Logs:
# Date Author Notes # Date Author Notes
# 2023-07-01 Supperthomas the first version # 2023-07-01 Supperthomas the first version
# 2024-09-06 Supperthomas add debug for action and add cppcheck for project
# #
name: manual_scons_dist_trigger_only_one name: manual_scons_dist_trigger_only_one
@ -43,6 +44,11 @@ on:
required: true required: true
type: boolean type: boolean
default: false default: false
debug_flag:
description: 'True to debug action, False not debug'
required: true
type: boolean
default: false
permissions: permissions:
contents: read # to fetch code (actions/checkout) contents: read # to fetch code (actions/checkout)
@ -68,6 +74,7 @@ jobs:
git config --global http.postBuffer 524288000 git config --global http.postBuffer 524288000
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
echo "RTT_CC=gcc" >> $GITHUB_ENV echo "RTT_CC=gcc" >> $GITHUB_ENV
sudo apt-get -qq install cppcheck
- name: Install Arm ToolChains - name: Install Arm ToolChains
if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-arm' && success() }} if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-arm' && success() }}
@ -144,22 +151,28 @@ jobs:
RTT_BSP: ${{ github.event.inputs.bsp_options }} RTT_BSP: ${{ github.event.inputs.bsp_options }}
RTT_TOOL_CHAIN: ${{ github.event.inputs.bsp_tool_chain}} RTT_TOOL_CHAIN: ${{ github.event.inputs.bsp_tool_chain}}
run: | run: |
# source ~/.env/env.sh source ~/.env/env.sh
echo $RTT_BSP echo $RTT_BSP
ls bsp/$RTT_BSP/Kconfig && scons -C bsp/$RTT_BSP --pyconfig-silent ls bsp/$RTT_BSP/Kconfig && scons -C bsp/$RTT_BSP --pyconfig-silent
config=${{ github.event.inputs.bsp_config}} config=${{ github.event.inputs.bsp_config}}
echo "$config" echo "$config"
echo "$config" >> bsp/$RTT_BSP/.config echo "$config" >> bsp/$RTT_BSP/.config
insert_code="env.Tool('compilation_db')\nenv.CompilationDatabase()\n"
sed -i "/DoBuilding(TARGET, objs)/i $insert_code" bsp/$RTT_BSP/SConstruct
scons -C bsp/$RTT_BSP --pyconfig-silent scons -C bsp/$RTT_BSP --pyconfig-silent
pushd bsp/$RTT_BSP && pkgs --update && popd pushd bsp/$RTT_BSP && pkgs --update && popd
cat bsp/$RTT_BSP/.config cat bsp/$RTT_BSP/.config
scons -C bsp/$RTT_BSP -j$(nproc) scons -C bsp/$RTT_BSP -j$(nproc)
mkdir -p ${{ github.workspace }}/$RTT_BSP ls bsp/$RTT_BSP
cp -r bsp/$RTT_BSP ${{ github.workspace }}/$RTT_BSP/ cppcheck --project=bsp/$RTT_BSP/compile_commands.json
scons --dist -C bsp/$RTT_BSP
cp bsp/$RTT_BSP/dist/project.zip ${{ github.workspace }}/$RTT_BSP/
ls bsp/$RTT_BSP/dist
pwd pwd
- name: Setup Debug Session
if: ${{ github.event.inputs.debug_flag }}
uses: csexton/debugger-action@master
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
if: ${{ github.event.inputs.dist_flag }} if: ${{ github.event.inputs.dist_flag }}
with: with: