Skip to content

Commit

Permalink
Validate target names passed to build_examples.py (#24644)
Browse files Browse the repository at this point in the history
* Validate target names passed to build_examples.py

Skipping invalid target names might lead to false positive CI passes in
case when target name is invalid. In such case test was never executed.

* Fix target names for Tizen examples CI checks

* Restyled by isort

* Add libwebsockets submodule to Tizen platform

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jul 18, 2024
1 parent c5ed485 commit ba2f69c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/examples-tizen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ jobs:
--enable-flashbundle \
--target tizen-arm-all-clusters \
--target tizen-arm-all-clusters-minimal-no-wifi \
--target chip-tool-ubsan \
--target light \
--target light-no-ble-no-wifi \
--target tizen-arm-chip-tool-ubsan \
--target tizen-arm-light \
--target tizen-arm-light-no-ble-no-wifi \
build \
--copy-artifacts-to out/artifacts \
"
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,4 @@
[submodule "third_party/libwebsockets/repo"]
path = third_party/libwebsockets/repo
url = https://github.com/warmcat/libwebsockets
platforms = linux,darwin
platforms = linux,darwin,tizen
17 changes: 15 additions & 2 deletions scripts/build/build_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

import click
import coloredlogs

import build
from builders.builder import BuilderOptions
from runner import PrintOnlyRunner, ShellRunner

import build

sys.path.append(os.path.abspath(os.path.dirname(__file__)))


Expand Down Expand Up @@ -59,6 +59,18 @@ def ValidateRepoPath(context, parameter, value):
return value


def ValidateTargetNames(context, parameter, values):
"""
Validates that the given target name is valid.
"""
for value in values:
if not any(target.StringIntoTargetParts(value.lower())
for target in build.targets.BUILD_TARGETS):
raise click.BadParameter(
"'%s' is not a valid target name." % value)
return values


@click.group(chain=True)
@click.option(
'--log-level',
Expand All @@ -69,6 +81,7 @@ def ValidateRepoPath(context, parameter, value):
'--target',
default=[],
multiple=True,
callback=ValidateTargetNames,
help='Build target(s)'
)
@click.option(
Expand Down

0 comments on commit ba2f69c

Please sign in to comment.