Skip to content

Commit 1a0a41f

Browse files
committed
fix(mdns): Use idf-build-apps package for building mdns
1 parent 2f7cbd1 commit 1a0a41f

File tree

5 files changed

+38
-115
lines changed

5 files changed

+38
-115
lines changed

.github/workflows/mdns__build-target-test.yml

Lines changed: 16 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -13,122 +13,33 @@ jobs:
1313
name: Build
1414
strategy:
1515
matrix:
16-
idf_ver: ["latest"]
17-
idf_target: ["esp32", "esp32s2", "esp32c3"]
18-
test: [ { app: example, path: "components/mdns/examples" }, { app: unit_test, path: "components/mdns/tests/unit_test" } ]
16+
idf_ver: ["latest", "release-v5.0"]
17+
test: [ { app: example, path: "examples" }, { app: unit_test, path: "tests/unit_test" }, { app: test_app, path: "tests/test_apps" } ]
1918
runs-on: ubuntu-20.04
2019
container: espressif/idf:${{ matrix.idf_ver }}
2120
steps:
2221
- name: Checkout esp-protocols
2322
uses: actions/checkout@v3
24-
with:
25-
submodules: recursive
26-
- name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
23+
- name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }}
2724
shell: bash
28-
working-directory: ${{ matrix.test.path }}
2925
run: |
30-
${IDF_PATH}/install.sh --enable-pytest
3126
. ${IDF_PATH}/export.sh
32-
python $IDF_PATH/tools/ci/ci_build_apps.py . --target ${{ matrix.idf_target }} -vv --preserve-all --pytest-app
33-
for dir in `ls -d build_*`; do
27+
python -m pip install idf-build-apps
28+
# Build default configs for all targets
29+
python ./ci/build_apps.py components/mdns/${{ matrix.test.path }} -r default -m components/mdns/.build-test-rules.yml -d
30+
# Build specific configs for test targets
31+
python ./ci/build_apps.py components/mdns/${{ matrix.test.path }}
32+
cd components/mdns/${{ matrix.test.path }}
33+
for dir in `ls -d build_esp32_*`; do
3434
$GITHUB_WORKSPACE/ci/clean_build_artifacts.sh `pwd`/$dir
3535
zip -qur artifacts.zip $dir
3636
done
3737
- uses: actions/upload-artifact@v3
38-
if: ${{ matrix.idf_target }} == "esp32"
39-
with:
40-
name: mdns_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }}
41-
path: ${{ matrix.test.path }}/artifacts.zip
42-
if-no-files-found: error
43-
44-
build_mdns_app:
45-
if: contains(github.event.pull_request.labels.*.name, 'mdns') || github.event_name == 'push'
46-
name: Build Test Apps
47-
strategy:
48-
matrix:
49-
idf_ver: ["latest"]
50-
idf_target: ["esp32", "esp32s2", "esp32c3"]
51-
runs-on: ubuntu-20.04
52-
container: espressif/idf:${{ matrix.idf_ver }}
53-
steps:
54-
- name: Checkout esp-protocols
55-
uses: actions/checkout@v3
56-
with:
57-
submodules: recursive
58-
- name: Setup Build Environment
59-
working-directory: components/mdns/tests/test_apps
60-
run: |
61-
. ${IDF_PATH}/export.sh
62-
pip install -r $GITHUB_WORKSPACE/ci/requirements.txt
63-
- name: Build ${{ matrix.example }} with IDF-${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
64-
env:
65-
IDF_TARGET: ${{ matrix.idf_target }}
66-
shell: bash
67-
working-directory: components/mdns/tests/test_apps
68-
run: |
69-
. ${IDF_PATH}/export.sh
70-
python $IDF_PATH/tools/ci/ci_build_apps.py . --target ${{ matrix.idf_target }} -vv --pytest-apps
71-
- name: Merge binaries with IDF-${{ matrix.idf_ver }}
72-
working-directory: components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default
73-
env:
74-
IDF_TARGET: ${{ matrix.idf_target }}
75-
shell: bash
76-
run: |
77-
. ${IDF_PATH}/export.sh
78-
esptool.py --chip ${{ matrix.idf_target }} merge_bin --fill-flash-size 4MB -o flash_image.bin @flash_args
79-
- uses: actions/upload-artifact@v2
8038
with:
81-
name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}
82-
path: |
83-
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/bootloader/bootloader.bin
84-
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/partition_table/partition-table.bin
85-
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/*.bin
86-
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/*.elf
87-
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/flasher_args.json
88-
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/config/sdkconfig.h
89-
components/mdns/tests/test_apps/build_${{ matrix.idf_target }}_default/config/sdkconfig.json
39+
name: mdns_bin_esp32_${{ matrix.idf_ver }}_${{ matrix.test.app }}
40+
path: components/mdns/${{ matrix.test.path }}/artifacts.zip
9041
if-no-files-found: error
9142

92-
target_test_apps_mdns:
93-
# Skip running on forks since it won't have access to secrets
94-
if: |
95-
github.repository == 'espressif/esp-protocols' &&
96-
( contains(github.event.pull_request.labels.*.name, 'mdns') || github.event_name == 'push' )
97-
name: Target Test Apps
98-
strategy:
99-
matrix:
100-
idf_ver: ["latest"]
101-
idf_target: ["esp32"]
102-
needs: build_mdns_app
103-
runs-on:
104-
- self-hosted
105-
- ESP32-ETHERNET-KIT
106-
steps:
107-
- name: Clear repository
108-
run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE
109-
- uses: actions/checkout@v3
110-
- uses: actions/download-artifact@v2
111-
with:
112-
name: examples_app_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}
113-
path: components/mdns/tests/test_apps/build
114-
- name: Install Python packages
115-
env:
116-
PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple"
117-
run: |
118-
sudo apt-get install -y dnsutils
119-
- name: Download Test apps to target
120-
run: |
121-
python -m esptool --chip ${{ matrix.idf_target }} write_flash 0x0 components/mdns/tests/test_apps/build/flash_image.bin
122-
- name: Run Example Test on target
123-
working-directory: components/mdns/tests/test_apps
124-
run: |
125-
python -m pytest --log-cli-level DEBUG --junit-xml=./examples_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}.xml --target=${{matrix.idf_target}}
126-
- uses: actions/upload-artifact@v2
127-
if: always()
128-
with:
129-
name: test_apps_results_${{ matrix.idf_target }}_${{ matrix.idf_ver }}
130-
path: components/mdns/tests/test_apps/*.xml
131-
13243
target_tests_mdns:
13344
# Skip running on forks since it won't have access to secrets
13445
if: |
@@ -139,7 +50,7 @@ jobs:
13950
matrix:
14051
idf_ver: ["latest"]
14152
idf_target: ["esp32"]
142-
test: [ { app: example, path: "components/mdns/examples" }, { app: unit_test, path: "components/mdns/tests/unit_test" } ]
53+
test: [ { app: example, path: "examples" }, { app: unit_test, path: "tests/unit_test" }, { app: test_app, path: "tests/test_apps" } ]
14354
needs: build_mdns
14455
runs-on:
14556
- self-hosted
@@ -151,14 +62,14 @@ jobs:
15162
- uses: actions/download-artifact@v3
15263
with:
15364
name: mdns_bin_${{ matrix.idf_target }}_${{ matrix.idf_ver }}_${{ matrix.test.app }}
154-
path: ${{ matrix.test.path }}/ci/
65+
path: components/mdns/${{ matrix.test.path }}/ci/
15566
- name: Install Python packages
15667
env:
15768
PIP_EXTRA_INDEX_URL: "https://www.piwheels.org/simple"
15869
run: |
15970
sudo apt-get install -y dnsutils
16071
- name: Run ${{ matrix.test.app }} application on ${{ matrix.idf_target }}
161-
working-directory: ${{ matrix.test.path }}
72+
working-directory: components/mdns/${{ matrix.test.path }}
16273
run: |
16374
unzip ci/artifacts.zip -d ci
16475
for dir in `ls -d ci/build_*`; do
@@ -170,4 +81,4 @@ jobs:
17081
if: always()
17182
with:
17283
name: results_${{ matrix.test.app }}_${{ matrix.idf_target }}_${{ matrix.idf_ver }}.xml
173-
path: ${{ matrix.test.path }}/*.xml
84+
path: components/mdns/${{ matrix.test.path }}/*.xml

.github/workflows/modem__build-host-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
. ${IDF_PATH}/export.sh
4949
python -m pip install idf-build-apps
5050
cd $GITHUB_WORKSPACE/protocols
51-
python ./ci/build_apps.py components/esp_modem/examples/${{ matrix.example }}
51+
python ./ci/build_apps.py components/esp_modem/examples/${{ matrix.example }} -m components/esp_modem/examples/.build-test-rules.yml
5252
5353
host_test_esp_modem:
5454
if: contains(github.event.pull_request.labels.*.name, 'modem') || github.event_name == 'push'

ci/build_apps.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import argparse
88
import os
99
import sys
10-
from pathlib import Path
1110

1211
from idf_build_apps import build_apps, find_apps, setup_logging
1312
from idf_build_apps.constants import SUPPORTED_TARGETS
@@ -24,6 +23,9 @@
2423
default='all',
2524
help='Build apps for given target',
2625
)
26+
parser.add_argument('-r', '--rules', nargs='*', default=['sdkconfig.ci=default', 'sdkconfig.ci.*=', '=default'], help='Rules how to treat configs')
27+
parser.add_argument('-m', '--manifests', nargs='*', default=[], help='list of manifest files')
28+
parser.add_argument('-d', '--delete', action='store_true', help='Delete build artifacts')
2729
args = parser.parse_args()
2830

2931
IDF_PATH = os.environ['IDF_PATH']
@@ -32,19 +34,15 @@
3234
setup_logging(2)
3335
apps = find_apps(
3436
args.paths,
35-
recursive=True,
37+
recursive=False,
3638
target=args.target,
3739
build_dir='build_@t_@w',
38-
config_rules_str=[
39-
'sdkconfig.ci=default', 'sdkconfig.ci.*=', '=default'
40-
],
40+
config_rules_str=args.rules,
4141
build_log_path='build_log.txt',
4242
size_json_path='size.json',
4343
check_warnings=True,
44-
preserve=True,
45-
manifest_files=[
46-
str(p) for p in Path('.').glob('**/.build-test-rules.yml')
47-
],
44+
preserve=not args.delete,
45+
manifest_files=args.manifests,
4846
default_build_targets=SUPPORTED_TARGETS,
4947
manifest_rootpath='.',
5048
)

components/mdns/.build-test-rules.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
components/mdns/examples:
2+
disable:
3+
- if: IDF_TARGET in ["esp32h2"]
4+
5+
components/mdns/tests/unit_test:
6+
disable:
7+
- if: IDF_TARGET in ["esp32h2"]
8+
9+
components/mdns/tests/test_apps:
10+
disable:
11+
- if: IDF_TARGET in ["esp32h2"]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_IDF_TARGET="esp32"
2+
CONFIG_UNITY_ENABLE_FIXTURE=y
3+
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n

0 commit comments

Comments
 (0)