Skip to content

Commit 95ec11b

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 95ec11b

File tree

2 files changed

+97
-10
lines changed

2 files changed

+97
-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: 97 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 usb host and usb device esp-idf examples with overridden local components:
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,16 @@
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 target runners, with matrix of all listed releases
18+
# - usb host examples: Run on usb_host_examples target runners, with matrix of all listed releases, except IDF Latest and IDF 6.0
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 and IDF 6.0 disabled (ECO4-ECO5 build-runner mismatch)
24+
# - USB Device examples run: IDF latest and IDF 6.0 disabled (ECO4-ECO5 build-runner mismatch)
1425

1526
name: Build ESP-IDF USB examples
1627

@@ -20,6 +31,12 @@ on:
2031

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

0 commit comments

Comments
 (0)