Skip to content

Commit 1a3d787

Browse files
committed
ci(runner): Flash and run builded examples to BSP Wall Runner
1 parent 70a95af commit 1a3d787

File tree

12 files changed

+320
-77
lines changed

12 files changed

+320
-77
lines changed

.github/PULL_REQUEST_TEMPLATE/pr_template_bsp.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [ ] BSP was [added to SquareLine](https://github.com/espressif/esp-bsp/tree/master/SquareLine/common)
1111
- [ ] New BSP supports IDF v4.4.x and later releases
1212
- [ ] _Optional:_ Component contains unit tests
13+
- [ ] _Optional:_ BSP was added to Runner ([pytest.ini](pytest.ini), [conftest.py](conftest.py), [build-run-applications.yml](.github/workflows/build-run-applications.yml))
1314
- [ ] CI passing
1415

1516
# Change description

.github/workflows/build-applications.yml

Lines changed: 0 additions & 76 deletions
This file was deleted.
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
name: Build ESP-BSP apps
2+
3+
# This job builds all examples and test_applications in this repo
4+
# Applications are selected for build based on changes files and dependencies defined in .build-test-rules.yml
5+
6+
on:
7+
pull_request:
8+
types: [opened, reopened, synchronize]
9+
10+
jobs:
11+
build:
12+
strategy:
13+
matrix:
14+
include:
15+
- idf_ver: "latest"
16+
parallel_count: 5
17+
parallel_index: 1
18+
- idf_ver: "latest"
19+
parallel_count: 5
20+
parallel_index: 2
21+
- idf_ver: "latest"
22+
parallel_count: 5
23+
parallel_index: 3
24+
- idf_ver: "latest"
25+
parallel_count: 5
26+
parallel_index: 4
27+
- idf_ver: "latest"
28+
parallel_count: 5
29+
parallel_index: 5
30+
- idf_ver: "release-v5.1"
31+
parallel_count: 2
32+
parallel_index: 1
33+
- idf_ver: "release-v5.1"
34+
parallel_count: 2
35+
parallel_index: 2
36+
- idf_ver: "release-v5.2"
37+
parallel_count: 2
38+
parallel_index: 1
39+
- idf_ver: "release-v5.2"
40+
parallel_count: 2
41+
parallel_index: 2
42+
- idf_ver: "release-v5.3"
43+
parallel_count: 2
44+
parallel_index: 1
45+
- idf_ver: "release-v5.3"
46+
parallel_count: 2
47+
parallel_index: 2
48+
- idf_ver: "release-v5.4"
49+
parallel_count: 2
50+
parallel_index: 1
51+
- idf_ver: "release-v5.4"
52+
parallel_count: 2
53+
parallel_index: 2
54+
runs-on: ubuntu-latest
55+
container: espressif/idf:${{ matrix.idf_ver }}
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- name: Get changed files
60+
id: changed-files
61+
uses: tj-actions/changed-files@v45
62+
with:
63+
separator: ';' # idf-build-apps expects files seprated with semicolon
64+
65+
- name: Build ESP-BSP applications
66+
shell: bash
67+
env:
68+
IDF_EXTRA_ACTIONS_PATH: "${{ github.workspace }}/examples"
69+
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_modified_files }}
70+
run: |
71+
. ${IDF_PATH}/export.sh
72+
pip install idf-component-manager==1.* ruamel.yaml idf-build-apps==2.4.3 --upgrade
73+
74+
echo "Files changed: ${ALL_CHANGED_FILES}"
75+
idf-build-apps find --modified-files "${ALL_CHANGED_FILES}"
76+
idf-build-apps build --parallel-count ${{ matrix.parallel_count }} --parallel-index ${{ matrix.parallel_index }} --modified-files "${ALL_CHANGED_FILES}" --collect-app-info build_info_${{ matrix.idf_ver }}_${{ matrix.parallel_index }}.json
77+
78+
- uses: actions/upload-artifact@v4
79+
if: github.repository_owner == 'espressif' && needs.prepare.outputs.build_only == '0'
80+
with:
81+
name: app_binaries_${{ matrix.idf_ver }}_${{ matrix.parallel_index }}
82+
path: |
83+
examples/*/build_*/bootloader/bootloader.bin
84+
examples/*/build_*/partition_table/partition-table.bin
85+
examples/*/build_*/*.bin
86+
examples/*/build_*/flasher_args.json
87+
examples/*/build_*/config/sdkconfig.json
88+
build_info*.json
89+
90+
run-target:
91+
name: Run apps
92+
if: github.repository_owner == 'espressif' && needs.prepare.outputs.build_only != '1'
93+
needs: build
94+
strategy:
95+
fail-fast: false
96+
max-parallel: 5
97+
matrix:
98+
idf_ver:
99+
- "latest"
100+
runner:
101+
- runs-on: "esp-box-3"
102+
marker: "esp_box_3"
103+
target: "esp32s3"
104+
- runs-on: "esp32_c3_lcdkit"
105+
marker: "esp32_c3_lcdkit"
106+
target: "esp32c3"
107+
- runs-on: "esp32_p4_box"
108+
marker: "esp32_p4_box"
109+
target: "esp32p4"
110+
- runs-on: "esp32_p4_function_ev_board"
111+
marker: "esp32_p4_function_ev_board"
112+
target: "esp32p4"
113+
- runs-on: "esp32_s3_eye"
114+
marker: "esp32_s3_eye"
115+
target: "esp32s3"
116+
- runs-on: "esp32_s3_lcd_ev_board"
117+
marker: "esp32_s3_lcd_ev_board"
118+
target: "esp32s3"
119+
- runs-on: "esp32_s3_lcd_ev_board"
120+
marker: "esp32_s3_lcd_ev_board_2"
121+
target: "esp32s3"
122+
- runs-on: "esp32_s3_usb_otg"
123+
marker: "esp32_s3_usb_otg"
124+
target: "esp32s3"
125+
- runs-on: "esp_wrover_kit"
126+
marker: "esp_wrover_kit"
127+
target: "esp32"
128+
- runs-on: "m5dial"
129+
marker: "m5dial"
130+
target: "esp32s3"
131+
- runs-on: "m5stack_core"
132+
marker: "m5stack_core"
133+
target: "esp32"
134+
- runs-on: "m5stack_core_2"
135+
marker: "m5stack_core_2"
136+
target: "esp32"
137+
- runs-on: "m5stack_core_s3"
138+
marker: "m5stack_core_s3"
139+
target: "esp32s3"
140+
- runs-on: "m5stack_core_s3"
141+
marker: "m5stack_core_s3_se"
142+
target: "esp32s3"
143+
- runs-on: "esp32_azure_iot_kit"
144+
marker: "esp32_azure_iot_kit"
145+
target: "esp32"
146+
env:
147+
TEST_RESULT_NAME: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }}
148+
TEST_RESULT_FILE: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }}.xml
149+
runs-on: [self-hosted, Linux, bspwall]
150+
container:
151+
image: python:3.11-bookworm
152+
options: --privileged -v /dev/boards:/dev/boards/ # Privileged mode has access to serial ports
153+
steps:
154+
- uses: actions/checkout@v4
155+
- uses: actions/download-artifact@v4
156+
with:
157+
pattern: app_binaries_${{ matrix.idf_ver }}_*
158+
merge-multiple: true
159+
- name: Install Python packages
160+
env:
161+
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/"
162+
run: pip install --prefer-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pytest-custom_exit_code
163+
- name: Run apps
164+
run: |
165+
pytest --suppress-no-test-exit-code --ignore-glob '*/managed_components/*' --ignore=.github --junit-xml=${{ env.TEST_RESULT_FILE }} --target=${{ matrix.runner.target }} -m ${{ matrix.runner.marker }} --build-dir=build_${{ matrix.runner.runs-on }}
166+
- name: Upload test results
167+
uses: actions/upload-artifact@v4
168+
if: always()
169+
with:
170+
name: ${{ env.TEST_RESULT_NAME }}
171+
path: ${{ env.TEST_RESULT_FILE }}
172+
173+
publish-results:
174+
name: Publish Test results
175+
needs:
176+
- run-target
177+
if: github.repository_owner == 'espressif' && always() && github.event_name == 'pull_request' && needs.prepare.outputs.build_only == '0'
178+
runs-on: ubuntu-22.04
179+
steps:
180+
- name: Download Test results
181+
uses: actions/download-artifact@v4
182+
with:
183+
pattern: test_results_*
184+
path: test_results
185+
- name: Publish Test Results
186+
uses: EnricoMi/publish-unit-test-result-action@v2
187+
with:
188+
files: test_results/**/*.xml

conftest.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
# SPDX-License-Identifier: Apache-2.0
3+
import pytest
4+
5+
6+
def pytest_generate_tests(metafunc):
7+
# If test expects param 'port' or 'flash_port', add parametrize
8+
if 'port' in metafunc.fixturenames and 'flash_port' in metafunc.fixturenames:
9+
metafunc.parametrize(
10+
'port, flash_port',
11+
[
12+
pytest.param('/dev/boards/esp-box-3', '/dev/boards/esp-box-3', id='esp_box_3'),
13+
pytest.param('/dev/boards/esp32_c3_lcdkit', '/dev/boards/esp32_c3_lcdkit', id='esp32_c3_lcdkit'),
14+
pytest.param('/dev/boards/esp32_p4_box', '/dev/boards/esp32_p4_box', id='esp32_p4_box'),
15+
pytest.param('/dev/boards/esp32_p4_function_ev_board', '/dev/boards/esp32_p4_function_ev_board', id='esp32_p4_function_ev_board'),
16+
pytest.param('/dev/boards/esp32_s3_eye', '/dev/boards/esp32_s3_eye', id='esp32_s3_eye'),
17+
pytest.param('/dev/boards/esp32_s3_lcd_ev_board', '/dev/boards/esp32_s3_lcd_ev_board', id='esp32_s3_lcd_ev_board'),
18+
pytest.param('/dev/boards/esp32_s3_lcd_ev_board-2', '/dev/boards/esp32_s3_lcd_ev_board-2', id='esp32_s3_lcd_ev_board_2'),
19+
pytest.param('/dev/boards/esp32_s3_usb_otg', '/dev/boards/esp32_s3_usb_otg', id='esp32_s3_usb_otg'),
20+
pytest.param('/dev/boards/esp_wrover_kit', '/dev/boards/esp_wrover_kit', id='esp_wrover_kit'),
21+
pytest.param('/dev/boards/esp32_azure_iot_kit', '/dev/boards/esp32_azure_iot_kit', id='esp32_azure_iot_kit'),
22+
pytest.param('/dev/boards/m5dial', '/dev/boards/m5dial', id='m5dial'),
23+
pytest.param('/dev/boards/m5stack_core', '/dev/boards/m5stack_core', id='m5stack_core'),
24+
pytest.param('/dev/boards/m5stack_core_2', '/dev/boards/m5stack_core_2', id='m5stack_core_2'),
25+
pytest.param('/dev/boards/m5stack_core_s3', '/dev/boards/m5stack_core_s3', id='m5stack_core_s3'),
26+
pytest.param('/dev/boards/m5stack_core_s3_se', '/dev/boards/m5stack_core_s3_se', id='m5stack_core_s3_se'),
27+
]
28+
)
29+
30+
31+
# Check marker with params and test ID
32+
def pytest_collection_modifyitems(config, items):
33+
for item in items:
34+
marker_option = "[" + config.getoption("-m") + "]"
35+
if marker_option not in item.nodeid:
36+
item.add_marker(pytest.mark.skip(reason="Not for selected params"))

examples/display/pytest_display.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
import pytest
5+
from pytest_embedded import Dut
6+
7+
8+
@pytest.mark.esp_box_3
9+
@pytest.mark.esp32_p4_function_ev_board
10+
@pytest.mark.esp32_c3_lcdkit
11+
@pytest.mark.esp32_s3_eye
12+
@pytest.mark.esp32_s3_lcd_ev_board
13+
@pytest.mark.esp32_s3_lcd_ev_board_2
14+
@pytest.mark.esp32_s3_usb_otg
15+
@pytest.mark.esp_wrover_kit
16+
@pytest.mark.m5dial
17+
@pytest.mark.m5stack_core
18+
@pytest.mark.m5stack_core_2
19+
@pytest.mark.m5stack_core_s3
20+
@pytest.mark.m5stack_core_s3_se
21+
def test_display_example(dut: Dut) -> None:
22+
dut.expect_exact('example: Display LVGL animation')
23+
dut.expect_exact('main_task: Returned from app_main()')

examples/display/sdkconfig.bsp.m5stack_core_2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
CONFIG_IDF_TARGET="esp32"
55
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
66
CONFIG_ESP_DEFAULT_CPU_FREQ_240=y
7+
CONFIG_BSP_PMU_AXP2101=y
78

89
## LVGL8 ##
910
CONFIG_LV_USE_PERF_MONITOR=y

examples/display_audio_photo/sdkconfig.bsp.m5stack_core_2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
33
#
44
CONFIG_IDF_TARGET="esp32"
5+
CONFIG_BSP_PMU_AXP2101=y
56
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
67
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
78
CONFIG_PARTITION_TABLE_CUSTOM=y
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
import pytest
5+
from pytest_embedded import Dut
6+
7+
8+
@pytest.mark.esp_box_3
9+
@pytest.mark.esp32_p4_function_ev_board
10+
@pytest.mark.esp32_s3_eye
11+
@pytest.mark.esp32_s3_lcd_ev_board
12+
@pytest.mark.esp32_s3_lcd_ev_board_2
13+
@pytest.mark.m5dial
14+
@pytest.mark.m5stack_core_s3
15+
@pytest.mark.m5stack_core_s3_se
16+
def test_display_example(dut: Dut) -> None:
17+
dut.expect_exact('app_main: Display LVGL demo')
18+
dut.expect_exact('main_task: Returned from app_main()')

examples/display_lvgl_demos/sdkconfig.bsp.m5dial

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ CONFIG_LV_USE_DEMO_STRESS=y
1717
CONFIG_LV_USE_DEMO_MUSIC=y
1818
CONFIG_LV_DEMO_MUSIC_AUTO_PLAY=y
1919
CONFIG_LV_DEMO_MUSIC_ROUND=y
20+
CONFIG_SPIRAM=n
2021

2122
## LVGL8 ##
2223
CONFIG_LV_USE_PERF_MONITOR=y

0 commit comments

Comments
 (0)