[Internal] OIS environment and CI improvements #1780
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 example - Open IoT SDK | |
on: | |
push: | |
pull_request: | |
merge_group: | |
workflow_dispatch: | |
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 | |
env: | |
CHIP_NO_LOG_TIMESTAMPS: true | |
jobs: | |
pre_job: | |
runs-on: ubuntu-latest | |
# Map a step output to a job output | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@v5 | |
with: | |
# Skip concurrent workflows with the same content. | |
# Cancel running workflows from outdatead commits. | |
# Do not skip pull requests - essential for running unit-tests. | |
# Skip if an already finished duplicate run can be found. | |
concurrent_skipping: 'same_content' | |
cancel_others: 'true' | |
do_not_skip: '["workflow_dispatch", "pull_request"]' | |
skip_after_successful_duplicate: 'true' | |
openiotsdk: | |
name: Open IoT SDK examples building | |
needs: pre_job | |
env: | |
TEST_NETWORK_NAME: OIStest | |
TEST_PYTHON_VENV: out/venv | |
TEST_BUILD_PATH: out/examples | |
runs-on: ubuntu-latest | |
if: github.actor != 'restyled-io[bot]' && needs.pre_job.outputs.should_skip != 'true' | |
container: | |
image: connectedhomeip/chip-build-openiotsdk:0.7.3 | |
volumes: | |
- "/tmp/bloat_reports:/tmp/bloat_reports" | |
options: --privileged | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout submodules & Bootstrap | |
uses: ./.github/actions/checkout-submodules-and-bootstrap | |
with: | |
platform: openiotsdk | |
extra-submodule-parameters: " --recursive" | |
- name: Set up environment for size reports | |
uses: ./.github/actions/setup-size-reports | |
if: ${{ !env.ACT }} | |
with: | |
gh-context: ${{ toJson(github) }} | |
- name: Set up platform environment | |
run: | | |
scripts/setup/openiotsdk/python_env_setup.sh -p $TEST_PYTHON_VENV --controller --pyedmgr | |
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME up | |
- name: Build shell example | |
id: build_shell | |
run: | | |
scripts/examples/openiotsdk_example.sh -p $TEST_BUILD_PATH shell | |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ | |
openiotsdk release shell \ | |
$TEST_BUILD_PATH/shell/chip-openiotsdk-shell-example.elf \ | |
/tmp/bloat_reports/ | |
- name: Build lock-app example (mbedtls) | |
id: build_lock_app_mbedtls | |
run: | | |
scripts/examples/openiotsdk_example.sh -p $TEST_BUILD_PATH -b mbedtls lock-app | |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ | |
openiotsdk release lock-app-mbedtls \ | |
$TEST_BUILD_PATH/lock-app/chip-openiotsdk-lock-app-example.elf \ | |
/tmp/bloat_reports/ | |
- name: Build tv-app example | |
id: build_tv_app | |
timeout-minutes: 10 | |
run: | | |
scripts/examples/openiotsdk_example.sh -p $TEST_BUILD_PATH tv-app | |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ | |
openiotsdk release tv-app \ | |
$TEST_BUILD_PATH/tv-app/chip-openiotsdk-tv-app-example.elf \ | |
/tmp/bloat_reports/ | |
- name: Build ota-requestor-app example | |
id: build_ota_requestor_app | |
timeout-minutes: 10 | |
run: | | |
scripts/examples/openiotsdk_example.sh -p $TEST_BUILD_PATH -v 1 -V 0.0.1 ota-requestor-app | |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ | |
openiotsdk release ota-requestor-app \ | |
$TEST_BUILD_PATH/ota-requestor-app/chip-openiotsdk-ota-requestor-app-example.elf \ | |
/tmp/bloat_reports/ | |
- name: Build all-clusters-app example | |
id: build_all_clusters_app | |
timeout-minutes: 10 | |
run: | | |
scripts/examples/openiotsdk_example.sh -p $TEST_BUILD_PATH all-clusters-app | |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ | |
openiotsdk release all-clusters-app \ | |
$TEST_BUILD_PATH/all-clusters-app/chip-openiotsdk-all-clusters-app-example.elf \ | |
/tmp/bloat_reports/ | |
- name: Build unit tests (mbedtls) | |
id: build_unit_tests_mbedtls | |
run: | | |
scripts/examples/openiotsdk_example.sh -p $TEST_BUILD_PATH -b mbedtls unit-tests | |
- name: Build the OTA provider (Linux) | |
id: build_ota_provider_app | |
if: steps.build_ota_requestor_app.outcome == 'success' | |
timeout-minutes: 10 | |
run: | | |
scripts/examples/gn_build_example.sh examples/ota-provider-app/linux/ out/ota-provider chip_config_network_layer_ble=false | |
- name: "Test: shell example" | |
if: steps.build_shell.outcome == 'success' | |
run: | | |
scripts/examples/openiotsdk_example.sh -C test -e $TEST_PYTHON_VENV shell | |
- name: "Test: lock-app example (mbedtls)" | |
if: steps.build_lock_app_mbedtls.outcome == 'success' | |
run: | | |
scripts/run_in_ns.sh ${TEST_NETWORK_NAME}ns scripts/examples/openiotsdk_example.sh -C test -e $TEST_PYTHON_VENV -n ${TEST_NETWORK_NAME}tap lock-app | |
- name: "Test: tv-app example" | |
if: steps.build_tv_app.outcome == 'success' | |
timeout-minutes: 10 | |
run: | | |
scripts/run_in_ns.sh ${TEST_NETWORK_NAME}ns scripts/examples/openiotsdk_example.sh -C test -e $TEST_PYTHON_VENV -n ${TEST_NETWORK_NAME}tap tv-app | |
- name: "Test: ota-requestor-app example" | |
if: steps.build_ota_requestor_app.outcome == 'success' && steps.build_ota_provider_app.outcome == 'success' | |
timeout-minutes: 30 | |
run: | | |
mkdir -p out/binaries/ota-requestor-app | |
cp $TEST_BUILD_PATH/ota-requestor-app/chip-openiotsdk-ota-requestor-app-example.elf out/binaries/ota-requestor-app | |
scripts/examples/openiotsdk_example.sh -p $TEST_BUILD_PATH -c -v 2 -V 0.0.2 ota-requestor-app | |
cp $TEST_BUILD_PATH/ota-requestor-app/chip-openiotsdk-ota-requestor-app-example.ota out/binaries/ota-requestor-app | |
scripts/run_in_ns.sh ${TEST_NETWORK_NAME}ns scripts/examples/openiotsdk_example.sh -C test -e $TEST_PYTHON_VENV -p out/binaries -v 2 -V 0.0.2 -n ${TEST_NETWORK_NAME}tap ota-requestor-app | |
- name: "Test: all-clusters-app example" | |
if: steps.build_all_clusters_app.outcome == 'success' | |
timeout-minutes: 5 | |
run: | | |
scripts/run_in_ns.sh ${TEST_NETWORK_NAME}ns scripts/examples/openiotsdk_example.sh -C test -e $TEST_PYTHON_VENV -n ${TEST_NETWORK_NAME}tap all-clusters-app | |
- name: "Test: unit-tests (mbedtls)" | |
if: steps.build_unit_tests_mbedtls.outcome == 'success' | |
run: | | |
scripts/examples/openiotsdk_example.sh -C test -e $TEST_PYTHON_VENV unit-tests | |
- name: Build lock-app example (psa) | |
id: build_lock_app_psa | |
run: | | |
scripts/examples/openiotsdk_example.sh -p $TEST_BUILD_PATH -c -b psa lock-app | |
- name: Build unit tests (psa) | |
id: build_unit_tests_psa | |
run: | | |
scripts/examples/openiotsdk_example.sh -p $TEST_BUILD_PATH -b psa unit-tests | |
- name: "Test: lock-app example (psa)" | |
if: steps.build_lock_app_psa.outcome == 'success' | |
run: | | |
scripts/run_in_ns.sh ${TEST_NETWORK_NAME}ns scripts/examples/openiotsdk_example.sh -C test -e $TEST_PYTHON_VENV -n ${TEST_NETWORK_NAME}tap lock-app | |
- name: "Test: unit-tests (psa)" | |
if: steps.build_unit_tests_psa.outcome == 'success' | |
run: | | |
scripts/examples/openiotsdk_example.sh -C test -e $TEST_PYTHON_VENV unit-tests | |
- name: Archive Map files | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: map-files-${{ matrix.cryptoBackend }} | |
path: | | |
$TEST_BUILD_PATH/shell/*.map | |
$TEST_BUILD_PATH/lock-app/*.map | |
$TEST_BUILD_PATH/ota-requestor-app/*.map | |
$TEST_BUILD_PATH/all-clusters-app/*.map | |
$TEST_BUILD_PATH/tv-app/*.map | |
$TEST_BUILD_PATH/unit-tests/*.map |