Skip to content

Commit 2425c1b

Browse files
committed
feature(ci): Added CI job for esp-idf device examples build verification
1 parent d850d21 commit 2425c1b

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env python
2+
#
3+
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
import sys
7+
import argparse
8+
from pathlib import Path
9+
from glob import glob
10+
from idf_component_tools.manifest import ManifestManager
11+
12+
13+
def override_with_local_component(component, local_path, app):
14+
app_path = Path(app)
15+
16+
absolute_local_path = Path(local_path).absolute()
17+
if not absolute_local_path.exists():
18+
print('[Error] {} path does not exist'.format(local_path))
19+
raise Exception
20+
if not app_path.exists():
21+
print('[Error] {} path does not exist'.format(app_path))
22+
raise Exception
23+
24+
print('[Info] Processing app {}'.format(app))
25+
manager = ManifestManager(app_path / 'main', 'app')
26+
if '/' not in component:
27+
# Prepend with default namespace
28+
component_with_namespace = 'espressif/' + component
29+
30+
try:
31+
manager.manifest_tree['dependencies'][component_with_namespace] = {
32+
'version': '*',
33+
'override_path': str(absolute_local_path)
34+
}
35+
except KeyError:
36+
print('[Error] {} app does not depend on {}'.format(app, component_with_namespace))
37+
raise KeyError
38+
39+
manager.dump()
40+
41+
42+
def override_with_local_component_all(component, local_path, apps):
43+
# Process wildcard, e.g. "app_prefix_*"
44+
apps_with_glob = list()
45+
for app in apps:
46+
apps_with_glob += glob(app)
47+
48+
# Go through all collected apps
49+
for app in apps_with_glob:
50+
try:
51+
override_with_local_component(component, local_path, app)
52+
except:
53+
print("[Error] Could not process app {}".format(app))
54+
return -1
55+
return 0
56+
57+
58+
if __name__ == '__main__':
59+
parser = argparse.ArgumentParser()
60+
parser.add_argument('component', help='Existing component that the app depends on')
61+
parser.add_argument('local_path', help='Path to component that will be used instead of the managed version')
62+
parser.add_argument('apps', nargs='*', help='List of apps to process')
63+
args = parser.parse_args()
64+
sys.exit(override_with_local_component_all(args.component, args.local_path, args.apps))
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build ESP-IDF USB examples
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * SAT' # Saturday midnight
6+
pull_request:
7+
types: [opened, reopened, synchronize]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "latest"]
14+
runs-on: ubuntu-20.04
15+
container: espressif/idf:${{ matrix.idf_ver }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
submodules: 'true'
20+
- name: Build ESP-IDF USB Device examples
21+
shell: bash
22+
run: |
23+
. ${IDF_PATH}/export.sh
24+
pip install idf-component-manager==1.5.2 idf-build-apps --upgrade
25+
python .github/ci/override_managed_component.py tinyusb . ${IDF_PATH}/examples/peripherals/usb/device/tusb_*
26+
cd ${IDF_PATH}
27+
idf-build-apps find --path examples/peripherals/usb/device/ --recursive --target all --manifest-file examples/peripherals/.build-test-rules.yml
28+
idf-build-apps build --path examples/peripherals/usb/device/ --recursive --target all --manifest-file examples/peripherals/.build-test-rules.yml

0 commit comments

Comments
 (0)