Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick chef work from master into Interop testing te9 #19602

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7f53ca2
fix: enabled extended discovery on chef/nrfconnect (#18022)
rochaferraz May 4, 2022
a0c43ea
Chef Refactor (#18009)
cpagravel May 10, 2022
df5d8cc
Chef - Fix typo doRpc -> do_rpc (#18278)
cpagravel May 11, 2022
bd1a70c
[nrfconnect] Added kconfig option to enable extended discovery (#18367)
kkasperczyk-no May 13, 2022
c04af79
Chef - Add RPC support for NRF (#17774) (#18282)
cpagravel May 18, 2022
12fbc53
[EFR32] Add support for efr32 MG24 for the chef example (#18621)
mkardous-silabs May 20, 2022
da514da
Device info provider efr32, some fixes for nrf and linux (CHEF DIR ON…
andy31415 May 26, 2022
cc6c6fe
RPC support in the example tool chef linux build (#18294)
MtTsai May 30, 2022
734b9e2
Chef - Add output from stateful_shell (#18918)
cpagravel May 31, 2022
bedb58a
Stateful shell compatibility improvements (#19006)
cpagravel Jun 2, 2022
4149978
Chef - Preserve returncode in stateful_shell (#19144)
cpagravel Jun 3, 2022
c6614f3
Chef CI (#18859)
aBozowski Jun 6, 2022
9972432
Chef - Add BUILD.gn and unit tests for stateful_shell.py (#19205)
cpagravel Jun 8, 2022
3b59970
Chef - Use temporary folder for stateful_shell artifacts (#19362)
cpagravel Jun 10, 2022
45d1cbc
Chef - Add sample_app_util for parsing zap files (#19087)
cpagravel Jun 10, 2022
43b5b70
Chef - Fix: wrong order for clearing directory on zzap run (#19324)
cpagravel Jun 13, 2022
99fe51f
Remove test_zap_file_parser.py from sources as it is already in tests…
andy31415 Jun 13, 2022
5724126
Chef - Revert lighting app rename from #17983
cpagravel Jun 15, 2022
24b8799
Chef - Check in generated files for lighting-app to fix CI
cpagravel Jun 15, 2022
ef27148
Chef CI - Change image to 0.5.64 for compatability with TE9
cpagravel Jun 15, 2022
5b550cb
bump ca-certificate version in cirque docker (#19368)
yunhanw-google Jun 9, 2022
89b8bad
Update pigweed to e61718e9f4e5c (#18955)
May 31, 2022
a184a5e
Fix broken Chef NRF build caused by #18955 (#19204)
cpagravel Jun 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions .github/workflows/chef.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Build Chef CI examples on all platforms

on:
push:
pull_request:

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }}
cancel-in-progress: true

jobs:

validate_zzz:
name: Chef - Validate cached ZAP output
runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'
container:
image: connectedhomeip/chip-build:0.5.64
options: --user root
steps:
- uses: Wandalen/wretry.action@v1.0.15
name: Checkout
with:
action: actions/checkout@v3
with: |
token: ${{ github.token }}
attempt_limit: 3
attempt_delay: 2000
- name: Chef validate zzz
shell: bash
run: |
cd examples/chef
python3 chef.py --validate_zzz

chef_linux:
name: Chef - Linux CI Examples
needs: validate_zzz
runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build:0.5.64
options: --user root

steps:
- uses: Wandalen/wretry.action@v1.0.15
name: Checkout
with:
action: actions/checkout@v3
with: |
token: ${{ github.token }}
attempt_limit: 3
attempt_delay: 2000
- name: CI Examples Linux
shell: bash
run: |
./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci -t linux"

chef_esp32:
name: Chef - ESP32 CI Examples
needs: validate_zzz
runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build-esp32:0.5.64
options: --user root

steps:
- uses: Wandalen/wretry.action@v1.0.15
name: Checkout
with:
action: actions/checkout@v3
with: |
token: ${{ github.token }}
attempt_limit: 3
attempt_delay: 2000
- name: CI Examples ESP32
shell: bash
run: |
./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci -t esp32"

chef_nrfconnect:
name: Chef - NRFConnect CI Examples
needs: validate_zzz
runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build-nrf-platform:0.5.64
options: --user root

steps:
- uses: Wandalen/wretry.action@v1.0.15
name: Checkout
with:
action: actions/checkout@v3
with: |
token: ${{ github.token }}
attempt_limit: 3
attempt_delay: 2000
- name: CI Examples NRFConnect
shell: bash
run: |
./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci -t nrfconnect"
2 changes: 2 additions & 0 deletions .restyled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ exclude:
- "src/controller/python/chip/clusters/Objects.py" # generated file, no point to restyle
- "src/controller/python/chip/clusters/CHIPClusters.py" # generated file, no point to restyle
- "scripts/idl/tests/outputs/**/*" # Matches generated output 1:1
- "examples/chef/sample_app_util/test_files/*.yaml"
- "examples/chef/zzz_generated/**/*"


changed_paths:
Expand Down
1 change: 1 addition & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
if (chip_link_tests) {
deps = [
"//:fake_platform_tests",
"//examples/chef:chef.tests",
"//scripts/build:build_examples.tests",
"//scripts/idl:idl.tests",
"//src:tests_run",
Expand Down
1 change: 1 addition & 0 deletions config/ameba/chip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ string(APPEND CHIP_GN_ARGS "pw_assert_BACKEND = \"//third_party/connectedhomeip/
string(APPEND CHIP_GN_ARGS "pw_sys_io_BACKEND = \"//third_party/connectedhomeip/examples/platform/ameba/pw_sys_io:pw_sys_io_ameba\"\n")
string(APPEND CHIP_GN_ARGS "dir_pw_third_party_nanopb = \"//third_party/connectedhomeip/third_party/nanopb/repo\"\n")
string(APPEND CHIP_GN_ARGS "pw_build_LINK_DEPS = [\"//third_party/connectedhomeip/third_party/pigweed/repo/pw_assert:impl\", \"//third_party/connectedhomeip/third_party/pigweed/repo/pw_log:impl\"]\n")
string(APPEND CHIP_GN_ARGS "pw_rpc_CONFIG = \"//third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc:disable_global_mutex\"")
endif (matter_enable_rpc)

# Build ota-requestor
Expand Down
1 change: 1 addition & 0 deletions config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ if(CONFIG_ENABLE_PW_RPC)
chip_gn_arg_append("pw_trace_BACKEND" "\"//third_party/connectedhomeip/third_party/pigweed/repo/pw_trace_tokenized\"")
chip_gn_arg_append("dir_pw_third_party_nanopb" "\"//third_party/connectedhomeip/third_party/nanopb/repo\"")
chip_gn_arg_append("pw_build_LINK_DEPS" "[\"\$dir_pw_assert:impl\", \"\$dir_pw_log:impl\"]")
chip_gn_arg_append("pw_rpc_CONFIG" "\"//third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc:disable_global_mutex\"")
endif()

if (CONFIG_BUILD_CHIP_TESTS)
Expand Down
4 changes: 4 additions & 0 deletions config/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ target_sources(${APP_TARGET} PRIVATE
${MBED_COMMON}/util/PigweedLogger.cpp
)

list(APPEND CHIP_DEFINES
PW_RPC_USE_GLOBAL_MUTEX=0
)

target_include_directories(${APP_TARGET} PRIVATE
${PIGWEED_ROOT}/pw_sys_io/public
${PIGWEED_ROOT}/pw_assert/public
Expand Down
1 change: 1 addition & 0 deletions config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ pw_build_LINK_DEPS = [
]

dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo"
pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex"

chip_enable_pw_rpc = true
5 changes: 5 additions & 0 deletions config/nrfconnect/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ config CHIP_QSPI_NOR
bool
default y

# Enable extended discovery
config CHIP_EXTENDED_DISCOVERY
bool
default y

# Enable OpenThread

config NET_L2_OPENTHREAD
Expand Down
6 changes: 6 additions & 0 deletions config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ config CHIP_OTA_IMAGE_INCLUDE_MCUBOOT

endif

config CHIP_EXTENDED_DISCOVERY
bool "Enable extended discovery"
help
Enables the device to advertise commissionable service when not in the
commissioning mode.

module = MATTER
module-str = Matter
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ include(${pigweed_dir}/pw_protobuf_compiler/proto.cmake)

set(dir_pw_third_party_nanopb "${chip_dir}/third_party/nanopb/repo" CACHE STRING "" FORCE)

pw_set_module_config(pw_rpc_CONFIG pw_rpc.disable_global_mutex_config)
pw_set_backend(pw_log pw_log_basic)
pw_set_backend(pw_assert pw_assert_log)
pw_set_backend(pw_sys_io pw_sys_io.ameba)
Expand Down
3 changes: 3 additions & 0 deletions examples/all-clusters-app/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ flashing_script()
if (CONFIG_ENABLE_PW_RPC)
get_filename_component(CHIP_ROOT ./third_party/connectedhomeip REALPATH)
include(third_party/connectedhomeip/third_party/pigweed/repo/pw_build/pigweed.cmake)

pw_set_module_config(pw_rpc_CONFIG pw_rpc.disable_global_mutex_config)

pw_set_backend(pw_log pw_log_basic)
pw_set_backend(pw_assert pw_assert_log)
pw_set_backend(pw_sys_io pw_sys_io.esp32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,3 @@
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00

#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 2000_ms32

#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1
43 changes: 43 additions & 0 deletions examples/chef/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (c) 2022 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

import("//build_overrides/pigweed.gni")
import("$dir_pw_build/python.gni")

pw_python_package("chef") {
setup = [ "setup.py" ]

inputs = [
"sample_app_util/test_files/sample_zap_file.zap",
"sample_app_util/test_files/sample_zap_file_hashmeta.yaml",
]

sources = [
"__init__.py",
"chef.py",
"constants.py",
"sample_app_util/__init__.py",
"sample_app_util/sample_app_util.py",
"sample_app_util/zap_file_parser.py",
"stateful_shell.py",
]

tests = [
"test_stateful_shell.py",
"sample_app_util/test_zap_file_parser.py",
]
}
61 changes: 61 additions & 0 deletions examples/chef/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,64 @@ Run `chef.py -h` to see the available commands
3. Click on `Save As` and save the file with the name of your new device type
into the `devices` folder. This device is now available for the script. See
`chef.py -h` for a list of devices available.

## CI

### zzz_generated

To eliminate a dependency on ZAP in CI jobs, all chef examples found in
`examples/chef/devices` must have their output from the ZAP tool cached in
`examples/chef/zzz_generated`.

To generate the cache, one may execute chef with the option `--generate_zzz`.
This will run ZAP for all devices in `examples/chef/devices` and place the
output into the appropriate directory structure.

Other than the output from the ZAP tool, the cache directory contains two
additional files for each device:

- `INPUTMD5.txt` contains the md5 hex digest of the ZAP file used to generate
the directory.
- `ZAPSHA.txt` contains the commit of ZAP in the user's tree when the
directory was generated.

```
zzz_generated/
└── lighting-app
├── INPUTMD5.txt
├── zap-generated
│   ├── access.h
│   ├── af-gen-event.h
│   └── ...
└── ZAPSHA.txt
```

These additional files will be used by the CI jobs to validate whether the cache
must be regenerated i.e. regeneration is needed when ZAP or the input ZAP files
change.

### Workflow

All CI jobs for chef can be found in `.github/workflows/chef.yaml`.

#### Validate

The workflow begins by calling chef with `--validate_zzz`.

`--validate_zzz` will recalculate the current ZAP commit and the md5 of all
example ZAP files and compare with what is committed to `zzz_generated`.

If the validation job fails, it will provide instructions to repair
`zzz_generated` and no builds will run.

#### Build

Once the validation job is complete, there is a separate job for each platform,
which run in parallel.

These jobs use a platform-specific image with base `chip-build`.

The build jobs call chef with the options `--ci -t <PLATFORM>`. The `--ci`
option will execute builds for all devices specified in `_CI_ALLOW_LIST` defined
in `chef.py` (so long as these devices are also in `/devices`) on the specified
platform.
Empty file added examples/chef/__init__.py
Empty file.
Loading