-
Notifications
You must be signed in to change notification settings - Fork 124
249 lines (236 loc) · 8.91 KB
/
build-run-applications.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: Build ESP-BSP apps
# This job builds all examples and test_applications in this repo
# Applications are selected for build based on changes files and dependencies defined in .build-test-rules.yml
on:
pull_request:
types: [opened, reopened, synchronize, labeled]
workflow_dispatch:
inputs:
WFType:
description: 'Workflow type'
required: true
default: 'Build + Tests'
type: choice
options:
- Build + Tests
- Build + Tests + Benchmark
jobs:
build:
strategy:
matrix:
include:
- idf_ver: "latest"
parallel_count: 10
parallel_index: 1
- idf_ver: "latest"
parallel_count: 10
parallel_index: 2
- idf_ver: "latest"
parallel_count: 10
parallel_index: 3
- idf_ver: "latest"
parallel_count: 10
parallel_index: 4
- idf_ver: "latest"
parallel_count: 10
parallel_index: 5
- idf_ver: "latest"
parallel_count: 10
parallel_index: 6
- idf_ver: "latest"
parallel_count: 10
parallel_index: 7
- idf_ver: "latest"
parallel_count: 10
parallel_index: 8
- idf_ver: "latest"
parallel_count: 10
parallel_index: 9
- idf_ver: "latest"
parallel_count: 10
parallel_index: 10
#- idf_ver: "release-v5.1"
# parallel_count: 2
# parallel_index: 1
#- idf_ver: "release-v5.1"
# parallel_count: 2
# parallel_index: 2
#- idf_ver: "release-v5.2"
# parallel_count: 2
# parallel_index: 1
#- idf_ver: "release-v5.2"
# parallel_count: 2
# parallel_index: 2
#- idf_ver: "release-v5.3"
# parallel_count: 2
# parallel_index: 1
#- idf_ver: "release-v5.3"
# parallel_count: 2
# parallel_index: 2
#- idf_ver: "release-v5.4"
# parallel_count: 2
# parallel_index: 1
#- idf_ver: "release-v5.4"
# parallel_count: 2
# parallel_index: 2
runs-on: ubuntu-latest
container: espressif/idf:${{ matrix.idf_ver }}
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
separator: ';' # idf-build-apps expects files seprated with semicolon
- name: Build ESP-BSP applications
shell: bash
env:
IDF_EXTRA_ACTIONS_PATH: "${{ github.workspace }}/examples"
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_modified_files }}
run: |
. ${IDF_PATH}/export.sh
pip install idf-component-manager==1.* ruamel.yaml idf-build-apps==2.4.3 --upgrade
echo "Files changed: ${ALL_CHANGED_FILES}"
idf-build-apps find --modified-files "${ALL_CHANGED_FILES}"
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
- uses: actions/upload-artifact@v4
if: github.repository_owner == 'espressif' && needs.prepare.outputs.build_only == '0'
with:
name: app_binaries_${{ matrix.idf_ver }}_${{ matrix.parallel_index }}
path: |
examples/*/build_*/bootloader/bootloader.bin
examples/*/build_*/partition_table/partition-table.bin
examples/*/build_*/*.bin
examples/*/build_*/flasher_args.json
examples/*/build_*/config/sdkconfig.json
build_info*.json
run-target:
name: Run apps
if: github.repository_owner == 'espressif' && needs.prepare.outputs.build_only != '1'
needs: build
strategy:
fail-fast: false
max-parallel: 5
matrix:
idf_ver:
- "latest"
runner:
# - runs-on: "esp-box-3"
# marker: "esp_box_3"
# target: "esp32s3"
# - runs-on: "esp32_c3_lcdkit"
# marker: "esp32_c3_lcdkit"
# target: "esp32c3"
# - runs-on: "esp32_p4_box"
# marker: "esp32_p4_box"
# target: "esp32p4"
- runs-on: "esp32_p4_function_ev_board"
marker: "esp32_p4_function_ev_board"
target: "esp32p4"
# - runs-on: "esp32_s3_eye"
# marker: "esp32_s3_eye"
# target: "esp32s3"
- runs-on: "esp32_s3_lcd_ev_board"
marker: "esp32_s3_lcd_ev_board"
target: "esp32s3"
- runs-on: "esp32_s3_lcd_ev_board"
marker: "esp32_s3_lcd_ev_board_2"
target: "esp32s3"
# - runs-on: "esp32_s3_usb_otg"
# marker: "esp32_s3_usb_otg"
# target: "esp32s3"
# - runs-on: "esp_wrover_kit"
# marker: "esp_wrover_kit"
# target: "esp32"
# - runs-on: "m5dial"
# marker: "m5dial"
# target: "esp32s3"
# - runs-on: "m5stack_core"
# marker: "m5stack_core"
# target: "esp32"
# - runs-on: "m5stack_core_2"
# marker: "m5stack_core_2"
# target: "esp32"
# - runs-on: "m5stack_core_s3"
# marker: "m5stack_core_s3"
# target: "esp32s3"
# - runs-on: "m5stack_core_s3"
# marker: "m5stack_core_s3_se"
# target: "esp32s3"
# - runs-on: "esp32_azure_iot_kit"
# marker: "esp32_azure_iot_kit"
# target: "esp32"
env:
TEST_RESULT_NAME: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }}
TEST_RESULT_FILE: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }}.xml
runs-on: [self-hosted, Linux, bspwall]
container:
image: python:3.11-bookworm
options: --privileged -v /dev/boards:/dev/boards/ # Privileged mode has access to serial ports
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: app_binaries_${{ matrix.idf_ver }}_*
merge-multiple: true
- name: Install Python packages
env:
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/"
run: |
echo "PYTEST_BENCHMARK_IGNORE=--ignore='examples/display_lvgl_benchmark'" >> $GITHUB_ENV
pip install --prefer-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pytest-custom_exit_code
- name: Set ignores
if: contains(github.event.pull_request.labels.*.name, 'Run benchmark') || contains(inputs.WFType, 'Build + Tests + Benchmark')
id: set_ignores
run: |
echo "PYTEST_BENCHMARK_IGNORE=" >> $GITHUB_ENV
- name: Run apps
run: |
pytest --suppress-no-test-exit-code --ignore-glob '*/managed_components/*' --ignore=.github ${{ env.PYTEST_BENCHMARK_IGNORE }} --junit-xml=${{ env.TEST_RESULT_FILE }} --target=${{ matrix.runner.target }} -m ${{ matrix.runner.marker }} --build-dir=build_${{ matrix.runner.runs-on }}
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.TEST_RESULT_NAME }}
path: |
${{ env.TEST_RESULT_FILE }}
benchmark_*.md
benchmark_*.json
publish-results:
name: Publish Test results
needs:
- run-target
if: github.repository_owner == 'espressif' && always() && github.event_name == 'pull_request' && needs.prepare.outputs.build_only == '0'
runs-on: ubuntu-22.04
steps:
- name: Download Test results
uses: actions/download-artifact@v4
with:
pattern: test_results_*
path: test_results
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: test_results/**/*.xml
- name: Find test result files
id: find_files
run: |
OUTPUT_FILE="combined_benchmarks.md"
echo "" > $OUTPUT_FILE
python <<EOF
import glob
files = sorted(glob.glob("test_results/**/benchmark_*.md"))
print(files)
output_file = "combined_benchmarks.md"
with open(output_file, "w", encoding="utf-8") as outfile:
for file in files:
with open(file, "r", encoding="utf-8") as infile:
outfile.write(infile.read() + "\n\n")
print(f"Merged {len(files)} files into {output_file}")
EOF
echo "output_file=$OUTPUT_FILE" >> "$GITHUB_ENV"
- name: Comment PR
uses: thollander/actions-comment-pull-request@v3
with:
comment-tag: benchmark_results
file-path: ${{ env.output_file }}