[action] add the yml file support

This commit is contained in:
Supper Thomas 2024-11-05 11:01:30 +08:00 committed by GitHub
parent ee052245d3
commit 96165a5e99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 80 additions and 17 deletions

View File

@ -390,7 +390,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@main
with:
python-version: 3.8

View File

@ -0,0 +1,36 @@
devices.gpio:
kconfig:
- CONFIG_BSP_USING_GPIO=y
scons_arg:
- '--strict'
devices.adc:
kconfig:
- CONFIG_BSP_USING_SAADC=y
devices.flash:
kconfig:
- CONFIG_BSP_USING_ON_CHIP_FLASH=y
devices.i2c:
kconfig:
- CONFIG_BSP_USING_I2C=y
devices.spi:
kconfig:
- CONFIG_BSP_USING_SPI=y
devices.uart:
kconfig:
- CONFIG_BSP_USING_UART=y
devices.watchdog:
kconfig:
- CONFIG_BSP_USING_WDT=y
devices.qspi_flash:
kconfig:
- CONFIG_BSP_USING_QSPI_FLASH=y
devices.pwm:
kconfig:
- CONFIG_BSP_USING_PWM=y
devices.rtc:
kconfig:
- CONFIG_BSP_USING_ONCHIP_RTC=y
devices.hwtimer:
kconfig:
- CONFIG_BSP_USING_TIM=y
- CONFIG_BSP_USING_TIM0=y

View File

@ -1 +0,0 @@
CONFIG_BSP_USING_SAADC=y

View File

@ -1 +0,0 @@
CONFIG_BSP_USING_ON_CHIP_FLASH=y

View File

@ -1 +0,0 @@
CONFIG_BSP_USING_GPIO=y

View File

@ -1,2 +0,0 @@
CONFIG_BSP_USING_TIM=y
CONFIG_BSP_USING_TIM0=y

View File

@ -1 +0,0 @@
CONFIG_BSP_USING_I2C=y

View File

@ -1 +0,0 @@
CONFIG_BSP_USING_PWM=y

View File

@ -1 +0,0 @@
CONFIG_BSP_USING_QSPI_FLASH=y

View File

@ -1 +0,0 @@
CONFIG_BSP_USING_ONCHIP_RTC=y

View File

@ -1 +0,0 @@
CONFIG_BSP_USING_SPI=y

View File

@ -1 +0,0 @@
CONFIG_BSP_USING_UART=y

View File

@ -1 +0,0 @@
CONFIG_BSP_USING_WDT=y

View File

@ -2,7 +2,7 @@ import os
import shutil
import re
import multiprocessing
import yaml
def add_summary(text):
"""
@ -159,13 +159,50 @@ if __name__ == "__main__":
add_summary(f'- ✅ build {bsp} success.')
print("::endgroup::")
yml_files_content = []
directory = os.path.join(rtt_root, 'bsp', bsp, '.ci/attachconfig')
if os.path.exists(directory):
for filename in os.listdir(directory):
if filename.endswith('attachconfig.yml'):
file_path = os.path.join(directory, filename)
if os.path.exists(file_path):
with open(file_path, 'r') as file:
content = yaml.safe_load(file)
yml_files_content.append(content)
config_file = os.path.join(rtt_root, 'bsp', bsp, '.config')
for projects in yml_files_content:
for name, details in projects.items():
count += 1
config_bacakup = config_file+'.origin'
shutil.copyfile(config_file, config_bacakup)
with open(config_file, 'a') as destination:
for line in details.get('kconfig'):
destination.write(line + '\n')
scons_arg = details.get('scons_arg')
scons_arg_str = scons_arg[0] if scons_arg else ' '
print(f"::group::\tCompiling yml project: =={count}==={name}=scons_arg={scons_arg_str}==")
res = build_bsp(bsp, scons_arg_str)
if not res:
print(f"::error::build {bsp} {name} failed.")
add_summary(f'\t- ❌ build {bsp} {name} failed.')
failed += 1
else:
add_summary(f'\t- ✅ build {bsp} {name} success.')
print("::endgroup::")
shutil.copyfile(config_bacakup, config_file)
os.remove(config_bacakup)
attach_dir = os.path.join(rtt_root, 'bsp', bsp, '.ci/attachconfig')
attach_list = []
for root, dirs, files in os.walk(attach_dir):
for file in files:
file_path = os.path.join(root, file)
relative_path = os.path.relpath(file_path, attach_dir)
attach_list.append(relative_path)
if file.endswith('attach'):
file_path = os.path.join(root, file)
relative_path = os.path.relpath(file_path, attach_dir)
attach_list.append(relative_path)
for attach_file in attach_list:
count += 1

View File

@ -0,0 +1,2 @@
pyyaml
pandas