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

feature(ci): Build ESP-IDF examples in CI #24

Merged
merged 1 commit into from
Apr 30, 2024
Merged
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
64 changes: 64 additions & 0 deletions .github/ci/override_managed_component.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env python
#
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0

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


def override_with_local_component(component, local_path, app):
app_path = Path(app)

absolute_local_path = Path(local_path).absolute()
if not absolute_local_path.exists():
print('[Error] {} path does not exist'.format(local_path))
raise Exception
if not app_path.exists():
print('[Error] {} path does not exist'.format(app_path))
raise Exception

print('[Info] Processing app {}'.format(app))
manager = ManifestManager(app_path / 'main', 'app')
roma-jam marked this conversation as resolved.
Show resolved Hide resolved
if '/' not in component:
# Prepend with default namespace
component_with_namespace = 'espressif/' + component

try:
manager.manifest_tree['dependencies'][component_with_namespace] = {
'version': '*',
'override_path': str(absolute_local_path)
}
except KeyError:
print('[Error] {} app does not depend on {}'.format(app, component_with_namespace))
raise KeyError

manager.dump()


def override_with_local_component_all(component, local_path, apps):
# Process wildcard, e.g. "app_prefix_*"
apps_with_glob = list()
for app in apps:
apps_with_glob += glob(app)

# Go through all collected apps
for app in apps_with_glob:
try:
override_with_local_component(component, local_path, app)
except:
print("[Error] Could not process app {}".format(app))
return -1
return 0


if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('component', help='Existing component that the app depends on')
parser.add_argument('local_path', help='Path to component that will be used instead of the managed version')
parser.add_argument('apps', nargs='*', help='List of apps to process')
args = parser.parse_args()
sys.exit(override_with_local_component_all(args.component, args.local_path, args.apps))
28 changes: 28 additions & 0 deletions .github/workflows/build_idf_examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build ESP-IDF USB examples

on:
schedule:
- cron: '0 0 * * SAT' # Saturday midnight
pull_request:
types: [opened, reopened, synchronize]

jobs:
build:
strategy:
matrix:
idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "latest"]
roma-jam marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-20.04
container: espressif/idf:${{ matrix.idf_ver }}
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Build ESP-IDF USB Device examples
shell: bash
run: |
. ${IDF_PATH}/export.sh
pip install idf-component-manager==1.5.2 idf-build-apps --upgrade
roma-jam marked this conversation as resolved.
Show resolved Hide resolved
python .github/ci/override_managed_component.py tinyusb . ${IDF_PATH}/examples/peripherals/usb/device/tusb_*
cd ${IDF_PATH}
idf-build-apps find --path examples/peripherals/usb/device/ --recursive --target all --manifest-file examples/peripherals/.build-test-rules.yml
idf-build-apps build --path examples/peripherals/usb/device/ --recursive --target all --manifest-file examples/peripherals/.build-test-rules.yml
Loading