Skip to content

Commit 8486e5c

Browse files
committed
fix(ci): Cleaned up the workflows
- Add all targets to esp-usb test apps and esp-idf examples - Fix override tinyusb in the network example
1 parent a8a3254 commit 8486e5c

File tree

4 files changed

+107
-52
lines changed

4 files changed

+107
-52
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Config file for build_and_run_idf_examples.yml workflow
2+
3+
# This file contains configuration settings for the idf-build-apps tool,
4+
# which is used to build and run example applications in the workflow.
5+
# If you change the 'build_dir' value, make sure to update the corresponding
6+
# Run step in the workflow, as it will need to reference the new build directory.
7+
8+
paths = [
9+
"${IDF_PATH}/examples/peripherals/usb/device", # ESP-IDF USB Device examples path
10+
]
11+
12+
exclude = [
13+
"${IDF_PATH}/examples/peripherals/usb/device/cherryusb_serial_device", # Exclude cherryusb-based device examples
14+
]
15+
16+
recursive = true
17+
manifest_file = "${IDF_PATH}/examples/peripherals/.build-test-rules.yml"
18+
check_warnings = true
19+
target = "all"
20+
21+
# Build related options (build_dir uses '@t' for target and '@w' for wildcard pattern (sdkconfig usually)
22+
build_dir = "build_@t_@w"
Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
name: ESP-USB Test Apps
1+
# This workflow builds and runs ESP-USB test applications for pull requests.
2+
# It checks out the latest code from ESP-USB master, builds test apps using Espressif's IDF,
3+
# uploads artifacts, and runs tests on self-hosted runners for supported targets.
4+
5+
name: ESP-USB Test Apps [master]
26

37
on:
48
pull_request:
@@ -8,13 +12,19 @@ jobs:
812
build:
913
name: Build
1014
strategy:
15+
fail-fast: false
1116
matrix:
1217
idf_ver: ["release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "release-v5.5", "latest"]
1318
runs-on: ubuntu-latest
1419
container: espressif/idf:${{ matrix.idf_ver }}
1520
env:
16-
ESP_USB_MANIFEST: ./esp-usb/.build-test-rules.yml
17-
ESP_TINYUSB_TEST_APPS: ./esp-usb/device/esp_tinyusb/test_apps
21+
IDF_COMP_MAN_VER: "2.4.3"
22+
IDF_BUILD_APPS_VER: "2.13.1"
23+
# We are cloning esp-usb repo to get the test apps to build, the paths should be configured explicitly
24+
ESP_USB_PATH: esp-usb
25+
ESP_USB_CONFIG_FILE: esp-usb/.idf_build_apps.toml
26+
ESP_USB_MANIFEST: esp-usb/.build-test-rules.yml
27+
ESP_TINYUSB_TEST_APPS: esp-usb/device/esp_tinyusb/test_apps
1828
steps:
1929
- uses: actions/checkout@v4
2030
with:
@@ -26,40 +36,45 @@ jobs:
2636
shell: bash
2737
run: |
2838
. ${IDF_PATH}/export.sh
29-
pip install --no-cache-dir idf-component-manager>=2.1.2 idf-build-apps==2.4.3 pyyaml --upgrade
39+
pip install --no-cache-dir idf-component-manager>=${{ env.IDF_COMP_MAN_VER }} idf-build-apps==${{ env.IDF_BUILD_APPS_VER }} pyyaml --upgrade
3040
export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
3141
export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes"
3242
export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}"
3343
python .github/ci/override_managed_component.py tinyusb . ${{ env.ESP_TINYUSB_TEST_APPS }}/*/
34-
idf-build-apps find --path ${{ env.ESP_TINYUSB_TEST_APPS }}/ --recursive --target esp32s2 --manifest-file ${{ env.ESP_USB_MANIFEST }}
35-
idf-build-apps build --path ${{ env.ESP_TINYUSB_TEST_APPS }}/ --recursive --target esp32s2 --manifest-file ${{ env.ESP_USB_MANIFEST }}
44+
idf-build-apps find --config-file ${{ env.ESP_USB_CONFIG_FILE }} -p ${{ env.ESP_TINYUSB_TEST_APPS }} -t all --manifest-files ${{ env.ESP_USB_MANIFEST }} --manifest-rootpath ${{ env.ESP_USB_PATH }}
45+
idf-build-apps build --config-file ${{ env.ESP_USB_CONFIG_FILE }} -p ${{ env.ESP_TINYUSB_TEST_APPS }} -t all --manifest-files ${{ env.ESP_USB_MANIFEST }} --manifest-rootpath ${{ env.ESP_USB_PATH }}
3646
- uses: actions/upload-artifact@v4
3747
with:
38-
name: usb_test_app_bin_${{ matrix.idf_ver }}
48+
# Test apps builds live under the repository workspace, we use workspace-relative glob
49+
name: usb_device_test_app_bin_${{ matrix.idf_ver }}
3950
path: |
40-
${{env.ESP_TINYUSB_TEST_APPS}}/**/build/bootloader/bootloader.bin
41-
${{env.ESP_TINYUSB_TEST_APPS}}/**/build/partition_table/partition-table.bin
42-
${{env.ESP_TINYUSB_TEST_APPS}}/**/build/test_app_*.bin
43-
${{env.ESP_TINYUSB_TEST_APPS}}/**/build/test_app_*.elf
44-
${{env.ESP_TINYUSB_TEST_APPS}}/**/build/flasher_args.json
45-
${{env.ESP_TINYUSB_TEST_APPS}}/**/build/config/sdkconfig.json
51+
**/build_esp*/bootloader/bootloader.bin
52+
**/build_esp*/partition_table/partition-table.bin
53+
**/build_esp*/test_app_*.bin
54+
**/build_esp*/test_app_*.elf
55+
**/build_esp*/flasher_args.json
56+
**/build_esp*/config/sdkconfig.json
4657
if-no-files-found: error
4758

4859
run-target:
4960
name: Run
61+
# Disable the job in forks
5062
if: ${{ github.repository_owner == 'espressif' }}
5163
needs: build
5264
strategy:
65+
fail-fast: false
5366
matrix:
5467
idf_ver: ["release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "release-v5.5", "latest"]
5568
idf_target: ["esp32s2"]
69+
sdkconfig: ["default"]
5670
runner_tag: ["usb_device"]
5771
runs-on: [self-hosted, linux, docker, "${{ matrix.idf_target }}", "${{ matrix.runner_tag }}"]
5872
container:
5973
image: python:3.11-bookworm
6074
options: --privileged --device-cgroup-rule="c 188:* rmw" --device-cgroup-rule="c 166:* rmw"
6175
env:
62-
ESP_TINYUSB_TEST_APPS: ./esp-usb/device/esp_tinyusb/test_apps
76+
ESP_USB_ROOT: esp-usb
77+
ESP_USB_TEST_APPS_PATH: esp-usb/device/esp_tinyusb/test_apps
6378
steps:
6479
- uses: actions/checkout@v4
6580
- name: Clone esp-usb repository
@@ -75,7 +90,9 @@ jobs:
7590
run: pip install --only-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pyserial pyusb
7691
- uses: actions/download-artifact@v4
7792
with:
78-
name: usb_test_app_bin_${{ matrix.idf_ver }}
79-
path: ${{env.ESP_TINYUSB_TEST_APPS}}
80-
- name: Run USB Test App on target
81-
run: pytest ${{env.ESP_TINYUSB_TEST_APPS}} --embedded-services esp,idf --target=${{ matrix.idf_target }} -m ${{ matrix.runner_tag }}
93+
# No need to set the path manually.
94+
# The test apps were built after cloning the esp-usb repo,
95+
# and the build artifacts already have the correct folder structure.
96+
name: usb_device_test_app_bin_${{ matrix.idf_ver }}
97+
- name: Run on target
98+
run: pytest ${{ env.ESP_USB_TEST_APPS_PATH }} --target=${{ matrix.idf_target }} -m ${{ matrix.runner_tag }} --build-dir=build_${{ matrix.idf_target }}_${{ matrix.sdkconfig }}

.github/workflows/build_and_run_idf_examples.yml

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,62 +6,76 @@ on:
66

77
jobs:
88
build:
9+
name: Build
910
strategy:
11+
fail-fast: false
1012
matrix:
1113
idf_ver: ["release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "release-v5.5", "latest"]
12-
fail-fast: false
1314
runs-on: ubuntu-latest
1415
container: espressif/idf:${{ matrix.idf_ver }}
16+
env:
17+
IDF_COMP_MAN_VER: "2.4.3"
18+
IDF_BUILD_APPS_VER: "2.13.1"
19+
CONFIG_PATH: ${{ github.workspace }}/.github/ci/.build_and_run_idf_examples_config.toml
1520
steps:
1621
- uses: actions/checkout@v4
1722
- name: Install Python dependencies
1823
shell: bash
1924
run: |
2025
. ${IDF_PATH}/export.sh
21-
pip install --no-cache-dir idf-component-manager>=2.1.2 idf-build-apps==2.4.3 pyyaml --upgrade
26+
pip install --no-cache-dir idf-component-manager>=${{ env.IDF_COMP_MAN_VER }} idf-build-apps==${{ env.IDF_BUILD_APPS_VER }} pyyaml --upgrade
2227
- name: Build Network USB related examples
2328
shell: bash
2429
run: |
2530
. ${IDF_PATH}/export.sh
31+
# Hint: To build network example we just use default config and network build rules provided by IDF
2632
export EXAMPLES_PATH="${IDF_PATH}/examples/network/sta2eth"
2733
export MANIFEST_FILE="${IDF_PATH}/examples/network/.build-test-rules.yml"
28-
idf-build-apps find --path ${EXAMPLES_PATH}/ --target esp32s2 --manifest-file ${MANIFEST_FILE}
29-
idf-build-apps build --path ${EXAMPLES_PATH}/ --target esp32s2 --manifest-file ${MANIFEST_FILE}
34+
python .github/ci/override_managed_component.py tinyusb . ${EXAMPLES_PATH}
35+
idf-build-apps find -p ${EXAMPLES_PATH} -t esp32s2 --manifest-files ${MANIFEST_FILE} --manifest-rootpath ${IDF_PATH}
36+
idf-build-apps build -p ${EXAMPLES_PATH} -t esp32s2 --manifest-files ${MANIFEST_FILE} --manifest-rootpath ${IDF_PATH}
3037
- name: Build USB Device examples
3138
shell: bash
3239
run: |
3340
. ${IDF_PATH}/export.sh
34-
export EXAMPLES_PATH="${IDF_PATH}/examples/peripherals/usb/device"
35-
export MANIFEST_FILE="${IDF_PATH}/examples/peripherals/.build-test-rules.yml"
36-
python .github/ci/override_managed_component.py tinyusb . ${EXAMPLES_PATH}/tusb_*
37-
idf-build-apps find --path ${EXAMPLES_PATH}/ --recursive --target esp32s2 --manifest-file ${MANIFEST_FILE}
38-
idf-build-apps build --path ${EXAMPLES_PATH}/ --recursive --target esp32s2 --manifest-file ${MANIFEST_FILE}
41+
python .github/ci/override_managed_component.py tinyusb . ${IDF_PATH}/examples/peripherals/usb/device/tusb_*
42+
idf-build-apps find --config-file ${CONFIG_PATH} --manifest-rootpath ${IDF_PATH}
43+
idf-build-apps build --config-file ${CONFIG_PATH} --manifest-rootpath ${IDF_PATH}
3944
- uses: actions/upload-artifact@v4
45+
env:
46+
IDF_ROOT: "/opt/esp/idf"
4047
with:
41-
# We upload only the USB Device example binaries to run them on the target
42-
name: usb_device_tusb_apps_bin_${{ matrix.idf_ver }}
48+
# We upload only USB Device example binaries to run them on the target
49+
name: usb_device_examples_bin_${{ matrix.idf_ver }}
4350
path: |
44-
/opt/esp/idf/examples/peripherals/usb/device/tusb_*/build/bootloader/bootloader.bin
45-
/opt/esp/idf/examples/peripherals/usb/device/tusb_*/build/partition_table/partition-table.bin
46-
/opt/esp/idf/examples/peripherals/usb/device/tusb_*/build/tusb_*.bin
47-
/opt/esp/idf/examples/peripherals/usb/device/tusb_*/build/tusb_*.elf
48-
/opt/esp/idf/examples/peripherals/usb/device/tusb_*/build/flasher_args.json
49-
/opt/esp/idf/examples/peripherals/usb/device/tusb_*/build/config/sdkconfig.json
51+
${{ env.IDF_ROOT }}/**/build_esp*/bootloader/bootloader.bin
52+
${{ env.IDF_ROOT }}/**/build_esp*/partition_table/partition-table.bin
53+
${{ env.IDF_ROOT }}/**/build_esp*/tusb_*.bin
54+
${{ env.IDF_ROOT }}/**/build_esp*/tusb_*.elf
55+
${{ env.IDF_ROOT }}/**/build_esp*/flasher_args.json
56+
${{ env.IDF_ROOT }}/**/build_esp*/config/sdkconfig.json
5057
if-no-files-found: error
5158
run-target:
52-
name: Run USB Device examples
59+
name: Run
60+
# Disable the job in forks
5361
if: ${{ github.repository_owner == 'espressif' }}
5462
needs: build
5563
strategy:
5664
fail-fast: false
5765
matrix:
66+
# Run esp-idf examples, starting from v5.3
5867
idf_ver: ["release-v5.3", "release-v5.4", "release-v5.5" , "latest"]
5968
idf_target: ["esp32s2"]
6069
runner_tag: ["usb_device"]
6170
runs-on: [self-hosted, linux, docker, "${{ matrix.idf_target }}", "${{ matrix.runner_tag }}"]
6271
container:
72+
# We run on espressif/idf image as we need the code of examples to be present to run pytest
6373
image: espressif/idf:${{ matrix.idf_ver }}
6474
options: --privileged --device-cgroup-rule="c 188:* rmw" --device-cgroup-rule="c 166:* rmw"
75+
env:
76+
# We do not use ${IDF_PATH} here, because it is not available during download of artifacts step
77+
IDF_ROOT: "/opt/esp/idf"
78+
IDF_EXAMPLES_PATH: "${IDF_PATH}/examples/peripherals/usb/device"
6579
steps:
6680
- name: ⚙️ Install System tools
6781
run: |
@@ -71,16 +85,15 @@ jobs:
7185
env:
7286
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/"
7387
run: |
74-
cd ${IDF_PATH}
75-
. ./export.sh
88+
. ${IDF_PATH}/export.sh
7689
pip install --no-cache-dir --only-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-jtag pytest-embedded-idf pyserial pyusb python-gitlab minio idf-build-apps idf_ci pytest_ignore_test_results pytest-timeout netifaces
7790
- uses: actions/download-artifact@v4
7891
with:
79-
name: usb_device_tusb_apps_bin_${{ matrix.idf_ver }}
80-
path: /opt/esp/idf/examples/peripherals/usb/device
81-
- name: Run USB Test App on target
92+
# Need to set the path manually.
93+
# The examples were built on a system files, which are not under the repository.
94+
name: usb_device_examples_bin_${{ matrix.idf_ver }}
95+
path: ${{ env.IDF_ROOT }}
96+
- name: Run on target
8297
run: |
83-
cd ${IDF_PATH}
84-
. ./export.sh
85-
export EXAMPLES_PATH="${IDF_PATH}/examples/peripherals/usb/device"
86-
pytest ${EXAMPLES_PATH} --target ${{ matrix.idf_target }} -m ${{ matrix.runner_tag }} --ignore-result-cases=*ncm_example
98+
. ${IDF_PATH}/export.sh
99+
pytest ${{ env.IDF_EXAMPLES_PATH }} --target ${{ matrix.idf_target }} -m ${{ matrix.runner_tag }} --ignore-result-cases=*ncm_example --build-dir=build_${{ matrix.idf_target }}

.github/workflows/build_iot_examples.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ on:
66

77
jobs:
88
build:
9+
name: Build
910
strategy:
1011
matrix:
1112
idf_ver: ["release-v5.3", "release-v5.4", "release-v5.5", "latest"]
1213
name: ["usb_uart_bridge"]
1314
runs-on: ubuntu-latest
1415
container: espressif/idf:${{ matrix.idf_ver }}
1516
env:
16-
ESP_IOT_PATH: esp-iot-solution
17-
MANIFEST_PATH: esp-iot-solution/examples/.build-rules.yml
18-
EXAMPLE_PATH: esp-iot-solution/examples/usb/device/${{ matrix.name }}
17+
IDF_COMP_MAN_VER: "2.4.3"
18+
IDF_BUILD_APPS_VER: "2.13.1"
19+
TARGET_PATH: esp-iot-solution
20+
TARGET_MANIFEST_PATH: esp-iot-solution/examples/.build-rules.yml
21+
TARGET_EXAMPLES_PATH: esp-iot-solution/examples/usb/device/${{ matrix.name }}
1922
steps:
2023
- uses: actions/checkout@v4
2124
with:
@@ -27,7 +30,7 @@ jobs:
2730
shell: bash
2831
run: |
2932
. ${IDF_PATH}/export.sh
30-
pip install --no-cache-dir idf-component-manager>=2.1.2 idf-build-apps==2.4.3 pyyaml --upgrade
31-
python .github/ci/override_managed_component.py tinyusb . ${{ env.EXAMPLE_PATH }}/
32-
idf-build-apps find --paths ${{ env.EXAMPLE_PATH }} --target all --manifest-file ${{ env.MANIFEST_PATH }} --manifest-rootpath ${{ env.ESP_IOT_PATH }}
33-
idf-build-apps build --paths ${{ env.EXAMPLE_PATH }} --target all --manifest-file ${{ env.MANIFEST_PATH }} --manifest-rootpath ${{ env.ESP_IOT_PATH }}
33+
pip install --no-cache-dir idf-component-manager>=${{ env.IDF_COMP_MAN_VER }} idf-build-apps==${{ env.IDF_BUILD_APPS_VER }} pyyaml --upgrade
34+
python .github/ci/override_managed_component.py tinyusb . ${{ env.TARGET_EXAMPLES_PATH }}/
35+
idf-build-apps find -p ${{ env.TARGET_EXAMPLES_PATH }} -t all --manifest-file ${{ env.TARGET_MANIFEST_PATH }} --manifest-rootpath ${{ env.TARGET_PATH }}
36+
idf-build-apps build -p ${{ env.TARGET_EXAMPLES_PATH }} -t all --manifest-file ${{ env.TARGET_MANIFEST_PATH }} --manifest-rootpath ${{ env.TARGET_PATH }}

0 commit comments

Comments
 (0)