forked from espressif/esp-protocols
feat(examples): Add build/host tests to examples
This commit is contained in:
48
.github/workflows/examples_build-host-test.yml
vendored
Normal file
48
.github/workflows/examples_build-host-test.yml
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
name: "examples: build/host-tests"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened, labeled]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_all_examples:
|
||||||
|
if: contains(github.event.pull_request.labels.*.name, 'examples') || github.event_name == 'push'
|
||||||
|
name: Build examples
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
idf_ver: ["latest", "release-v5.1"]
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
container: espressif/idf:${{ matrix.idf_ver }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout esp-protocols
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Build with IDF-${{ matrix.idf_ver }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
. ${IDF_PATH}/export.sh
|
||||||
|
python -m pip install idf-build-apps
|
||||||
|
# Build default configs for all targets
|
||||||
|
python ./ci/build_apps.py examples -m examples/.build-test-rules.yml -d -c
|
||||||
|
|
||||||
|
build_and_run_on_host:
|
||||||
|
if: contains(github.event.pull_request.labels.*.name, 'examples') || github.event_name == 'push'
|
||||||
|
name: Build and run examples on linux
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
idf_ver: ["latest"]
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
container: espressif/idf:${{ matrix.idf_ver }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout esp-protocols
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Build with IDF-${{ matrix.idf_ver }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
. ${IDF_PATH}/export.sh
|
||||||
|
python -m pip install idf-build-apps
|
||||||
|
python ./ci/build_apps.py examples/mqtt -l -t linux
|
||||||
|
timeout 5 ./examples/mqtt/build_linux_default/esp_mqtt_demo.elf | tee test.log || true
|
||||||
|
grep 'MQTT_EVENT_DATA' test.log
|
@ -26,20 +26,25 @@ if __name__ == '__main__':
|
|||||||
parser.add_argument('-r', '--rules', nargs='*', default=['sdkconfig.ci=default', 'sdkconfig.ci.*=', '=default'], help='Rules how to treat configs')
|
parser.add_argument('-r', '--rules', nargs='*', default=['sdkconfig.ci=default', 'sdkconfig.ci.*=', '=default'], help='Rules how to treat configs')
|
||||||
parser.add_argument('-m', '--manifests', nargs='*', default=[], help='list of manifest files')
|
parser.add_argument('-m', '--manifests', nargs='*', default=[], help='list of manifest files')
|
||||||
parser.add_argument('-d', '--delete', action='store_true', help='Delete build artifacts')
|
parser.add_argument('-d', '--delete', action='store_true', help='Delete build artifacts')
|
||||||
|
parser.add_argument('-c', '--recursive', action='store_true', help='Build recursively')
|
||||||
|
parser.add_argument('-l', '--linux', action='store_true', help='Include linux build (dont check warnings)')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
IDF_PATH = os.environ['IDF_PATH']
|
IDF_PATH = os.environ['IDF_PATH']
|
||||||
|
|
||||||
print(args.paths)
|
ignore_warning = os.environ['EXPECTED_WARNING'] if 'EXPECTED_WARNING' in os.environ else None
|
||||||
|
if args.linux:
|
||||||
|
SUPPORTED_TARGETS.append('linux')
|
||||||
|
ignore_warning = 'warning: ' # Ignore all common warnings on linux builds
|
||||||
setup_logging(2)
|
setup_logging(2)
|
||||||
apps = find_apps(
|
apps = find_apps(
|
||||||
args.paths,
|
args.paths,
|
||||||
recursive=False,
|
recursive=args.recursive,
|
||||||
target=args.target,
|
target=args.target,
|
||||||
build_dir='build_@t_@w',
|
build_dir='build_@t_@w',
|
||||||
config_rules_str=args.rules,
|
config_rules_str=args.rules,
|
||||||
build_log_path='build_log.txt',
|
build_log_path='build_log.txt',
|
||||||
size_json_path='size.json',
|
size_json_path='size.json' if not args.linux else None,
|
||||||
check_warnings=True,
|
check_warnings=True,
|
||||||
preserve=not args.delete,
|
preserve=not args.delete,
|
||||||
manifest_files=args.manifests,
|
manifest_files=args.manifests,
|
||||||
@ -54,5 +59,5 @@ if __name__ == '__main__':
|
|||||||
build_apps(apps,
|
build_apps(apps,
|
||||||
dry_run=False,
|
dry_run=False,
|
||||||
keep_going=False,
|
keep_going=False,
|
||||||
ignore_warning_strs=os.environ['EXPECTED_WARNING']
|
ignore_warning_strs=ignore_warning)
|
||||||
if 'EXPECTED_WARNING' in os.environ else None))
|
)
|
||||||
|
3
examples/.build-test-rules.yml
Normal file
3
examples/.build-test-rules.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
examples/esp_netif/multiple_netifs:
|
||||||
|
disable:
|
||||||
|
- if: IDF_TARGET != "esp32"
|
@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16)
|
|||||||
# For ESP32 platform target
|
# For ESP32 platform target
|
||||||
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
|
||||||
|
|
||||||
if(${IDF_TARGET} STREQUAL "linux")
|
if("${IDF_TARGET}" STREQUAL "linux")
|
||||||
# For linux-target we have two options:
|
# For linux-target we have two options:
|
||||||
# - With lwIP (must be defined on command line, e.g. idf.py -DWITH_LWIP=1)
|
# - With lwIP (must be defined on command line, e.g. idf.py -DWITH_LWIP=1)
|
||||||
# access networking from linux `tap` interface (TAP networking mode)
|
# access networking from linux `tap` interface (TAP networking mode)
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
CONFIG_IDF_TARGET="linux"
|
|
||||||
# CONFIG_ESP_EVENT_POST_FROM_ISR is not set
|
|
||||||
|
3
examples/mqtt/sdkconfig.defaults.esp32h2
Normal file
3
examples/mqtt/sdkconfig.defaults.esp32h2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
CONFIG_IDF_TARGET="esp32h2"
|
||||||
|
CONFIG_EXAMPLE_CONNECT_WIFI=n
|
||||||
|
CONFIG_EXAMPLE_CONNECT_ETHERNET=y
|
2
examples/mqtt/sdkconfig.defaults.linux
Normal file
2
examples/mqtt/sdkconfig.defaults.linux
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
CONFIG_IDF_TARGET="linux"
|
||||||
|
# CONFIG_ESP_EVENT_POST_FROM_ISR is not set
|
Reference in New Issue
Block a user