Skip to content

Commit 8f7a8ec

Browse files
feat(ci): Run esp-idf examples on targets
- build and run esp-idf device and host examples - conditional run of the workflow
1 parent 0ea7e08 commit 8f7a8ec

File tree

2 files changed

+92
-10
lines changed

2 files changed

+92
-10
lines changed

.github/ci/.idf-build-examples-rules.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
# Manifest file for build_idf_examples.yml CI workflow
22

33
examples/peripherals/usb/device:
4-
enable:
5-
- if: (IDF_VERSION >= "6.0.0")
6-
reason: Device examples have been updated to use esp_tinyusb 2.x only on esp-idf latest for now, TODO IDF-14282
74
disable:
85
- if: SOC_USB_OTG_SUPPORTED != 1
96

107
examples/peripherals/usb/device/tusb_ncm:
11-
enable:
12-
- if: (IDF_VERSION >= "6.0.0")
13-
reason: Device examples have been updated to use esp_tinyusb 2.x only on esp-idf latest for now, TODO IDF-14282
148
disable:
159
- if: SOC_USB_OTG_SUPPORTED != 1 or SOC_WIFI_SUPPORTED != 1
1610

.github/workflows/build_idf_examples.yml renamed to .github/workflows/build_and_run_idf_examples.yml

Lines changed: 92 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# This workflow builds esp-idf examples:
1+
# This workflow builds and runs esp-idf examples:
22
#
3+
# Build:
34
# - usb device examples: with overridden esp_tinyusb from esp-usb/device/esp_tinyusb
4-
# - Override esp_tinyusb component only for IDF >= 6.0 temporarily
5+
# - Override esp_tinyusb component only for IDF 5.3, IDF 5.5, IDF 6.0 and latest temporarily, others have not been backported
56
#
67
# - usb host examples:
78
# - Overridden usb component from esp-usb/host/usb and overridden class drivers from esp-usb/host/class
@@ -11,6 +12,15 @@
1112
#
1213
# - cherryusb examples are ignored
1314
# - usb_host_lib example -> manifest file must be created for IDF < 6.0 to override usb component
15+
#
16+
# Run:
17+
# - usb device examples: Run on usb_device targets, with matrix of all listed releases
18+
# - usb host examples: Run on usb_host_examples, with matrix of all listed releases, except IDF Latest
19+
#
20+
#
21+
# Temporarily disabled tests and TODOs of this workflow:
22+
# - USB Device examples build: Only for only for IDF 5.3, IDF 5.5, IDF 6.0 and latest temporarily, others have not been backported
23+
# - USB Host examples run: IDF latest disabled (ECO4-ECO5 build-runner mismatch)
1424

1525
name: Build ESP-IDF USB examples
1626

@@ -20,6 +30,12 @@ on:
2030

2131
jobs:
2232
build:
33+
# Condition:
34+
# 1. PR title contains "release" (case-sensitive)
35+
# 2. PR labels include "run full tests"
36+
if: |
37+
contains(github.event.pull_request.title, 'release') ||
38+
contains(github.event.pull_request.labels.*.name, 'tests esp-idf')
2339
strategy:
2440
fail-fast: true
2541
matrix:
@@ -51,8 +67,8 @@ jobs:
5167
- name: Setup IDF Examples path
5268
run: echo "EXAMPLES_PATH=${IDF_PATH}/examples/peripherals/usb" >> $GITHUB_ENV
5369
- name: Override device component
54-
# Override esp_tinyusb component only for IDF >= 6.0 temporarily
55-
if: contains('release-v6.0 latest', matrix.idf_ver)
70+
# Override esp_tinyusb component only for IDF 5.3, IDF 5.5, IDF 6.0 and latest temporarily, others have not been backported
71+
if: contains('release-v5.3 release-v5.5 release-v6.0 latest', matrix.idf_ver)
5672
run: |
5773
. ${IDF_PATH}/export.sh
5874
python .github/ci/override_managed_component.py esp_tinyusb device/esp_tinyusb ${{ env.EXAMPLES_PATH }}/device/*
@@ -126,3 +142,75 @@ jobs:
126142
127143
idf-build-apps find --config-file ${CONFIG_PATH} --manifest-file ${MANIFEST_PATH}
128144
idf-build-apps build --config-file ${CONFIG_PATH} --manifest-file ${MANIFEST_PATH}
145+
146+
- uses: actions/upload-artifact@v4
147+
with:
148+
name: usb_examples_bin_${{ matrix.idf_ver }}
149+
path: |
150+
${{ env.EXAMPLES_PATH }}/**/build_esp*/bootloader/bootloader.bin
151+
${{ env.EXAMPLES_PATH }}/**/build_esp*/partition_table/partition-table.bin
152+
${{ env.EXAMPLES_PATH }}/**/build_esp*/*.bin
153+
${{ env.EXAMPLES_PATH }}/**/build_esp*/*.elf
154+
${{ env.EXAMPLES_PATH }}/**/build_esp*/flasher_args.json
155+
${{ env.EXAMPLES_PATH }}/**/build_esp*/config/sdkconfig.json
156+
if-no-files-found: error
157+
158+
run-target:
159+
name: Run esp-idf examples
160+
if: ${{ github.repository_owner == 'espressif' }}
161+
needs: build
162+
strategy:
163+
fail-fast: false
164+
matrix:
165+
idf_ver:
166+
[
167+
"release-v5.1",
168+
"release-v5.2",
169+
"release-v5.3",
170+
"release-v5.4",
171+
"release-v5.5",
172+
"release-v6.0",
173+
"latest",
174+
]
175+
idf_target: ["esp32s2", "esp32p4"]
176+
runner_tag: ["usb_host_flash_disk", "usb_device"]
177+
include:
178+
- runner_tag: usb_host_flash_disk
179+
example: host
180+
- runner_tag: usb_device
181+
example: device
182+
exclude:
183+
# Temp exclude esp32p4 usb_host_flash_disk run for IDF Latest (ECO4-ECO5 build-runner mismatch)
184+
- runner_tag: usb_host_flash_disk
185+
idf_ver: "latest"
186+
- runner_tag: usb_device
187+
idf_ver: "latest"
188+
runs-on: [self-hosted, linux, docker, "${{ matrix.idf_target }}", "${{ matrix.runner_tag }}"]
189+
container:
190+
image: espressif/idf:${{ matrix.idf_ver }}
191+
options: --privileged --device-cgroup-rule="c 188:* rmw" --device-cgroup-rule="c 166:* rmw"
192+
env:
193+
EXAMPLES_PATH: ${{ github.workspace }}
194+
steps:
195+
- name: ⚙️ Install System tools
196+
run: |
197+
apt update
198+
apt install net-tools
199+
- name: Setup IDF Examples path
200+
run: echo "EXAMPLES_PATH=${IDF_PATH}/examples/peripherals/usb" >> $GITHUB_ENV
201+
- name: ⚙️ Install Python packages
202+
env:
203+
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/"
204+
run: |
205+
cd ${IDF_PATH}
206+
. ./export.sh
207+
pip install --no-cache-dir --only-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pyserial pyusb netifaces idf-ci
208+
- uses: actions/download-artifact@v4
209+
with:
210+
name: usb_examples_bin_${{ matrix.idf_ver }}
211+
path: ${{ env.EXAMPLES_PATH }}
212+
- name: Run USB Test App on target
213+
run: |
214+
cd ${IDF_PATH}
215+
. ./export.sh
216+
pytest ${{ env.EXAMPLES_PATH }}/${{ matrix.example }} --target ${{ matrix.idf_target }} -m ${{ matrix.runner_tag }}

0 commit comments

Comments
 (0)