Skip to content

Commit c1506f3

Browse files
sxb427andy31415restyled-commits
authored
Add rule to fast compile all existing chef devices on PRs (project-chip#37914)
* Add rule to fast compile all existing chef devices * Comment informing about excluded devices * Restyled by autopep8 * Add job timeout of 60 mins for compile all chef --------- Co-authored-by: Andrei Litvin <andy314@gmail.com> Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 27a59d2 commit c1506f3

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

.github/workflows/chef.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,28 @@ jobs:
5151
run: |
5252
./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci -t linux"
5353
54+
chef_linux_all_devices:
55+
name: Chef - Linux CI Examples (All chef devices)
56+
timeout-minutes: 60
57+
runs-on: ubuntu-latest
58+
if: github.actor != 'restyled-io[bot]'
59+
60+
container:
61+
image: ghcr.io/project-chip/chip-build:119
62+
options: --user root
63+
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v4
67+
- name: Checkout submodules & Bootstrap
68+
uses: ./.github/actions/checkout-submodules-and-bootstrap
69+
with:
70+
platform: linux
71+
- name: CI Examples Linux
72+
shell: bash
73+
run: |
74+
./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci_linux"
75+
5476
chef_esp32:
5577
name: Chef - ESP32 CI Examples
5678
runs-on: ubuntu-latest

examples/chef/chef.py

+23
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap") and file != 'template.zap']
4141
_CICD_CONFIG_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cicd_config.json")
4242
_CD_STAGING_DIR = os.path.join(_CHEF_SCRIPT_PATH, "staging")
43+
_EXCLUDE_DEVICE_FROM_LINUX_CI = [ # These do not compile / deprecated.
44+
"noip_rootnode_dimmablelight_bCwGYSDpoe",
45+
"rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680",
46+
]
4347

4448
gen_dir = "" # Filled in after sample app type is read from args.
4549

@@ -382,6 +386,10 @@ def main() -> int:
382386
help=("Builds Chef examples defined in cicd_config. "
383387
"Uses specified target from -t. Chef exits after completion."),
384388
dest="ci", action="store_true")
389+
parser.add_option("", "--ci_linux",
390+
help=("Builds Chef Examples defined in cicd_config under ci_allow_list_linux. "
391+
"Devices are built without -c for faster compilation."),
392+
dest="ci_linux", action="store_true")
385393
parser.add_option(
386394
"", "--enable_ipv4", help="Enable IPv4 mDNS. Only applicable to platforms that can support IPV4 (e.g, Linux, ESP32)",
387395
action="store_true", default=False)
@@ -409,6 +417,21 @@ def main() -> int:
409417
bundle(options.build_target, device_name)
410418
exit(0)
411419

420+
#
421+
# CI Linux
422+
#
423+
424+
if options.ci_linux:
425+
for device_name in _DEVICE_LIST:
426+
if device_name in _EXCLUDE_DEVICE_FROM_LINUX_CI:
427+
continue
428+
shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}")
429+
command = f"./chef.py -br -d {device_name} -t linux"
430+
flush_print(f"Building {command}", with_border=True)
431+
shell.run_cmd(command)
432+
bundle("linux", device_name)
433+
exit(0)
434+
412435
#
413436
# CD
414437
#

0 commit comments

Comments
 (0)