[action/ci] 把每次编译结果上传到github (#10135)

* [action/ci] 把每次编译结果上传到github

* [fix]

* add output

* fix

* fixthe attach_file_name

* fix

* fix name

* [action] 更新一下toolchain的版本号

* [bsp/stm32] hex 生成

* Update type.h
This commit is contained in:
Supper Thomas 2025-03-23 12:38:27 +08:00 committed by GitHub
parent cdb5ce8d04
commit 151c7a6112
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 54 additions and 25 deletions

View File

@ -1,3 +1,12 @@
#
# Copyright (c) 2025, RT-Thread Development Team
#
# SPDX-License-Identifier: Apache-2.0
#
# Change Logs:
# Date Author Notes
# 2025-03-22 Supperthomas 添加upload 上传编译固件
#
name: RT-Thread BSP Static Build Check
# Controls when the action will run. Triggers the workflow on push or pull request
@ -41,11 +50,11 @@ jobs:
RTT_TOOL_CHAIN: "sourcery-arm"
SUB_RTT_BSP:
- "stm32/stm32f407-rt-spark"
- RTT_BSP: "RTduino/Arduino Libraries (STM32F412 Nucleo)"
- RTT_BSP: "RTduino_Arduino Libraries (STM32F412 Nucleo)"
RTT_TOOL_CHAIN: "sourcery-arm"
SUB_RTT_BSP:
- "stm32/stm32f412-st-nucleo"
- RTT_BSP: "RTduino/Arduino Libraries (Raspberry Pico)"
- RTT_BSP: "RTduino_Arduino Libraries (Raspberry Pico)"
RTT_TOOL_CHAIN: "sourcery-arm"
SUB_RTT_BSP:
- "raspberry-pico"
@ -433,22 +442,22 @@ jobs:
id: cache-gcc-arm
uses: actions/cache@main
with:
path: /opt/gcc-arm-none-eabi-10-2020-q4-major
key: ${{ runner.os }}-arm-none-eabi-10-2020-q4-major
path: /opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi
key: ${{ runner.os }}-arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi
- name: Download Arm ToolChains
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm' && (steps.cache-gcc-arm.outputs.cache-hit != 'true') }}
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
wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.8/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
sudo tar -xf arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz -C /opt
- name: Install Arm ToolChains2
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm'}}
shell: bash
run: |
/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
/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc --version
echo "RTT_EXEC_PATH=/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin" >> $GITHUB_ENV
- name: Install LLVM-Arm ToolChains
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'llvm-arm' && success() }}
@ -536,6 +545,14 @@ jobs:
source ~/.env/env.sh
python tools/ci/bsp_buildings.py
- name: Upload output as artifact
if: ${{ success() }}
uses: actions/upload-artifact@main
with:
name: ${{ matrix.legs.RTT_BSP }}
if-no-files-found: ignore
path: output/
- name: Post failure comment
if: failure()
run: |

View File

@ -55,7 +55,8 @@ if PLATFORM == 'gcc':
CFLAGS += ' -O2'
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'

View File

@ -55,7 +55,8 @@ if PLATFORM == 'gcc':
CFLAGS += ' -O2'
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'

View File

@ -60,7 +60,8 @@ if PLATFORM == 'gcc':
CXXFLAGS = CFLAGS
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'

View File

@ -63,7 +63,7 @@ if PLATFORM == 'gcc':
CXXFLAGS = CFLAGS
POST_ACTION = OBJCPY + ' -O ihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n'
POST_ACTION = OBJCPY + ' -O ihex $TARGET rtthread.hex\n'
POST_ACTION += OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':

View File

@ -61,7 +61,8 @@ if PLATFORM == 'gcc':
CFLAGS += ' -std=gnu99'
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'

View File

@ -61,6 +61,7 @@ if PLATFORM == 'gcc':
CXXFLAGS = CFLAGS
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
elif PLATFORM == 'armcc':
# toolchains

View File

@ -60,7 +60,7 @@ if PLATFORM == 'gcc':
CXXFLAGS = CFLAGS
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'

View File

@ -23,16 +23,17 @@ typedef signed int int32_t;
typedef signed long long int64_t;
#else
#include "stdio.h"
#include "stdint.h"
typedef unsigned char byte;
typedef unsigned short word;
#endif
/**
/**
* @brief __NOINLINE definition
*/
*/
#if defined ( __CC_ARM ) || defined ( __GNUC__ )
/* ARM & GNUCompiler
----------------
/* ARM & GNUCompiler
----------------
*/
#define __NOINLINE noinline

View File

@ -36,7 +36,7 @@ def run_cmd(cmd, output_info=True):
return output_str_list, res
def build_bsp(bsp, scons_args=''):
def build_bsp(bsp, scons_args='',name='default'):
"""
build bsp.
@ -57,6 +57,7 @@ def build_bsp(bsp, scons_args=''):
"""
success = True
os.chdir(rtt_root)
os.makedirs(f'{rtt_root}/output/bsp/{bsp}', exist_ok=True)
if os.path.exists(f"{rtt_root}/bsp/{bsp}/Kconfig"):
os.chdir(rtt_root)
run_cmd(f'scons -C bsp/{bsp} --pyconfig-silent', output_info=False)
@ -67,18 +68,23 @@ def build_bsp(bsp, scons_args=''):
nproc = multiprocessing.cpu_count()
os.chdir(rtt_root)
cmd = f'scons -C bsp/{bsp} -j{nproc} {scons_args} --debug=time'
cmd = f'scons -C bsp/{bsp} -j{nproc} {scons_args}' # --debug=time for debug time
__, res = run_cmd(cmd, output_info=True)
if res != 0:
success = False
else:
#拷贝当前的文件夹下面的所有以elf结尾的文件拷贝到rt-thread/output文件夹下
import glob
# 拷贝编译生成的文件到output目录,文件拓展为 elf,bin,hex
for file_type in ['*.elf', '*.bin', '*.hex']:
files = glob.glob(f'{rtt_root}/bsp/{bsp}/{file_type}')
for file in files:
shutil.copy(file, f'{rtt_root}/output/bsp/{bsp}/{name.replace("/", "_")}.{file_type[2:]}')
os.chdir(f'{rtt_root}/bsp/{bsp}')
run_cmd('scons -c', output_info=False)
#pkg_dir = os.path.join(rtt_root, 'bsp', bsp, 'packages')
#shutil.rmtree(pkg_dir, ignore_errors=True)
return success
@ -145,7 +151,7 @@ def build_bsp_attachconfig(bsp, attach_file):
scons_args = check_scons_args(attach_path)
res = build_bsp(bsp, scons_args)
res = build_bsp(bsp, scons_args,name=attach_file)
shutil.copyfile(config_bacakup, config_file)
os.remove(config_bacakup)
@ -220,7 +226,7 @@ if __name__ == "__main__":
scons_arg.append(line)
scons_arg_str=' '.join(scons_arg) if scons_arg else ' '
print(f"::group::\tCompiling yml project: =={count}==={name}=scons_arg={scons_arg_str}==")
res = build_bsp(bsp, scons_arg_str)
res = build_bsp(bsp, scons_arg_str,name=name)
if not res:
print(f"::error::build {bsp} {name} failed.")
add_summary(f'\t- ❌ build {bsp} {name} failed.')