Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(workflow): Add esp-idf network examples build #124

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/ci/override_managed_component.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env python
#
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0

import sys
import argparse
from pathlib import Path
from glob import glob
from os import path
from idf_component_tools.manifest import ManifestManager


Expand Down Expand Up @@ -47,6 +48,11 @@ def override_with_local_component_all(component, local_path, apps):

# Go through all collected apps
for app in apps_with_glob:
# Verify that the app is a valid directory
if not path.isdir(app):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use modern pathlib.Path instead of os.path in this file. Lets keep it that way for consistency

Suggested change
if not path.isdir(app):
if not Path(app).is_dir():

print(f"[Warning] Skipping app '{app}' as it is not a valid directory.")
continue # Skip to the next app
# Process the app if it's a directory
try:
override_with_local_component(component, local_path, app)
except:
Expand Down
30 changes: 25 additions & 5 deletions .github/workflows/build_idf_examples.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build ESP-IDF USB examples
name: ESP-IDF Examples

on:
schedule:
Expand All @@ -11,18 +11,38 @@ jobs:
strategy:
matrix:
idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "latest"]
target: ["esp32s2", "esp32s3", "esp32p4"]
example:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, we build all targets in one job. Now we have one job for each target, which is slower.

Could you please check if idf-build-apps --target all can handle the idf version correctly? Eg. it will not build for esp32p4 on idf release which do not support P4?

Please test this locally, so we do not onverload the test runners...

Copy link
Collaborator

@tore-espressif tore-espressif Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirmed this works. idf-build-apps --target all on idf v5.1.2 will not list ESP32-P4 target

FYI like this

[(v5.1.2)]> idf-build-apps find -p examples/peripherals/usb/host --recursive --manifest-file examples/peripherals/.build-test-rules.yml

- { name: "USB Device", path: "examples/peripherals/usb/device", manifest_path: "examples/peripherals"}
- { name: "Network", path: "examples/network", manifest_path: "examples/network" }
exclude:
Comment on lines +15 to +17
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates another diminsion of the matrix, now we have 23 jobs for simple example builds, this should be optimized

number of jobs: idf_ver * target * example

image

# Exclude esp32p4 for releases before IDF 5.3 (esp32p4 support starts in IDF 5.3)
- idf_ver: "release-v5.0"
target: "esp32p4"
- idf_ver: "release-v5.1"
target: "esp32p4"
- idf_ver: "release-v5.2"
target: "esp32p4"
# Exclude esp32p4 for Network examples
- target: "esp32p4"
example: { name: "Network", path: "examples/network", manifest_path: "examples/network" }
# Exclude Network examples for releases IDF 5.0 and 5.1
- example: { name: "Network", path: "examples/network", manifest_path: "examples/network" }
idf_ver: "release-v5.0"
- example: { name: "Network", path: "examples/network", manifest_path: "examples/network" }
idf_ver: "release-v5.1"
runs-on: ubuntu-20.04
container: espressif/idf:${{ matrix.idf_ver }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Build ESP-IDF USB examples
- name: Build
shell: bash
run: |
. ${IDF_PATH}/export.sh
pip install idf-component-manager==1.5.2 idf-build-apps==2.4.3 --upgrade
python .github/ci/override_managed_component.py esp_tinyusb device/esp_tinyusb ${IDF_PATH}/examples/peripherals/usb/device/tusb_*
python .github/ci/override_managed_component.py esp_tinyusb device/esp_tinyusb ${IDF_PATH}/${{ matrix.example.path }}/*
cd ${IDF_PATH}
idf-build-apps find --path examples/peripherals/usb/device/ --recursive --target all --manifest-file examples/peripherals/.build-test-rules.yml --build-dir build_@t_@w --work-dir @f_@t_@w
idf-build-apps build --path examples/peripherals/usb/device/ --recursive --target all --manifest-file examples/peripherals/.build-test-rules.yml --build-dir build_@t_@w --work-dir @f_@t_@w
idf-build-apps find --path ${{ matrix.example.path }} --recursive --target ${{ matrix.target }} --manifest-file ${{ matrix.example.manifest_path }}/.build-test-rules.yml --build-dir build_@t_@w --work-dir @f_@t_@w
idf-build-apps build --path ${{ matrix.example.path }} --recursive --target ${{ matrix.target }} --manifest-file ${{ matrix.example.manifest_path }}/.build-test-rules.yml --build-dir build_@t_@w --work-dir @f_@t_@w
Loading