Skip to content

Commit db1e326

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

File tree

11 files changed

+557
-3
lines changed

11 files changed

+557
-3
lines changed

.github/PART_BSP_COMPILE.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (c) 2025, RT-Thread Development Team
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
//
5+
// Change Logs:
6+
// Date Author Notes
7+
// 2025-04-2 Hydevcode 重点看护ci列表
8+
//
9+
{
10+
"legs": [
11+
{
12+
"RTT_BSP": "RT-Thread Online Packages (STM32F407 RT-Spark)",
13+
"RTT_TOOL_CHAIN": "sourcery-arm",
14+
"SUB_RTT_BSP": [
15+
"stm32/stm32f407-rt-spark"
16+
]
17+
},
18+
{
19+
"RTT_BSP": "stm32h750-artpi",
20+
"RTT_TOOL_CHAIN": "sourcery-arm",
21+
"SUB_RTT_BSP": [
22+
"stm32/stm32h750-artpi"
23+
]
24+
},
25+
{
26+
"RTT_BSP": "renesas",
27+
"RTT_TOOL_CHAIN": "sourcery-arm",
28+
"SUB_RTT_BSP": [
29+
"renesas/ra6m3-hmi-board",
30+
"renesas/ra8d1-vision-board"
31+
]
32+
},
33+
{
34+
"RTT_BSP": "Infineon",
35+
"RTT_TOOL_CHAIN": "sourcery-arm",
36+
"SUB_RTT_BSP": [
37+
"Infineon/psoc6-cy8ckit-062S2-43012",
38+
"Infineon/psoc6-cy8ckit-062-BLE",
39+
"Infineon/psoc6-cy8ckit-062s4",
40+
"Infineon/psoc6-cy8ckit-062-WIFI-BT",
41+
"Infineon/psoc6-cy8cproto-062S3-4343W",
42+
"Infineon/psoc6-evaluationkit-062S2"
43+
]
44+
}
45+
]
46+
}
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
#
2+
# Copyright (c) 2025, RT-Thread Development Team
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Change Logs:
7+
# Date Author Notes
8+
# 2025-03-22 Supperthomas 添加upload 上传编译固件
9+
# 2025-04-03 Hydevcode 自动生成attach的产物
10+
#
11+
# 1.读取重点看护表
12+
# 2.生成矩阵
13+
# 3.编译对应bsp
14+
# 4.调用对应的attach的python编译
15+
# 5.生成产物
16+
name: Auto Version Attach Generate
17+
18+
on:
19+
workflow_dispatch:
20+
21+
jobs:
22+
generate-matrix:
23+
runs-on: ubuntu-22.04
24+
outputs:
25+
matrix: ${{ steps.read-config.outputs.matrix }}
26+
steps:
27+
- name: Checkout repo
28+
uses: actions/checkout@v4
29+
with:
30+
ref: master
31+
sparse-checkout: .github/PART_BSP_COMPILE.json
32+
persist-credentials: false
33+
- name: Read matrix config
34+
id: read-config
35+
run: |
36+
raw_matrix=$(cat .github/PART_BSP_COMPILE.json |egrep -v '^//')
37+
FILTER_CONDITION='.legs[]'
38+
matrix=$(jq -c "{legs: [$FILTER_CONDITION]}" <<< "$raw_matrix")
39+
echo "matrix=$matrix" >> $GITHUB_OUTPUT
40+
build:
41+
runs-on: ubuntu-22.04
42+
needs: generate-matrix
43+
name: ${{ matrix.legs.RTT_BSP }}
44+
strategy:
45+
fail-fast: false
46+
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
47+
steps:
48+
- uses: actions/checkout@v4
49+
- name: Set up Python
50+
uses: actions/setup-python@main
51+
with:
52+
python-version: 3.8
53+
54+
- name: Install Tools
55+
shell: bash
56+
run: |
57+
wget https://raw.githubusercontent.com/RT-Thread/env/master/install_ubuntu.sh
58+
chmod 777 install_ubuntu.sh
59+
./install_ubuntu.sh
60+
pip install -r tools/requirements.txt
61+
git config --global http.postBuffer 524288000
62+
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
63+
echo "RTT_CC=gcc" >> $GITHUB_ENV
64+
echo "export PATH=~/.env/tools/scripts:$PATH" > ~/.env/env.sh
65+
66+
- name: Cache GCC Arm Toolchain
67+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm'}}
68+
id: cache-gcc-arm
69+
uses: actions/cache@main
70+
with:
71+
path: /opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi
72+
key: ${{ runner.os }}-arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi
73+
74+
- name: Download Arm ToolChains
75+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm' && (steps.cache-gcc-arm.outputs.cache-hit != 'true') }}
76+
shell: bash
77+
run: |
78+
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
79+
sudo tar -xf arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz -C /opt
80+
81+
- name: Install Arm ToolChains2
82+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm'}}
83+
shell: bash
84+
run: |
85+
/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc --version
86+
echo "RTT_EXEC_PATH=/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin" >> $GITHUB_ENV
87+
88+
- name: Install LLVM-Arm ToolChains
89+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'llvm-arm' && success() }}
90+
shell: bash
91+
run: |
92+
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
93+
sudo tar zxf LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64.tar.gz -C /opt
94+
sudo apt-get -qq install libncurses5 libncurses5-dev libncursesw5-dev
95+
/opt/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64/bin/clang --version
96+
echo "RTT_CC=llvm-arm" >> $GITHUB_ENV
97+
echo "RTT_EXEC_PATH=/opt/LLVMEmbeddedToolchainForArm-16.0.0-Linux-x86_64/bin" >> $GITHUB_ENV
98+
99+
- name: Install AArch64 ToolChains
100+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-aarch64' && success() }}
101+
shell: bash
102+
run: |
103+
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
104+
sudo tar -xf gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz -C /opt
105+
/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc --version
106+
echo "RTT_EXEC_PATH=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin" >> $GITHUB_ENV
107+
108+
- name: Install Mips ToolChains
109+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-mips' && success() }}
110+
shell: bash
111+
run: |
112+
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
113+
sudo tar xjf mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 -C /opt
114+
/opt/mips-2016.05/bin/mips-sde-elf-gcc --version
115+
echo "RTT_EXEC_PATH=/opt/mips-2016.05/bin" >> $GITHUB_ENV
116+
117+
- name: Install Riscv64-unknown-elf ToolChains
118+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-riscv64-unknown-elf' && success() }}
119+
run: |
120+
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
121+
sudo tar zxf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz -C /opt
122+
/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version
123+
echo "RTT_EXEC_PATH=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin" >> $GITHUB_ENV
124+
125+
- name: Install riscv32-unknown-elf Toolchains
126+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'RISC-V-GCC-RV32' && success() }}
127+
run: |
128+
wget -q https://github.com/hpmicro/riscv-gnu-toolchain/releases/download/2022.05.15/riscv32-unknown-elf-newlib-multilib_2022.05.15_linux.tar.gz
129+
sudo tar zxf riscv32-unknown-elf-newlib-multilib_2022.05.15_linux.tar.gz -C /opt
130+
/opt/riscv32-unknown-elf-newlib-multilib/bin/riscv32-unknown-elf-gcc --version
131+
echo "RTT_EXEC_PATH=/opt/riscv32-unknown-elf-newlib-multilib/bin/" >> $GITHUB_ENV
132+
133+
- name: Install Riscv-none-embed ToolChains
134+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-riscv-none-embed' && success() }}
135+
run: |
136+
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
137+
sudo tar zxf xpack-riscv-none-embed-gcc-8.3.0-2.3-linux-x64.tar.gz -C /opt
138+
/opt/xpack-riscv-none-embed-gcc-8.3.0-2.3/bin/riscv-none-embed-gcc --version
139+
echo "RTT_EXEC_PATH=/opt/xpack-riscv-none-embed-gcc-8.3.0-2.3/bin" >> $GITHUB_ENV
140+
141+
- name: Install riscv32-esp-elf ToolChains
142+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-riscv32-esp32' && success() }}
143+
run: |
144+
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
145+
sudo tar xf riscv32-esp-elf-gcc11_2_0-esp-2022r1-RC1-linux-amd64.tar.xz -C /opt
146+
/opt/riscv32-esp-elf/bin/riscv32-esp-elf-gcc --version
147+
pip3 install esptool
148+
echo "RTT_EXEC_PATH=/opt/riscv32-esp-elf/bin" >> $GITHUB_ENV
149+
150+
- name: Install Simulator Tools
151+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'gcc' && success() }}
152+
run: |
153+
sudo apt-get -qq install libsdl2-dev
154+
155+
- name: Install i386-unknown-elf Tools
156+
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-i386-unknown-elf' && success() }}
157+
run: |
158+
wget -q https://github.com/zhkag/toolchains/releases/download/i386-unknown/i386-unknown-elf_for_x86_64-pc-linux-gnu_latest.tar.bz2
159+
sudo tar -jxvf i386-unknown-elf_for_x86_64-pc-linux-gnu_latest.tar.bz2 -C /opt
160+
/opt/i386-unknown-elf_for_x86_64-pc-linux-gnu/bin/i386-unknown-elf-gcc --version
161+
echo "RTT_EXEC_PATH=/opt/i386-unknown-elf_for_x86_64-pc-linux-gnu/bin" >> $GITHUB_ENV
162+
- name: Bsp Scons Compile
163+
if: ${{ success() }}
164+
shell: bash
165+
env:
166+
RTT_BSP: ${{ matrix.legs.RTT_BSP }}
167+
RTT_TOOL_CHAIN: ${{ matrix.legs.RTT_TOOL_CHAIN }}
168+
SRTT_BSP: ${{ join(matrix.legs.SUB_RTT_BSP, ',') }}
169+
run: |
170+
source ~/.env/env.sh
171+
python tools/ci/bsp_buildings.py
172+
- name: Upload output as artifact
173+
if: ${{ success() }}
174+
uses: actions/upload-artifact@main
175+
with:
176+
name: ${{ matrix.legs.RTT_BSP }}
177+
if-no-files-found: ignore
178+
path: version_output/
179+
# 整合所有的output为一个文件夹
180+
collect-artifacts:
181+
needs: build
182+
runs-on: ubuntu-latest
183+
steps:
184+
#这里会下载所有产物
185+
- name: Download all artifacts
186+
uses: actions/download-artifact@main
187+
with:
188+
path: version_output/
189+
merge-multiple: true
190+
- run: ls -R version_output/
191+
192+
- name: Upload combined output as artifact
193+
uses: actions/upload-artifact@main
194+
with:
195+
name: 00_all_bsp_output_${{ github.sha }}
196+
path: version_output/
Lines changed: 15 additions & 0 deletions
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')

bsp/stm32/stm32f407-rt-spark/.ci/attachconfig/ci.attachconfig.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ online-packages.ai.llmchat:
158158
peripheral.aht21:
159159
kconfig:
160160
- CONFIG_BSP_USING_AHT21=y
161+
- CONFIG_VERSIONCONFIG_USING_AHT21_SAMPLE=y
161162
peripheral.ap3216c:
162163
kconfig:
163164
- CONFIG_BSP_USING_AP3216C=y
Lines changed: 15 additions & 0 deletions
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')
Lines changed: 16 additions & 0 deletions
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')
Lines changed: 60 additions & 0 deletions
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);

0 commit comments

Comments
 (0)