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

Chef CI #18859

Merged
merged 27 commits into from
Jun 6, 2022
Merged

Chef CI #18859

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f4cbde1
Squashed commit of the following:
aBozowski May 26, 2022
75d5952
Regen zzz after merge; job WAI
aBozowski May 26, 2022
828a29e
Lic
aBozowski May 26, 2022
54eca47
Squashed commit of the following:
aBozowski May 28, 2022
c8ce60f
Fix indent
aBozowski May 28, 2022
b634c91
Squashed commit of the following:
aBozowski May 31, 2022
f231c8a
Merge branch 'master' into bozowski/chef-ci-merge
aBozowski May 31, 2022
c12ba27
Squashed commit of the following:
aBozowski Jun 1, 2022
843c901
Merge branch 'master' into bozowski/chef-ci-merge
aBozowski Jun 1, 2022
ca7f2eb
chef generate_zzz
aBozowski Jun 1, 2022
c8456a7
Simplify md5
aBozowski Jun 1, 2022
6537adb
Restyle, dedent, fix instructions
aBozowski Jun 1, 2022
1b7786e
Missed type hint
aBozowski Jun 1, 2022
bfa6278
Missed return code
aBozowski Jun 1, 2022
f04b770
Squashed commit of the following:
aBozowski Jun 2, 2022
15d187b
Exclude chef zzz_generated from restyle
aBozowski Jun 2, 2022
2d471f0
Exclude restyle
aBozowski Jun 2, 2022
2e77e8d
Squashed commit of the following:
aBozowski Jun 2, 2022
9ff2798
Merge branch 'master' into bozowski/chef-ci-merge
aBozowski Jun 2, 2022
47d2065
Misspelled word
aBozowski Jun 2, 2022
c6c29ac
--generate_zzz after zap file changed in master
aBozowski Jun 3, 2022
ec4d267
propagate nrf error, fix esp32
aBozowski Jun 3, 2022
9e6f4e1
Fix overwrite
aBozowski Jun 3, 2022
7b0c85e
Merge branch 'project-chip:master' into bozowski/chef-ci-merge
aBozowski Jun 4, 2022
3869228
Fix dedents
aBozowski Jun 4, 2022
fbcc330
generate_zzz and update workflow image version
aBozowski Jun 4, 2022
37e5c88
Merge branch 'project-chip:master' into bozowski/chef-ci-merge
aBozowski 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.77
options: --user root
steps:
- uses: Wandalen/[email protected]
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.77
options: --user root

steps:
- uses: Wandalen/[email protected]
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.77
options: --user root

steps:
- uses: Wandalen/[email protected]
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.77
options: --user root

steps:
- uses: Wandalen/[email protected]
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"
1 change: 1 addition & 0 deletions .restyled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ 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/zzz_generated/**/*"


changed_paths:
Expand Down
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.
Loading