forked from hathach/tinyusb
-
Notifications
You must be signed in to change notification settings - Fork 37
feature(ci): Build ESP-IDF examples in CI #24
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.