2023-07-01 07:29:47 +08:00
|
|
|
#
|
|
|
|
# Copyright (c) 2006-2023, RT-Thread Development Team
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
#
|
|
|
|
# Change Logs:
|
|
|
|
# Date Author Notes
|
|
|
|
# 2023-07-01 Supperthomas the first version
|
2024-09-06 08:26:56 +08:00
|
|
|
# 2024-09-06 Supperthomas add debug for action and add cppcheck for project
|
2023-07-01 07:29:47 +08:00
|
|
|
#
|
|
|
|
name: manual_scons_dist_trigger_only_one
|
2023-06-11 03:36:47 +08:00
|
|
|
|
|
|
|
# Controls when the action will run. Triggers 'scons --dist' to build the dist
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
|
|
|
|
inputs:
|
|
|
|
bsp_options:
|
|
|
|
description: 'Which bsp path Would you want dist in bsp?like stm32/stm32l496-st-nucleo '
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: 'qemu-vexpress-a9'
|
|
|
|
bsp_tool_chain:
|
|
|
|
description: 'Choice tool_chain'
|
|
|
|
required: false
|
|
|
|
default: 'sourcery-arm'
|
|
|
|
type: choice
|
|
|
|
options:
|
|
|
|
- "sourcery-arm"
|
|
|
|
- "llvm-arm"
|
|
|
|
- "sourcery-aarch64"
|
|
|
|
- "sourcery-mips"
|
|
|
|
- "sourcery-riscv-none-embed"
|
|
|
|
- "sourcery-riscv64-unknown-elf"
|
2023-06-14 01:05:56 +08:00
|
|
|
- "gcc"
|
2023-10-30 01:12:29 +08:00
|
|
|
- "sourcery-riscv32-esp32"
|
2023-06-11 03:36:47 +08:00
|
|
|
bsp_config:
|
2024-01-03 23:23:24 +08:00
|
|
|
description: 'Type a config you want mannual test in .config, like: CONFIG_RT_USING_DEBUG=y,CONFIG_RT_DEBUGING_COLOR=y,CONFIG_RT_DEBUGING_CONTEXT=y'
|
2023-06-11 03:36:47 +08:00
|
|
|
required: false
|
|
|
|
type: string
|
2024-01-03 23:23:24 +08:00
|
|
|
default: 'CONFIG_RT_USING_DEBUG=y,CONFIG_RT_DEBUGING_COLOR=y,CONFIG_RT_DEBUGING_CONTEXT=y'
|
2023-07-01 07:29:47 +08:00
|
|
|
dist_flag:
|
|
|
|
description: 'True to dist all bsp, False not dist'
|
|
|
|
required: true
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2024-09-06 08:26:56 +08:00
|
|
|
debug_flag:
|
|
|
|
description: 'True to debug action, False not debug'
|
|
|
|
required: true
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2023-06-11 03:36:47 +08:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read # to fetch code (actions/checkout)
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: ${{ github.event.inputs.bsp_options }}
|
|
|
|
steps:
|
2023-12-26 23:42:58 +08:00
|
|
|
- uses: actions/checkout@v4
|
2023-06-11 03:36:47 +08:00
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v3
|
|
|
|
with:
|
|
|
|
python-version: 3.8
|
|
|
|
|
|
|
|
- name: Install Tools
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2023-10-03 16:50:15 +08:00
|
|
|
wget https://raw.githubusercontent.com/RT-Thread/env/master/install_ubuntu.sh
|
|
|
|
chmod 777 install_ubuntu.sh
|
|
|
|
./install_ubuntu.sh
|
2023-06-11 03:36:47 +08:00
|
|
|
git config --global http.postBuffer 524288000
|
|
|
|
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
|
|
|
|
echo "RTT_CC=gcc" >> $GITHUB_ENV
|
2024-09-06 08:26:56 +08:00
|
|
|
sudo apt-get -qq install cppcheck
|
2023-06-11 03:36:47 +08:00
|
|
|
|
|
|
|
- name: Install Arm ToolChains
|
|
|
|
if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-arm' && 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: Install LLVM-Arm ToolChains
|
|
|
|
if: ${{ github.event.inputs.bsp_tool_chain == 'llvm-arm' && success() }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
wget -q https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-16.0.0/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64.tar.gz
|
|
|
|
sudo tar zxf LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64.tar.gz -C /opt
|
2023-10-03 16:50:15 +08:00
|
|
|
sudo apt-get -qq install libncurses5 libncurses5-dev libncursesw5-dev
|
2023-06-11 03:36:47 +08:00
|
|
|
/opt/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64/bin/clang --version
|
|
|
|
echo "RTT_CC=llvm-arm" >> $GITHUB_ENV
|
|
|
|
echo "RTT_EXEC_PATH=/opt/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64/bin" >> $GITHUB_ENV
|
2023-10-03 16:50:15 +08:00
|
|
|
|
2023-06-11 03:36:47 +08:00
|
|
|
- name: Install AArch64 ToolChains
|
|
|
|
if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-aarch64' && success() }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.6/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz
|
|
|
|
sudo tar -xf gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz -C /opt
|
|
|
|
/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc --version
|
|
|
|
echo "RTT_EXEC_PATH=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install Mips ToolChains
|
|
|
|
if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-mips' && success() }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.1/mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2
|
|
|
|
sudo tar xjf mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 -C /opt
|
|
|
|
/opt/mips-2016.05/bin/mips-sde-elf-gcc --version
|
|
|
|
echo "RTT_EXEC_PATH=/opt/mips-2016.05/bin" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install Riscv64-unknown-elf ToolChains
|
|
|
|
if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-riscv64-unknown-elf' && success() }}
|
|
|
|
run: |
|
|
|
|
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.4/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz
|
|
|
|
sudo tar zxf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz -C /opt
|
|
|
|
/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version
|
|
|
|
echo "RTT_EXEC_PATH=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install Riscv-none-embed ToolChains
|
|
|
|
if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-riscv-none-embed' && success() }}
|
|
|
|
run: |
|
|
|
|
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.5/xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz
|
|
|
|
sudo tar zxf xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz -C /opt
|
|
|
|
/opt/xpack-riscv-none-embed-gcc-8.3.0-2.3/bin/riscv-none-embed-gcc --version
|
|
|
|
echo "RTT_EXEC_PATH=/opt/xpack-riscv-none-embed-gcc-8.3.0-2.3/bin" >> $GITHUB_ENV
|
|
|
|
|
2023-10-03 16:50:15 +08:00
|
|
|
- name: Install riscv32-esp-elf ToolChains
|
|
|
|
if: ${{ github.event.inputs.bsp_tool_chain == 'sourcery-riscv32-esp32' && success() }}
|
|
|
|
run: |
|
|
|
|
wget -q https://github.com/espressif/crosstool-NG/releases/download/esp-2022r1-RC1/riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz
|
|
|
|
sudo tar xf riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz -C /opt
|
|
|
|
/opt/riscv32-esp-elf/bin/riscv32-esp-elf-gcc --version
|
|
|
|
pip3 install esptool
|
|
|
|
echo "RTT_EXEC_PATH=/opt/riscv32-esp-elf/bin" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install GCC Tools
|
|
|
|
if: ${{ github.event.inputs.bsp_tool_chain == 'gcc' && success() }}
|
2023-06-14 01:05:56 +08:00
|
|
|
run: |
|
|
|
|
sudo apt-get -qq install libsdl2-dev
|
|
|
|
|
2023-06-11 03:36:47 +08:00
|
|
|
- name: Bsp Scons Compile
|
|
|
|
if: ${{ success() }}
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
RTT_BSP: ${{ github.event.inputs.bsp_options }}
|
|
|
|
RTT_TOOL_CHAIN: ${{ github.event.inputs.bsp_tool_chain}}
|
|
|
|
run: |
|
2024-09-06 08:26:56 +08:00
|
|
|
source ~/.env/env.sh
|
2023-06-11 03:36:47 +08:00
|
|
|
echo $RTT_BSP
|
|
|
|
ls bsp/$RTT_BSP/Kconfig && scons -C bsp/$RTT_BSP --pyconfig-silent
|
2023-08-22 11:31:59 +08:00
|
|
|
config=${{ github.event.inputs.bsp_config}}
|
2024-01-03 23:23:24 +08:00
|
|
|
echo "$config"
|
|
|
|
echo "$config" >> bsp/$RTT_BSP/.config
|
2024-09-06 08:26:56 +08:00
|
|
|
insert_code="env.Tool('compilation_db')\nenv.CompilationDatabase()\n"
|
|
|
|
sed -i "/DoBuilding(TARGET, objs)/i $insert_code" bsp/$RTT_BSP/SConstruct
|
2023-08-06 00:58:36 +08:00
|
|
|
scons -C bsp/$RTT_BSP --pyconfig-silent
|
2023-06-11 03:36:47 +08:00
|
|
|
pushd bsp/$RTT_BSP && pkgs --update && popd
|
2023-08-22 11:31:59 +08:00
|
|
|
cat bsp/$RTT_BSP/.config
|
2023-06-11 03:36:47 +08:00
|
|
|
scons -C bsp/$RTT_BSP -j$(nproc)
|
2024-09-06 08:26:56 +08:00
|
|
|
ls bsp/$RTT_BSP
|
|
|
|
cppcheck --project=bsp/$RTT_BSP/compile_commands.json
|
2023-06-11 03:36:47 +08:00
|
|
|
pwd
|
2024-09-06 08:26:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Setup Debug Session
|
|
|
|
if: ${{ github.event.inputs.debug_flag }}
|
|
|
|
uses: csexton/debugger-action@master
|
|
|
|
|
2023-06-11 03:36:47 +08:00
|
|
|
- uses: actions/upload-artifact@v3
|
2023-07-04 09:46:22 +08:00
|
|
|
if: ${{ github.event.inputs.dist_flag }}
|
2023-06-11 03:36:47 +08:00
|
|
|
with:
|
|
|
|
name: dist_file
|
|
|
|
path: ${{ github.workspace }}/${{ github.event.inputs.bsp_options }}/*
|
|
|
|
|