Skip to content

[action/ci] 根据看护产品,结合版本versionconfig ci自动生成版本测试产物 #10170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
43 changes: 38 additions & 5 deletions .github/workflows/bsp_buildings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ on:
types:
- online-pkgs-static-building-trigger-event
workflow_dispatch:
inputs:
output_contral:
description: 'Output Contral'
Comment on lines +38 to +39
Copy link
Preview

Copilot AI Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Possible typo: consider renaming 'output_contral' to 'output_control' for clarity.

Suggested change
output_contral:
description: 'Output Contral'
output_control:
description: 'Output Control'

Copilot uses AI. Check for mistakes.

required: false
default: 'attachconfig'
type: choice
options:
- "attachconfig"
- "versionconfig"

permissions:
contents: read # to fetch code (actions/checkout)
Expand Down Expand Up @@ -101,7 +110,6 @@ jobs:
runs-on: ubuntu-22.04
needs: generate-matrix
name: ${{ matrix.legs.RTT_BSP }}
if: github.repository_owner == 'RT-Thread'
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrix.outputs.filtered_matrix) }}
Expand Down Expand Up @@ -233,24 +241,32 @@ jobs:
python tools/ci/bsp_buildings.py

- name: Upload output as artifact
if: ${{ success() }}
if: ${{ success() && github.event.inputs.output_contral == 'attachconfig' }}
uses: actions/upload-artifact@main
with:
name: ${{ matrix.legs.RTT_BSP }}
if-no-files-found: ignore
path: output/

- name: Upload output as artifact
if: ${{ success() && github.event.inputs.output_contral == 'versionconfig'}}
uses: actions/upload-artifact@main
with:
name: ${{ matrix.legs.RTT_BSP }}
if-no-files-found: ignore
path: version_output/

- name: Post failure comment
if: failure()
run: |
curl -X POST -H "Authorization: token ${{ secrets.RTTHREAD_GITHUB_TOKEN }}" \
-d '{"body":"@${{ github.actor }}, Thank you for your contribution, but there was an error with the action. Could you please help check the BSP compilation issue? Thank you."}' \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
# 整合所有的output为一个文件夹
collect-artifacts:
collect-artifacts1:
needs: build
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' #排除Pull request
if: ${{github.event_name != 'pull_request' && github.event.inputs.output_contral == 'attachconfig'}}
steps:
#这里会下载所有产物
- name: Download all artifacts
Expand All @@ -264,4 +280,21 @@ jobs:
uses: actions/upload-artifact@main
with:
name: 00_all_bsp_output_${{ github.sha }}
path: output/
path: output/
collect-artifacts2:
needs: build
runs-on: ubuntu-latest
if: ${{github.event_name != 'pull_request' && github.event.inputs.output_contral == 'versionconfig'}}
steps:
- name: Download all artifacts
uses: actions/download-artifact@main
with:
path: version_output/
merge-multiple: true
- run: ls -R version_output/

- name: Upload combined output as artifact
uses: actions/upload-artifact@main
with:
name: 00_all_bsp_output_${{ github.sha }}
path: version_output/
15 changes: 15 additions & 0 deletions bsp/stm32/stm32f407-rt-spark/.ci/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from building import *
import os

cwd = GetCurrentDir()
src = []
CPPPATH = [cwd]

group = DefineGroup('Versionconfig', src, depend = [''], CPPPATH = CPPPATH)

list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))

Return('group')
15 changes: 15 additions & 0 deletions bsp/stm32/stm32f407-rt-spark/.ci/versionconfig/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from building import *
import os

cwd = GetCurrentDir()
src = []
CPPPATH = [cwd]

group = DefineGroup('Versionconfig', src, depend = [''], CPPPATH = CPPPATH)

list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))

Return('group')
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from building import *
import os

cwd = GetCurrentDir()
src = []
CPPPATH = [cwd]

if GetDepend(['VERSIONCONFIG_USING_AHT21_SAMPLE']):
src += ['peripheral_aht21.c']

if GetDepend(['VERSIONCONFIG_USING_ICM20608_SAMPLE']):
src += ['peripheral_icm20608.c']

group = DefineGroup('Versionconfig', src, depend = [''], CPPPATH = CPPPATH)

Return('group')
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-07-23 Wangyuqiang the first version
* 2024-04-03 Hydevcode
*/

#include <rtthread.h>
#include <rtdevice.h>
#include "aht10.h"

static void aht10_entry(void *parameter)
{
float humidity, temperature;
aht10_device_t dev;

const char *i2c_bus_name = "i2c3";
int count = 0;

rt_thread_mdelay(2000);

dev = aht10_init(i2c_bus_name);
if (dev == RT_NULL)
{
rt_kprintf("The sensor initializes failure");
}

rt_kprintf("AHT10 has been initialized!");

while (1)
{
humidity = aht10_read_humidity(dev);
rt_kprintf("Humidity : %d.%d %%", (int)humidity, (int)(humidity * 10) % 10);

temperature = aht10_read_temperature(dev);
rt_kprintf("Temperature: %d.%d", (int)temperature, (int)(temperature * 10) % 10);

rt_thread_mdelay(1000);
}

}

int aht10_thread_port(void)
{
rt_thread_t res = rt_thread_create("aht10", aht10_entry, RT_NULL, 1024, 20, 50);
if(res == RT_NULL)
{
rt_kprintf("aht10 thread create failed!");
return -RT_ERROR;
}

rt_thread_startup(res);

return RT_EOK;
}
INIT_DEVICE_EXPORT(aht10_thread_port);
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-04-03 Hydevcode the first version
*/

#include <rtthread.h>
#include <rtdevice.h>
#include "icm20608.h"

static void icm20608_entry(void *parameter)
{
icm20608_device_t dev = RT_NULL;
rt_int16_t x, y, z;
rt_uint32_t i;

const char *i2c_bus_name = "i2c2";
int count = 0;

rt_thread_mdelay(2000);

dev = icm20608_init(i2c_bus_name);
if (dev == RT_NULL)
{
rt_kprintf("The sensor initializes failure");
}

rt_kprintf("ICM20608 has been initialized!");

while (1)
{
/* read the sensor digital output */
icm20608_get_accel(dev, &x, &y, &z);

rt_kprintf("accelerometer: X%6d Y%6d Z%6d\n", x, y, z);

icm20608_get_gyro(dev, &x, &y, &z);

rt_kprintf("gyroscope : X%6d Y%6d Z%6d\n", x, y, z);

rt_thread_mdelay(1000);
}

}

int icm20608_thread_port(void)
{
rt_thread_t res = rt_thread_create("icm20608", icm20608_entry, RT_NULL, 1024, 20, 50);
if(res == RT_NULL)
{
rt_kprintf("icm20608 thread create failed!");
return -RT_ERROR;
}

rt_thread_startup(res);

return RT_EOK;
}
INIT_DEVICE_EXPORT(icm20608_thread_port);
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
scons.args: &scons
scons_arg:
- '--strict'
# ------ peripheral CI ------
peripheral.aht21:
kconfig:
- CONFIG_BSP_USING_AHT21=y
- CONFIG_VERSIONCONFIG_USING_AHT21_SAMPLE=y
peripheral.icm20608:
kconfig:
- CONFIG_BSP_USING_ICM20608=y
- CONFIG_VERSIONCONFIG_USING_ICM20608_SAMPLE=y
5 changes: 2 additions & 3 deletions bsp/stm32/stm32f407-rt-spark/board/SConscript
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
from building import *

cwd = GetCurrentDir()

# add general drivers
Expand All @@ -11,8 +10,8 @@ CubeMX_Config/Src/stm32f4xx_hal_msp.c
path = [cwd]
path += [os.path.join(cwd, 'CubeMX_Config', 'Inc')]

CPPDEFINES = ['STM32F407xx']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)

# if os.path.isfile(os.path.join(cwd, "ports", 'SConscript')):
# group = group + SConscript(os.path.join("ports", 'SConscript'))
Expand Down
Loading