Skip to content

Commit 757baf8

Browse files
committed
[action/ci] 根据看护产品,结合版本versionconfig ci自动生成版本测试产物
1 parent f422b6a commit 757baf8

File tree

9 files changed

+360
-16
lines changed

9 files changed

+360
-16
lines changed

.github/workflows/bsp_buildings.yml

+38-5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ on:
3434
types:
3535
- online-pkgs-static-building-trigger-event
3636
workflow_dispatch:
37+
inputs:
38+
output_contral:
39+
description: 'Output Contral'
40+
required: false
41+
default: 'attachconfig'
42+
type: choice
43+
options:
44+
- "attachconfig"
45+
- "versionconfig"
3746

3847
permissions:
3948
contents: read # to fetch code (actions/checkout)
@@ -101,7 +110,6 @@ jobs:
101110
runs-on: ubuntu-22.04
102111
needs: generate-matrix
103112
name: ${{ matrix.legs.RTT_BSP }}
104-
if: github.repository_owner == 'RT-Thread'
105113
strategy:
106114
fail-fast: false
107115
matrix: ${{ fromJson(needs.generate-matrix.outputs.filtered_matrix) }}
@@ -233,24 +241,32 @@ jobs:
233241
python tools/ci/bsp_buildings.py
234242
235243
- name: Upload output as artifact
236-
if: ${{ success() }}
244+
if: ${{ success() && github.event.inputs.output_contral == 'attachconfig' }}
237245
uses: actions/upload-artifact@main
238246
with:
239247
name: ${{ matrix.legs.RTT_BSP }}
240248
if-no-files-found: ignore
241249
path: output/
242250

251+
- name: Upload output as artifact
252+
if: ${{ success() && github.event.inputs.output_contral == 'versionconfig'}}
253+
uses: actions/upload-artifact@main
254+
with:
255+
name: ${{ matrix.legs.RTT_BSP }}
256+
if-no-files-found: ignore
257+
path: version_output/
258+
243259
- name: Post failure comment
244260
if: failure()
245261
run: |
246262
curl -X POST -H "Authorization: token ${{ secrets.RTTHREAD_GITHUB_TOKEN }}" \
247263
-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."}' \
248264
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
249265
# 整合所有的output为一个文件夹
250-
collect-artifacts:
266+
collect-artifacts1:
251267
needs: build
252268
runs-on: ubuntu-latest
253-
if: github.event_name != 'pull_request' #排除Pull request
269+
if: ${{github.event_name != 'pull_request' && github.event.inputs.output_contral == 'attachconfig'}}
254270
steps:
255271
#这里会下载所有产物
256272
- name: Download all artifacts
@@ -264,4 +280,21 @@ jobs:
264280
uses: actions/upload-artifact@main
265281
with:
266282
name: 00_all_bsp_output_${{ github.sha }}
267-
path: output/
283+
path: output/
284+
collect-artifacts2:
285+
needs: build
286+
runs-on: ubuntu-latest
287+
if: ${{github.event_name != 'pull_request' && github.event.inputs.output_contral == 'versionconfig'}}
288+
steps:
289+
- name: Download all artifacts
290+
uses: actions/download-artifact@main
291+
with:
292+
path: version_output/
293+
merge-multiple: true
294+
- run: ls -R version_output/
295+
296+
- name: Upload combined output as artifact
297+
uses: actions/upload-artifact@main
298+
with:
299+
name: 00_all_bsp_output_${{ github.sha }}
300+
path: version_output/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from building import *
2+
import os
3+
4+
cwd = GetCurrentDir()
5+
src = []
6+
CPPPATH = [cwd]
7+
8+
group = DefineGroup('Versionconfig', src, depend = [''], CPPPATH = CPPPATH)
9+
10+
list = os.listdir(cwd)
11+
for item in list:
12+
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
13+
group = group + SConscript(os.path.join(item, 'SConscript'))
14+
15+
Return('group')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from building import *
2+
import os
3+
4+
cwd = GetCurrentDir()
5+
src = []
6+
CPPPATH = [cwd]
7+
8+
group = DefineGroup('Versionconfig', src, depend = [''], CPPPATH = CPPPATH)
9+
10+
list = os.listdir(cwd)
11+
for item in list:
12+
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
13+
group = group + SConscript(os.path.join(item, 'SConscript'))
14+
15+
Return('group')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from building import *
2+
import os
3+
4+
cwd = GetCurrentDir()
5+
src = []
6+
CPPPATH = [cwd]
7+
8+
if GetDepend(['VERSIONCONFIG_USING_AHT21_SAMPLE']):
9+
src += ['peripheral_aht21.c']
10+
11+
if GetDepend(['VERSIONCONFIG_USING_ICM20608_SAMPLE']):
12+
src += ['peripheral_icm20608.c']
13+
14+
group = DefineGroup('Versionconfig', src, depend = [''], CPPPATH = CPPPATH)
15+
16+
Return('group')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) 2006-2024, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2024-07-23 Wangyuqiang the first version
9+
* 2024-04-03 Hydevcode
10+
*/
11+
12+
#include <rtthread.h>
13+
#include <rtdevice.h>
14+
#include "aht10.h"
15+
16+
static void aht10_entry(void *parameter)
17+
{
18+
float humidity, temperature;
19+
aht10_device_t dev;
20+
21+
const char *i2c_bus_name = "i2c3";
22+
int count = 0;
23+
24+
rt_thread_mdelay(2000);
25+
26+
dev = aht10_init(i2c_bus_name);
27+
if (dev == RT_NULL)
28+
{
29+
rt_kprintf("The sensor initializes failure");
30+
}
31+
32+
rt_kprintf("AHT10 has been initialized!");
33+
34+
while (1)
35+
{
36+
humidity = aht10_read_humidity(dev);
37+
rt_kprintf("Humidity : %d.%d %%", (int)humidity, (int)(humidity * 10) % 10);
38+
39+
temperature = aht10_read_temperature(dev);
40+
rt_kprintf("Temperature: %d.%d", (int)temperature, (int)(temperature * 10) % 10);
41+
42+
rt_thread_mdelay(1000);
43+
}
44+
45+
}
46+
47+
int aht10_thread_port(void)
48+
{
49+
rt_thread_t res = rt_thread_create("aht10", aht10_entry, RT_NULL, 1024, 20, 50);
50+
if(res == RT_NULL)
51+
{
52+
rt_kprintf("aht10 thread create failed!");
53+
return -RT_ERROR;
54+
}
55+
56+
rt_thread_startup(res);
57+
58+
return RT_EOK;
59+
}
60+
INIT_DEVICE_EXPORT(aht10_thread_port);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (c) 2006-2024, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2024-04-03 Hydevcode the first version
9+
*/
10+
11+
#include <rtthread.h>
12+
#include <rtdevice.h>
13+
#include "icm20608.h"
14+
15+
static void icm20608_entry(void *parameter)
16+
{
17+
icm20608_device_t dev = RT_NULL;
18+
rt_int16_t x, y, z;
19+
rt_uint32_t i;
20+
21+
const char *i2c_bus_name = "i2c2";
22+
int count = 0;
23+
24+
rt_thread_mdelay(2000);
25+
26+
dev = icm20608_init(i2c_bus_name);
27+
if (dev == RT_NULL)
28+
{
29+
rt_kprintf("The sensor initializes failure");
30+
}
31+
32+
rt_kprintf("ICM20608 has been initialized!");
33+
34+
while (1)
35+
{
36+
/* read the sensor digital output */
37+
icm20608_get_accel(dev, &x, &y, &z);
38+
39+
rt_kprintf("accelerometer: X%6d Y%6d Z%6d\n", x, y, z);
40+
41+
icm20608_get_gyro(dev, &x, &y, &z);
42+
43+
rt_kprintf("gyroscope : X%6d Y%6d Z%6d\n", x, y, z);
44+
45+
rt_thread_mdelay(1000);
46+
}
47+
48+
}
49+
50+
int icm20608_thread_port(void)
51+
{
52+
rt_thread_t res = rt_thread_create("icm20608", icm20608_entry, RT_NULL, 1024, 20, 50);
53+
if(res == RT_NULL)
54+
{
55+
rt_kprintf("icm20608 thread create failed!");
56+
return -RT_ERROR;
57+
}
58+
59+
rt_thread_startup(res);
60+
61+
return RT_EOK;
62+
}
63+
INIT_DEVICE_EXPORT(icm20608_thread_port);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
scons.args: &scons
2+
scons_arg:
3+
- '--strict'
4+
# ------ peripheral CI ------
5+
peripheral.aht21:
6+
kconfig:
7+
- CONFIG_BSP_USING_AHT21=y
8+
- CONFIG_VERSIONCONFIG_USING_AHT21_SAMPLE=y
9+
peripheral.icm20608:
10+
kconfig:
11+
- CONFIG_BSP_USING_ICM20608=y
12+
- CONFIG_VERSIONCONFIG_USING_ICM20608_SAMPLE=y

bsp/stm32/stm32f407-rt-spark/board/SConscript

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
from building import *
3-
43
cwd = GetCurrentDir()
54

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

14-
CPPDEFINES = ['STM32F407xx']
15-
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
13+
14+
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
1615

1716
# if os.path.isfile(os.path.join(cwd, "ports", 'SConscript')):
1817
# group = group + SConscript(os.path.join("ports", 'SConscript'))

0 commit comments

Comments
 (0)