diff --git a/.github/workflows/artifacts.yaml b/.github/workflows/artifacts.yaml new file mode 100644 index 00000000000000..002d945ebc0f09 --- /dev/null +++ b/.github/workflows/artifacts.yaml @@ -0,0 +1,17 @@ +name: 'Delete old artifacts' +on: + schedule: + - cron: '0 * * * *' # every hour + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + delete-artifacts: + runs-on: ubuntu-latest + steps: + - uses: kolpav/purge-artifacts-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + expire-in: 14days diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml new file mode 100644 index 00000000000000..39efab85d61e66 --- /dev/null +++ b/.github/workflows/bloat_check.yaml @@ -0,0 +1,57 @@ +# Copyright (c) 2020 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: Bloat Check +on: + schedule: + - cron: "*/5 * * * *" + +concurrency: + group: ${{ github.workflow }} + # Don't cancel an already-running bloat check just because it took more + # than 5 minutes to run and our cron job is trying to schedule a new one. + cancel-in-progress: false + +jobs: + pull_request_update: + name: Report on pull requests + + runs-on: ubuntu-latest + + container: + image: connectedhomeip/chip-build:0.5.77 + + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + submodules: true + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + + - name: Report + run: | + scripts/tools/memory/gh_report.py \ + --verbose \ + --report-increases 0.2 \ + --report-pr \ + --github-comment \ + --github-limit-artifact-pages 50 \ + --github-limit-artifacts 500 \ + --github-limit-comments 20 \ + --github-repository project-chip/connectedhomeip \ + --github-api-token "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000000000..7b1a88b1b3ee9a --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,382 @@ +# Copyright (c) 2020-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: Builds + +on: + push: + pull_request: + 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 + +jobs: + build_linux_gcc_debug: + name: Build on Linux (gcc_debug) + timeout-minutes: 85 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build:0.5.77 + volumes: + - "/tmp/log_output:/tmp/test_logs" + options: --sysctl "net.ipv6.conf.all.disable_ipv6=0 + net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" + + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Dump Concurrency context + env: + CONCURRENCY_CONTEXT: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} + run: echo "$CONCURRENCY_CONTEXT" + - 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Setup Build + run: scripts/build/gn_gen.sh --args="chip_config_memory_debug_checks=true chip_config_memory_debug_dmalloc=true" + - name: Run Build + timeout-minutes: 20 + run: scripts/run_in_build_env.sh "ninja -C ./out" + - name: Run Tests + timeout-minutes: 30 + run: scripts/tests/gn_tests.sh + # TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227 + # TODO https://github.com/project-chip/connectedhomeip/issues/1512 + # - name: Run Code Coverage + # if: ${{ contains('main', env.BUILD_TYPE) }} + # run: scripts/tools/codecoverage.sh + # - name: Upload Code Coverage + # if: ${{ contains('main', env.BUILD_TYPE) }} + # run: bash <(curl -s https://codecov.io/bash) + - name: Setup Build Without Detail Logging + run: scripts/build/gn_gen.sh --args="chip_detail_logging=false" + - name: Run Build Without Detail Logging + timeout-minutes: 20 + run: scripts/run_in_build_env.sh "ninja -C ./out" + - name: Setup Build Without Progress Logging + run: scripts/build/gn_gen.sh --args="chip_detail_logging=false chip_progress_logging=false" + - name: Run Build Without Progress Logging + timeout-minutes: 20 + run: scripts/run_in_build_env.sh "ninja -C ./out" + - name: Setup Build Without Error Logging + run: scripts/build/gn_gen.sh --args="chip_detail_logging=false chip_progress_logging=false chip_error_logging=false" + - name: Run Build Without Error Logging + timeout-minutes: 20 + run: scripts/run_in_build_env.sh "ninja -C ./out" + build_linux: + name: Build on Linux (fake, gcc_release, clang, simulated) + timeout-minutes: 120 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build:0.5.77 + volumes: + - "/tmp/log_output:/tmp/test_logs" + options: --sysctl "net.ipv6.conf.all.disable_ipv6=0 + net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" + + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Dump Concurrency context + env: + CONCURRENCY_CONTEXT: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} + run: echo "$CONCURRENCY_CONTEXT" + - 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: Initialize CodeQL + # if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/master' }} + # uses: github/codeql-action/init@v1 + # with: + # languages: "cpp" + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Setup and Build Simulated Device + timeout-minutes: 20 + run: | + BUILD_TYPE=simulated + GN_ARGS='chip_tests_zap_config="app1" chip_project_config_include_dirs=["../../examples/placeholder/linux/apps/app1/include", "../../config/standalone"] chip_config_network_layer_ble=false' + CHIP_ROOT_PATH=examples/placeholder/linux + CHIP_ROOT_PATH="$CHIP_ROOT_PATH" BUILD_TYPE="$BUILD_TYPE" scripts/build/gn_gen.sh --args="$GN_ARGS" + scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" + - name: Setup Build, Run Build and Run Tests + timeout-minutes: 90 + run: | + for BUILD_TYPE in gcc_release clang; do + case $BUILD_TYPE in + "gcc_release") GN_ARGS='is_debug=false';; + "clang") GN_ARGS='is_clang=true';; + esac + + BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands + scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" + BUILD_TYPE=$BUILD_TYPE scripts/tests/gn_tests.sh + done + - name: Clang-tidy validation + timeout-minutes: 45 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/run-clang-tidy-on-compile-commands.py \ + --no-log-timestamps \ + --compile-database out/clang/compile_commands.json \ + check \ + " + - name: Run Tests with sanitizers + timeout-minutes: 60 + env: + LSAN_OPTIONS: detect_leaks=0 + run: | + # for BUILD_TYPE in asan msan tsan ubsan; do + for BUILD_TYPE in asan tsan ubsan; do + case $BUILD_TYPE in + "asan") GN_ARGS='is_clang=true is_asan=true';; + "msan") GN_ARGS='is_clang=true is_msan=true';; + "tsan") GN_ARGS='is_clang=true is_tsan=true chip_enable_wifi=false';; + "ubsan") GN_ARGS='is_clang=true is_ubsan=true';; + esac + + scripts/build/gn_gen.sh --args="$GN_ARGS" + scripts/tests/gn_tests.sh + done + - name: Build using build_examples.py + timeout-minutes: 60 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --no-log-timestamps \ + --target linux-x64-all-clusters-ipv6only-clang \ + --target linux-x64-chip-tool-ipv6only-clang \ + --target linux-x64-minmdns-ipv6only-clang \ + --target linux-x64-rpc-console \ + build \ + " + - name: Run fake linux tests with build_examples + timeout-minutes: 15 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --no-log-timestamps --target linux-fake-tests build" + + # TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227 + # TODO https://github.com/project-chip/connectedhomeip/issues/1512 + # - name: Run Code Coverage + # if: ${{ contains('main', env.BUILD_TYPE) }} + # run: scripts/tools/codecoverage.sh + # - name: Upload Code Coverage + # if: ${{ contains('main', env.BUILD_TYPE) }} + # run: bash <(curl -s https://codecov.io/bash) + # - name: Remove third_party binaries for CodeQL Analysis + # run: find out -type d -name "third_party" -exec rm -rf {} + + # - name: Remove dbus binaries for CodeQL Analysis + # run: find out -type d -name "dbus" -exec rm -rf {} + + # - name: Remove nrfxlib binaries for CodeQL Analysis + # run: find . -type d -name "nrfxlib" -exec rm -rf {} + + # - name: Perform CodeQL Analysis + # if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/master' }} + # uses: github/codeql-action/analyze@v1 + build_linux_python_lib: + name: Build on Linux (python_lib) + timeout-minutes: 60 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build:0.5.77 + volumes: + - "/tmp/log_output:/tmp/test_logs" + options: --sysctl "net.ipv6.conf.all.disable_ipv6=0 + net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" + + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Dump Concurrency context + env: + CONCURRENCY_CONTEXT: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} + run: echo "$CONCURRENCY_CONTEXT" + - 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Setup Build, Run Build and Run Tests + timeout-minutes: 50 + run: | + scripts/build/gn_gen.sh --args="enable_rtti=true enable_pylib=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false" + scripts/run_in_build_env.sh "ninja -C ./out" + scripts/tests/gn_tests.sh + - name: Run Python library specific unit tests + timeout-minutes: 5 + run: | + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/chip-0.0-cp37-abi3-linux_x86_64.whl' + scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' + + build_darwin: + name: Build on Darwin (clang, python_lib, simulated) + timeout-minutes: 200 + runs-on: macos-latest + if: github.actor != 'restyled-io[bot]' + + 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: Initialize CodeQL + # if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/master' }} + # uses: github/codeql-action/init@v1 + # with: + # languages: "cpp" + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform darwin + - name: Setup Environment + run: brew install openssl pkg-config + - name: Try to ensure the directory for diagnostic log collection exists + run: | + mkdir -p ~/Library/Logs/DiagnosticReports || true + - name: Fix pkgconfig link + working-directory: /usr/local/lib/pkgconfig + run: | + pwd + ls -la /usr/local/Cellar/ + ls -la /usr/local/Cellar/openssl@1.1 + OPEN_SSL_VERSION=`ls -la /usr/local/Cellar/openssl@1.1 | cat | tail -n1 | awk '{print $NF}'` + ln -s /usr/local/Cellar/openssl@1.1/$OPEN_SSL_VERSION/lib/pkgconfig/* . + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Setup and Build Simulated Device + timeout-minutes: 20 + run: | + BUILD_TYPE=simulated + GN_ARGS='chip_tests_zap_config="app1" chip_project_config_include_dirs=["../../examples/placeholder/linux/apps/app1/include", "../../config/standalone"] chip_config_network_layer_ble=false' + CHIP_ROOT_PATH=examples/placeholder/linux + CHIP_ROOT_PATH="$CHIP_ROOT_PATH" BUILD_TYPE="$BUILD_TYPE" scripts/build/gn_gen.sh --args="$GN_ARGS" + scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" + - name: Setup Build, Run Build and Run Tests + timeout-minutes: 120 + run: | + for BUILD_TYPE in default python_lib; do + case $BUILD_TYPE in + # We want to build various standalone example apps + # (similar to what examples-linux-standalone.yaml + # does), so use target_os="all" to get those picked + # up as part of the "unified" build. But then to + # save CI resources we want to exclude a few + # redundant things: + # + # * the mbedtls build, since we don't really plan to + # use that on Darwin. + # * the "host clang" build, which uses the pigweed + # clang. + "default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false enable_host_gcc_mbedtls_build=false';; + "python_lib") GN_ARGS='enable_rtti=true enable_pylib=true';; + esac + BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands + scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" + BUILD_TYPE=$BUILD_TYPE scripts/tests/gn_tests.sh + done + - name: Clang-tidy validation + timeout-minutes: 45 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/run-clang-tidy-on-compile-commands.py \ + --no-log-timestamps \ + --compile-database out/default/compile_commands.json \ + check \ + " + - name: Uploading diagnostic logs + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: crash-log-darwin + path: ~/Library/Logs/DiagnosticReports/ + # - name: Perform CodeQL Analysis + # if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/master' }} + # uses: github/codeql-action/analyze@v1 + # TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227 + # TODO https://github.com/project-chip/connectedhomeip/issues/1512 + # - name: Run Code Coverage + # if: ${{ contains('main', env.BUILD_TYPE) }} + # run: scripts/tools/codecoverage.sh + # - name: Upload Code Coverage + # if: ${{ contains('main', env.BUILD_TYPE) }} + # run: bash <(curl -s https://codecov.io/bash) diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml new file mode 100644 index 00000000000000..ca77207d322d94 --- /dev/null +++ b/.github/workflows/cirque.yaml @@ -0,0 +1,133 @@ +# Copyright (c) 2020 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: Cirque + +on: + push: + pull_request: + 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 + +jobs: + cirque: + name: Cirque + timeout-minutes: 75 + + env: + DOCKER_RUN_VERSION: 0.5.56 + GITHUB_CACHE_PATH: /tmp/cirque-cache/ + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + # need to run with privilege, which isn't supported by job.XXX.contaner + # https://github.com/actions/container-action/issues/2 + # container: + # image: connectedhomeip/chip-build-cirque:0.5.77 + # volumes: + # - "/tmp:/tmp" + # - "/dev/pts:/dev/pts" + # env: + # LOG_DIR: /tmp/cirque_test_output/ + # CLEANUP_DOCKER_FOR_CI: 1 + # options: "--privileged" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux + + - name: Get cirque cache key + id: cirque-key + run: | + echo "::set-output name=val::$(scripts/tests/cirque_tests.sh cachekeyhash)" + + - name: Cache + uses: actions/cache@v2 + if: ${{ !env.ACT }} + id: cache + with: + path: ${{ env.GITHUB_CACHE_PATH }} + key: ${{ runner.os }}-cirque-${{ steps.cirque-key.outputs.val }} + restore-keys: | + ${{ runner.os }}-cirque- + + - name: Bootstrap + timeout-minutes: 10 + run: | + integrations/docker/images/chip-build-cirque/run.sh \ + --env GITHUB_ACTION_RUN=1 \ + --env GITHUB_CACHE_PATH=${{ env.GITHUB_CACHE_PATH }} \ + --volume /tmp:/tmp \ + -- scripts/build/gn_bootstrap.sh + + - name: Cirque Bootstrap + timeout-minutes: 15 + run: | + integrations/docker/images/chip-build-cirque/run.sh \ + --env GITHUB_ACTION_RUN=1 \ + --env GITHUB_CACHE_PATH=${{ env.GITHUB_CACHE_PATH }} \ + --volume /tmp:/tmp \ + -- scripts/tests/cirque_tests.sh bootstrap + - name: Artifact suffix + id: outsuffix + uses: haya14busa/action-cond@v1.0.0 + if: ${{ !env.ACT }} + with: + cond: ${{ github.event.pull_request.number == '' }} + if_true: "${{ github.sha }}" + if_false: "pull-${{ github.event.pull_request.number }}" + - name: Build Binaries + timeout-minutes: 30 + run: | + integrations/docker/images/chip-build-cirque/run.sh \ + --env GITHUB_ACTION_RUN=1 \ + --env GITHUB_CACHE_PATH=${{ env.GITHUB_CACHE_PATH }} \ + --volume /tmp:/tmp \ + -- ./gn_build.sh \ + chip_build_tests=false \ + chip_enable_wifi=false \ + chip_im_force_fabric_quota_check=true \ + enable_host_gcc_build=true \ + enable_host_gcc_mbedtls_build=false \ + enable_host_clang_build=false \ + enable_fake_tests=false + - name: Run Tests + timeout-minutes: 25 + run: | + integrations/docker/images/chip-build-cirque/run.sh \ + --env LOG_DIR=/tmp/cirque_test_output \ + --env CLEANUP_DOCKER_FOR_CI=1 \ + --env GITHUB_ACTION_RUN=1 \ + --privileged \ + --volume /tmp:/tmp \ + --volume /dev/pts:/dev/pts \ + -- scripts/tests/cirque_tests.sh run_all_tests + - name: Uploading Binaries + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: cirque_log-${{steps.outsuffix.outputs.value}}-logs + path: /tmp/cirque_test_output/ diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml new file mode 100644 index 00000000000000..cff5d501b5d6ed --- /dev/null +++ b/.github/workflows/darwin-tests.yaml @@ -0,0 +1,137 @@ +# 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. + +name: Darwin Tests + +on: + push: + pull_request: + 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 + +jobs: + test_suites_chip_tool_darwin: + name: Test Suites - Darwin + timeout-minutes: 120 + + strategy: + matrix: + build_variant: [no-ble-asan] + env: + BUILD_VARIANT: ${{matrix.build_variant}} + + if: github.actor != 'restyled-io[bot]' + runs-on: macos-latest + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform darwin + - name: Setup Environment + # coreutils for stdbuf + run: brew install openssl pkg-config coreutils + - name: + Try to ensure the directories for core dumping and diagnostic + log collection exist and we can write them. + run: | + sudo chown ${USER} /cores || true + mkdir -p ~/Library/Logs/DiagnosticReports || true + mkdir objdir-clone || true + - name: Fix pkgconfig link + working-directory: /usr/local/lib/pkgconfig + run: | + pwd + ls -la /usr/local/Cellar/ + ls -la /usr/local/Cellar/openssl@1.1 + OPEN_SSL_VERSION=`ls -la /usr/local/Cellar/openssl@1.1 | cat | tail -n1 | awk '{print $NF}'` + ln -s /usr/local/Cellar/openssl@1.1/$OPEN_SSL_VERSION/lib/pkgconfig/* . + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: + bootstrap-logs-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build Apps + timeout-minutes: 30 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target darwin-x64-darwin-framework-tool-${BUILD_VARIANT} \ + --target darwin-x64-all-clusters-${BUILD_VARIANT} \ + --target darwin-x64-lock-${BUILD_VARIANT} \ + --target darwin-x64-ota-provider-${BUILD_VARIANT} \ + --target darwin-x64-ota-requestor-${BUILD_VARIANT} \ + --target darwin-x64-tv-app-${BUILD_VARIANT} \ + build \ + --copy-artifacts-to objdir-clone \ + " + - name: Run Tests + timeout-minutes: 45 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/tests/run_test_suite.py \ + --chip-tool ./out/darwin-x64-darwin-framework-tool-${BUILD_VARIANT}/darwin-framework-tool \ + --target-skip-glob '{TestGroupMessaging}' \ + run \ + --iterations 1 \ + --all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \ + --lock-app ./out/darwin-x64-lock-${BUILD_VARIANT}/chip-lock-app \ + --ota-provider-app ./out/darwin-x64-ota-provider-${BUILD_VARIANT}/chip-ota-provider-app \ + --ota-requestor-app ./out/darwin-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \ + --tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ + " + - name: Uploading core files + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-core-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: /cores/ + # Cores are big; don't hold on to them too long. + retention-days: 5 + - name: Uploading diagnostic logs + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-log-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: ~/Library/Logs/DiagnosticReports/ + - name: Uploading objdir for debugging + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-objdir-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: objdir-clone/ + # objdirs are big; don't hold on to them too long. + retention-days: 5 diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml new file mode 100644 index 00000000000000..258d2d66336833 --- /dev/null +++ b/.github/workflows/darwin.yaml @@ -0,0 +1,126 @@ +# Copyright (c) 2020-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: Darwin + +on: + push: + pull_request: + 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 + +jobs: + darwin: + name: Build Darwin + timeout-minutes: 120 + + if: github.actor != 'restyled-io[bot]' + runs-on: macos-latest + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform darwin + - name: Setup Environment + run: brew install openssl pkg-config python@3.9 + - name: Fix pkgconfig link + working-directory: /usr/local/lib/pkgconfig + run: | + pwd + ls -la /usr/local/Cellar/ + ls -la /usr/local/Cellar/openssl@1.1 + OPEN_SSL_VERSION=`ls -la /usr/local/Cellar/openssl@1.1 | cat | tail -n1 | awk '{print $NF}'` + ln -s /usr/local/Cellar/openssl@1.1/$OPEN_SSL_VERSION/lib/pkgconfig/* . + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Run iOS Build Debug + timeout-minutes: 30 + working-directory: src/darwin/Framework + run: xcodebuild -target "CHIP" -sdk iphoneos + - name: Run iOS Build Release + timeout-minutes: 30 + working-directory: src/darwin/Framework + run: xcodebuild -target "CHIP" -sdk iphoneos -configuration Release + - name: Clean Build + run: xcodebuild clean + working-directory: src/darwin/Framework + - name: Delete Defaults + run: defaults delete com.apple.dt.xctest.tool + continue-on-error: true + - name: Run macOS Build + timeout-minutes: 30 + # Enable -Werror by hand here, because the Xcode config can't + # enable it for various reasons. Keep whatever Xcode settings + # for OTHER_CFLAGS exist by using ${inherited}. + # + # Disable -Wmacro-redefined because CHIP_DEVICE_CONFIG_ENABLE_MDNS + # seems to be unconditionally defined in CHIPDeviceBuildConfig.h, + # which is apparently being included after CHIPDeviceConfig.h. + run: xcodebuild -target "CHIP" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wno-macro-redefined' + working-directory: src/darwin/Framework + - name: Clean Build + run: xcodebuild clean + working-directory: src/darwin/Framework + - name: Build example darwin-framework-tool + timeout-minutes: 15 + run: | + scripts/examples/gn_build_example.sh examples/darwin-framework-tool out/debug chip_config_network_layer_ble=false is_asan=true + - name: Build example All Clusters Server + timeout-minutes: 15 + run: | + scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug chip_config_network_layer_ble=false + - name: Build example OTA Provider + timeout-minutes: 5 + run: | + scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug chip_config_network_layer_ble=false + - name: Build example OTA Requestor + timeout-minutes: 5 + run: | + scripts/examples/gn_build_example.sh examples/ota-requestor-app/linux out/debug chip_config_network_layer_ble=false + - name: Delete Defaults + run: defaults delete com.apple.dt.xctest.tool + continue-on-error: true + - name: Run Framework Tests + timeout-minutes: 15 + run: | + mkdir -p /tmp/darwin/framework-tests + ../../../out/debug/chip-all-clusters-app --interface-id -1 > >(tee /tmp/darwin/framework-tests/all-cluster-app.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-err.log >&2) & + xcodebuild test -target "CHIP" -scheme "CHIP Framework Tests" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wno-incomplete-umbrella' > >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2) + working-directory: src/darwin/Framework + - name: Uploading log files + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: darwin-framework-test-logs + path: /tmp/darwin/framework-tests + retention-days: 5 diff --git a/.github/workflows/docker_img.yaml b/.github/workflows/docker_img.yaml new file mode 100644 index 00000000000000..9ea7ae9c7ea06a --- /dev/null +++ b/.github/workflows/docker_img.yaml @@ -0,0 +1,73 @@ +# Copyright (c) 2020-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: Docker CHIP images + +on: + push: + paths: + - "integrations/docker/images/**" + pull_request: + paths: + - "integrations/docker/images/**" + workflow_dispatch: + +jobs: + build_images: + name: Build Docker CHIP Build images + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + strategy: + fail-fast: false + matrix: + img: + - "" + - "-ameba" + - "-android" + - "-cirque" + - "-crosscompile" + - "-doxygen" + - "-efr32" + - "-esp32" + - "-esp32-qemu" + - "-infineon" + - "-imx" + - "-k32w" + - "-mbed-os" + - "-nrf-platform" + - "-telink" + - "-ti" + - "-tizen" + # NOTE: vscode image consumes ~52 GB disk space but GitHub-hosted runners provide ~10 GB free disk space(https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources) + #- "-vscode" + - "-zap" + 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: Build All images using project bash script + run: | + cd integrations/docker/images/chip-build${{ matrix.img }} + ./build.sh --latest + - name: Scan for vulnerabilities + uses: crazy-max/docker-scan-action@master + with: + # NOTE: This task validates the images built previously with latest tag + image: connectedhomeip/chip-build${{ matrix.img }}:latest + annotations: true diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml new file mode 100644 index 00000000000000..a3ccea381f4060 --- /dev/null +++ b/.github/workflows/doxygen.yaml @@ -0,0 +1,115 @@ +# Copyright (c) 2020 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: Doxygen + +on: + push: + paths: + - "**.do[xc]" + - "**.c[cs]?" + - "**.cxx" + - "**.cpp" + - "**.c++" + - "**.ii" + - "**.ixx" + - "**.ipp" + - "**.i++" + - "**.inl" + - "**.[hH]" + - "**.hh" + - "**.HH" + - "**.hxx" + - "**.hpp" + - "**.h++" + - "**.mm" + - "**.txt" + - "**.[ido]dl" + - "**.java" + - "**.d" + - "**.php[45]?" + - "**.inc" + - "**.phtml" + - "**.[mM]" + pull_request: + paths: + - "**.do[xc]" + - "**.c[cs]?" + - "**.cxx" + - "**.cpp" + - "**.c++" + - "**.ii" + - "**.ixx" + - "**.ipp" + - "**.i++" + - "**.inl" + - "**.[hH]" + - "**.hh" + - "**.HH" + - "**.hxx" + - "**.hpp" + - "**.h++" + - "**.mm" + - "**.txt" + - "**.[ido]dl" + - "**.java" + - "**.d" + - "**.php[45]?" + - "**.inc" + - "**.phtml" + - "**.[mM]" + 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 + +jobs: + doxygen: + name: Build Doxygen + timeout-minutes: 5 + + runs-on: ubuntu-20.04 + container: + image: connectedhomeip/chip-build-doxygen:0.5.77 + + if: github.actor != 'restyled-io[bot]' + + steps: + - name: "Print Actor" + run: echo ${{github.actor}} + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + submodules: true + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - name: Generate + run: scripts/helpers/doxygen.sh + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})" + id: extract_branch + - name: Deploy if master + if: steps.extract_branch.outputs.branch == 'master' && github.repository == 'project-chip/connectedhomeip' + uses: peaceiris/actions-gh-pages@v3 + with: + deploy_key: ${{ secrets.DOXYGEN_DEPLOY_KEY }} + external_repository: project-chip/connectedhomeip-doc + publish_dir: ./docs/html + # Keep only the latest version of the documentation + force_orphan: true diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml new file mode 100644 index 00000000000000..470298121b5d05 --- /dev/null +++ b/.github/workflows/examples-ameba.yaml @@ -0,0 +1,50 @@ +# 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 - Ameba + +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: + ameba: + name: Ameba + env: + BUILD_TYPE: ameba + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-ameba:0.5.75 + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform ameba + - name: Build example Ameba All Clusters App + run: scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target-glob 'ameba-*' build" diff --git a/.github/workflows/examples-cc13x2x7_26x2x7.yaml b/.github/workflows/examples-cc13x2x7_26x2x7.yaml new file mode 100644 index 00000000000000..ab358c4e7721a9 --- /dev/null +++ b/.github/workflows/examples-cc13x2x7_26x2x7.yaml @@ -0,0 +1,129 @@ +# 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 - TI CC26X2X7 + +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: + cc26x2x7: + name: cc26x2x7 + timeout-minutes: 60 + + env: + BUILD_TYPE: gn_cc26x2x7 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-ti:0.5.77 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform cc13x2_26x2 + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build examples + timeout-minutes: 60 + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py --target-glob cc13x2x7_26x2x7* build \ + --copy-artifacts-to out/artifacts \ + " + - name: Get lock FTD size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + cc13x2_26x2 LP_CC2652R7 lock-ftd \ + out/artifacts/cc13x2x7_26x2x7-lock-ftd/chip-LP_CC2652R7-lock-example.out \ + /tmp/bloat_reports/ + - name: Get lock MTD size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + cc13x2_26x2 LP_CC2652R7 lock-mtd \ + out/artifacts/cc13x2x7_26x2x7-lock-mtd/chip-LP_CC2652R7-lock-example.out \ + /tmp/bloat_reports/ + - name: Get Pump App size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + cc13x2_26x2 LP_CC2652R7 pump-app \ + out/artifacts/cc13x2x7_26x2x7-pump/chip-LP_CC2652R7-pump-example.out \ + /tmp/bloat_reports/ + - name: Get Pump Controller App size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + cc13x2_26x2 LP_CC2652R7 pump-controller-app \ + out/artifacts/cc13x2x7_26x2x7-pump-controller/chip-LP_CC2652R7-pump-controller-example.out \ + /tmp/bloat_reports/ + - name: Get All Clusters App size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + cc13x2_26x2 LP_CC2652R7 all-clusters-app \ + out/artifacts/cc13x2x7_26x2x7-all-clusters/chip-LP_CC2652R7-all-clusters-example.out \ + /tmp/bloat_reports/ + - name: Get All Clusters Minimal App size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + cc13x2_26x2 LP_CC2652R7 all-clusters-minimal-app \ + out/artifacts/cc13x2x7_26x2x7-all-clusters-minimal/chip-LP_CC2652R7-all-clusters-minimal-example.out \ + /tmp/bloat_reports/ + - name: Get Shell App size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + cc13x2_26x2 LP_CC2652R7 shell \ + out/artifacts/cc13x2x7_26x2x7-shell/chip-LP_CC2652R7-shell-example.out \ + /tmp/bloat_reports/ + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,cc13x2x7_26x2x7-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + /tmp/bloat_reports/ diff --git a/.github/workflows/examples-cyw30739.yaml b/.github/workflows/examples-cyw30739.yaml new file mode 100644 index 00000000000000..458833b33bdfec --- /dev/null +++ b/.github/workflows/examples-cyw30739.yaml @@ -0,0 +1,102 @@ +# 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 - Infineon CYW30739 + +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: + cyw30739: + name: CYW30739 + timeout-minutes: 60 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build:latest + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform cyw30739 + + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build example CYW30739 Apps + timeout-minutes: 30 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target-glob 'cyw30739-cyw930739m2evb_01-{light,lock,ota-requestor-no-progress-logging}' \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Get light size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + cyw30739 cyw930739m2evb_01 light \ + out/artifacts/cyw30739-cyw930739m2evb_01-light/chip-cyw30739-lighting-example.elf \ + /tmp/bloat_reports/ + - name: Get lock size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + cyw30739 cyw930739m2evb_01 lock \ + out/artifacts/cyw30739-cyw930739m2evb_01-lock/chip-cyw30739-lock-example.elf \ + /tmp/bloat_reports/ + - name: Get ota-requestor size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + cyw30739 cyw930739m2evb_01 ota-requestor-no-progress-logging \ + out/artifacts/cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging/chip-cyw30739-ota-requestor-example.elf \ + /tmp/bloat_reports/ + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,CYW30739-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + /tmp/bloat_reports/ diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml new file mode 100644 index 00000000000000..548909c27aa7bb --- /dev/null +++ b/.github/workflows/examples-efr32.yaml @@ -0,0 +1,116 @@ +# Copyright (c) 2020 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 - EFR32 + +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: + efr32: + name: EFR32 + timeout-minutes: 60 + + env: + EFR32_BOARD: BRD4161A + BUILD_TYPE: gn_efr32 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-efr32:0.5.77 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform efr32 + + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + + - name: Build some BRD4161A variants + timeout-minutes: 50 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --enable-flashbundle \ + --target-glob '*-brd4161a-{lock,light,switch,window-covering,unit-test}' \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Prepare some bloat report from the previous builds + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + efr32 BRD4161A lighting-app \ + out/efr32-brd4161a-light/chip-efr32-lighting-example.out \ + /tmp/bloat_reports/ + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + efr32 BRD4161A window-app \ + out/efr32-brd4161a-window-covering/chip-efr32-window-example.out \ + /tmp/bloat_reports/ + - name: Build example EFR32 Lighting App for BRD4161A with RPCs + timeout-minutes: 10 + run: | + scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app_debug_rpc BRD4161A \ + 'import("//with_pw_rpc.gni")' + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+rpc lighting-app \ + out/lighting_app_debug_rpc/BRD4161A/chip-efr32-lighting-example.out /tmp/bloat_reports/ + - name: Build example EFR32+WF200 WiFi Lock app for BRD4161A + timeout-minutes: 10 + run: | + scripts/examples/gn_efr32_example.sh examples/lock-app/efr32/ out/lock_app_wifi_wf200 BRD4161A is_debug=false --wifi wf200 + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+wf200 lock-app \ + out/lock_app_wifi_wf200/BRD4161A/chip-efr32-lock-example.out /tmp/bloat_reports/ + - name: Build example EFR32+RS911x WiFi Lighting app for BRD4161A + timeout-minutes: 10 + run: | + scripts/examples/gn_efr32_example.sh examples/lighting-app/efr32/ out/lighting_app_wifi_rs911x BRD4161A --wifi rs911x + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py efr32 BRD4161A+rs911x lighting-app \ + out/lighting_app_wifi_rs911x/BRD4161A/chip-efr32-lighting-example.out /tmp/bloat_reports/ + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,EFR32-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + /tmp/bloat_reports/ diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml new file mode 100644 index 00000000000000..a6099debcf8ccd --- /dev/null +++ b/.github/workflows/examples-esp32.yaml @@ -0,0 +1,176 @@ +# Copyright (c) 2020 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 - ESP32 + +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: + # TODO ESP32 https://github.com/project-chip/connectedhomeip/issues/1510 + esp32: + name: ESP32 + timeout-minutes: 90 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-esp32:0.5.77 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform esp32 + + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build some M5Stack variations + timeout-minutes: 45 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --enable-flashbundle \ + --target-glob '*-m5stack-{all-clusters,all-clusters-minimal,all-clusters-rpc-ipv6only}' \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Prepare bloat report + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + esp32 m5stack all-clusters-app \ + out/esp32-m5stack-all-clusters/chip-all-clusters-app.elf \ + /tmp/bloat_reports/ + - name: Build example All Clusters App C3 + timeout-minutes: 15 + run: scripts/examples/esp_example.sh all-clusters-app sdkconfig_c3devkit.defaults + - name: Copy aside build products + run: | + mkdir -p example_binaries/esp32-build + cp examples/all-clusters-app/esp32/build/chip-all-clusters-app.elf \ + example_binaries/esp32-build/chip-all-clusters-app.elf + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + esp32 c3devkit all-clusters-app \ + example_binaries/esp32-build/chip-all-clusters-app.elf \ + /tmp/bloat_reports/ + - name: Build example Pigweed App + timeout-minutes: 15 + run: scripts/examples/esp_example.sh pigweed-app sdkconfig.defaults + - name: Build example Lighting App + timeout-minutes: 15 + run: scripts/examples/esp_example.sh lighting-app sdkconfig.defaults + - name: Build example Lock App + timeout-minutes: 15 + run: scripts/examples/esp_example.sh lock-app sdkconfig.defaults + + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,ESP32-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: /tmp/bloat_reports/ + + esp32_1: + name: ESP32_1 + timeout-minutes: 90 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-esp32:0.5.77 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform esp32 + + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + + - name: Build example Bridge App + timeout-minutes: 15 + run: scripts/examples/esp_example.sh bridge-app + + - name: Build example Persistent Storage App + timeout-minutes: 15 + run: scripts/examples/esp_example.sh persistent-storage sdkconfig.defaults + + - name: Build example Shell App + timeout-minutes: 15 + run: scripts/examples/esp_example.sh shell sdkconfig.defaults + + - name: Build example Temperature Measurement App + timeout-minutes: 15 + run: scripts/examples/esp_example.sh temperature-measurement-app sdkconfig.optimize.defaults + + - name: Build example IPv6 Only App + timeout-minutes: 15 + run: scripts/examples/esp_example.sh ipv6only-app sdkconfig.defaults + + - name: Build example OTA Requestor App + run: scripts/examples/esp_example.sh ota-requestor-app sdkconfig.defaults + timeout-minutes: 15 + + - name: Build example OTA Provider App + run: scripts/examples/esp_example.sh ota-provider-app sdkconfig.defaults + timeout-minutes: 15 diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml new file mode 100644 index 00000000000000..8604a3b6756326 --- /dev/null +++ b/.github/workflows/examples-infineon.yaml @@ -0,0 +1,127 @@ +# 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 - Infineon P6 + +on: + push: + pull_request: + 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 + +jobs: + infineon: + name: Infineon examples building + timeout-minutes: 60 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-infineon:0.5.77 + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform p6 + + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build lock-app example + timeout-minutes: 10 + run: | + scripts/run_in_build_env.sh \ + "scripts/build/build_examples.py \ + --enable-flashbundle --no-log-timestamps \ + --target infineon-p6-lock \ + build \ + --copy-artifacts-to out/artifacts \ + " + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + p6 default lock-app \ + out/infineon-p6-lock/chip-p6-lock-example.out + - name: Build all-clusters-app example + timeout-minutes: 10 + run: | + scripts/run_in_build_env.sh \ + "scripts/build/build_examples.py \ + --enable-flashbundle --no-log-timestamps \ + --target infineon-p6-all-clusters \ + build \ + --copy-artifacts-to out/artifacts \ + " + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + p6 default all-clusters-app \ + out/infineon-p6-all-clusters/chip-p6-clusters-example.out + - name: Build all-clusters-minimal-app example + timeout-minutes: 10 + run: | + scripts/run_in_build_env.sh \ + "scripts/build/build_examples.py \ + --enable-flashbundle --no-log-timestamps \ + --target infineon-p6-all-clusters-minimal \ + build \ + --copy-artifacts-to out/artifacts \ + " + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + p6 default all-clusters-minimal-app \ + out/infineon-p6-all-clusters-minimal/chip-p6-clusters-minimal-example.out + - name: Build lighting-app example + timeout-minutes: 10 + run: | + scripts/run_in_build_env.sh \ + "scripts/build/build_examples.py \ + --enable-flashbundle --no-log-timestamps \ + --target infineon-p6-light \ + build \ + --copy-artifacts-to out/artifacts \ + " + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + p6 default light-app \ + out/infineon-p6-light/chip-p6-lighting-example.out + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,P6-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + out/infineon-p6-lock/p6-default-lock-app-sizes.json + out/infineon-p6-all-clusters/p6-default-all-clusters-app-sizes.json + out/infineon-p6-all-clusters-minimal/p6-default-all-clusters-minimal-app-sizes.json + out/infineon-p6-light/p6-default-light-app-sizes.json diff --git a/.github/workflows/examples-k32w.yaml b/.github/workflows/examples-k32w.yaml new file mode 100644 index 00000000000000..3342c4f5739884 --- /dev/null +++ b/.github/workflows/examples-k32w.yaml @@ -0,0 +1,101 @@ +# 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 - K32W with SE051 + +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: + k32w: + name: K32W + timeout-minutes: 60 + + env: + BUILD_TYPE: gn_k32w + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-k32w:0.5.77 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform k32w0 + + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build examples + timeout-minutes: 30 + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target k32w-light-ota-se \ + --target k32w-light-release-no-ota \ + --target k32w-lock-low-power-release \ + --target k32w-shell-release \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Get light size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + k32w k32w061+release light \ + out/artifacts/k32w-light-release-no-ota/chip-k32w061-light-example \ + /tmp/bloat_reports/ + - name: Get lock size stats + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + k32w k32w061+release lock \ + out/artifacts/k32w-lock-low-power-release/chip-k32w061-lock-example \ + /tmp/bloat_reports/ + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,K32W-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + /tmp/bloat_reports/ diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml new file mode 100644 index 00000000000000..88ffe8491e48df --- /dev/null +++ b/.github/workflows/examples-linux-arm.yaml @@ -0,0 +1,99 @@ +# Copyright (c) 2020 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 - Linux ARM + +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: + arm_crosscompile: + name: Linux ARM Cross compile + timeout-minutes: 70 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-crosscompile:0.5.77 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux + + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build Some samples + timeout-minutes: 45 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target linux-arm64-all-clusters \ + --target linux-arm64-chip-tool-no-interactive-ipv6only \ + --target linux-arm64-lock \ + --target linux-arm64-minmdns \ + --target linux-arm64-thermostat-no-ble \ + build \ + " + - name: Bloat report - chip-tool + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux arm64 chip-tool-no-interactive-ipv6only \ + out/linux-arm64-chip-tool-no-interactive-ipv6only/chip-tool \ + /tmp/bloat_reports/ + - name: Bloat report - thermostat + timeout-minutes: 5 + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux arm64 thermostat-no-ble \ + out/linux-arm64-thermostat-no-ble/thermostat-app \ + /tmp/bloat_reports/ + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,Linux-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + /tmp/bloat_reports/ diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml new file mode 100644 index 00000000000000..c1c9971c9dd985 --- /dev/null +++ b/.github/workflows/examples-linux-imx.yaml @@ -0,0 +1,85 @@ +# 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. + +name: Build example - i.MX Linux + +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: + imx: + name: Linux i.MX Build + timeout-minutes: 70 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-imx:0.5.77 + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux + + - name: Build App + timeout-minutes: 30 + run: | + ./scripts/examples/imxlinux_example.sh \ + examples/lighting-app/linux/ examples/lighting-app/linux/out/aarch64 + - name: Build chip-tool + timeout-minutes: 30 + run: | + ./scripts/examples/imxlinux_example.sh \ + examples/chip-tool examples/chip-tool/out/aarch64 + - name: Build thermostat + timeout-minutes: 30 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target imx-thermostat build \ + " + - name: Build all-cluster + timeout-minutes: 30 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target imx-all-clusters-app build \ + " + - name: Build all-cluster-minimal + timeout-minutes: 30 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target imx-all-clusters-minimal-app build \ + " + - name: Build ota-provider-app + timeout-minutes: 30 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target imx-ota-provider-app build + " diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml new file mode 100644 index 00000000000000..f557aaeb597f9f --- /dev/null +++ b/.github/workflows/examples-linux-standalone.yaml @@ -0,0 +1,177 @@ +# Copyright (c) 2020 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 - Linux Standalone + +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: + linux_standalone: + name: Linux Standalone + timeout-minutes: 70 + + env: + BUILD_TYPE: gn_linux + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build:0.5.77 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux + + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build Standalone cert tool + timeout-minutes: 10 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --no-log-timestamps --target-glob '*-chip-cert' build" + - name: Build example Standalone Echo Client + timeout-minutes: 10 + run: | + scripts/examples/gn_build_example.sh examples/chip-tool out/chip_tool_debug + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug chip-tool \ + out/chip_tool_debug/chip-tool \ + /tmp/bloat_reports/ + - name: Build example Standalone Shell + timeout-minutes: 10 + run: | + scripts/examples/gn_build_example.sh examples/shell/standalone out/shell_debug + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug shell \ + out/shell_debug/chip-shell \ + /tmp/bloat_reports/ + - name: Build example Standalone All Clusters Server + timeout-minutes: 10 + run: | + scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/all_clusters_debug + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug all-clusters-app \ + out/all_clusters_debug/chip-all-clusters-app \ + /tmp/bloat_reports/ + - name: Build example Standalone All Clusters Mininal Server + timeout-minutes: 10 + run: | + scripts/examples/gn_build_example.sh examples/all-clusters-minimal-app/linux out/all_clusters_minimal_debug + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug all-clusters-minimal-app \ + out/all_clusters_minimal_debug/chip-all-clusters-minimal-app \ + /tmp/bloat_reports/ + - name: Build example TV app + timeout-minutes: 10 + run: | + scripts/examples/gn_build_example.sh examples/tv-app/linux out/tv_app_debug + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug tv-app \ + out/tv_app_debug/chip-tv-app \ + /tmp/bloat_reports/ + - name: Build example Standalone TV Casting App + timeout-minutes: 10 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target linux-x64-tv-casting-app \ + build" + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug tv-casting-app \ + out/linux-x64-tv-casting-app/chip-tv-casting-app \ + /tmp/bloat_reports/ + - name: Build example lighting app with RPCs + timeout-minutes: 10 + run: | + scripts/examples/gn_build_example.sh examples/lighting-app/linux out/lighting_app_debug_rpc \ + 'import("//with_pw_rpc.gni")' + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug+rpc lighting-app \ + out/lighting_app_debug_rpc/chip-lighting-app \ + /tmp/bloat_reports/ + - name: Build example Standalone Bridge + timeout-minutes: 10 + run: | + scripts/examples/gn_build_example.sh examples/bridge-app/linux out/bridge_debug + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug+rpc bridge-app \ + out/bridge_debug/chip-bridge-app \ + /tmp/bloat_reports/ + - name: Build example OTA Provider + timeout-minutes: 10 + run: | + scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/ota_provider_debug + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug ota-provider-app \ + out/ota_provider_debug/chip-ota-provider-app \ + /tmp/bloat_reports/ + - name: Build example OTA Requestor + timeout-minutes: 10 + run: | + scripts/examples/gn_build_example.sh examples/ota-requestor-app/linux out/ota_requestor_debug + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug ota-requestor-app \ + out/ota_requestor_debug/chip-ota-requestor-app \ + /tmp/bloat_reports/ + + - name: Build example Standalone Lock App + timeout-minutes: 10 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target linux-x64-lock \ + build" + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + linux debug lock-app \ + out/linux-x64-lock/chip-lock-app \ + /tmp/bloat_reports/ + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,Linux-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + /tmp/bloat_reports/ diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml new file mode 100644 index 00000000000000..19d59ad4bad2a8 --- /dev/null +++ b/.github/workflows/examples-mbed.yaml @@ -0,0 +1,166 @@ +# 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 - Mbed OS + +on: + push: + pull_request: + 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 + +jobs: + mbedos: + name: Mbed OS examples building + timeout-minutes: 200 + + env: + BUILD_TYPE: mbedos + APP_PROFILE: release + APP_TARGET: CY8CPROTO_062_4343W + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-mbed-os:0.5.77 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform mbed + + - name: Detect changed paths + uses: dorny/paths-filter@v2 + id: changed_paths + with: + filters: | + mbed: + - '**/mbed/**' + pigweedapp: + - 'examples/pigweed-app/mbed/**' + + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + + - name: Build lock-app example + timeout-minutes: 20 + run: | + scripts/examples/mbed_example.sh -a=lock-app -b=$APP_TARGET -p=$APP_PROFILE + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + mbed $APP_TARGET+$APP_PROFILE lock-app \ + examples/lock-app/mbed/build-CY8CPROTO_062_4343W/release/chip-mbed-lock-app-example.elf \ + /tmp/bloat_reports/ + + - name: Build lighting-app example + if: github.event_name == 'push' || steps.changed_paths.outputs.mbed == 'true' + timeout-minutes: 20 + run: | + scripts/examples/mbed_example.sh -a=lighting-app -b=$APP_TARGET -p=$APP_PROFILE + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + mbed $APP_TARGET+$APP_PROFILE lighting-app \ + examples/lighting-app/mbed/build-CY8CPROTO_062_4343W/release/chip-mbed-lighting-app-example.elf \ + /tmp/bloat_reports/ + + - name: Build pigweed-app example + if: github.event_name == 'push' || steps.changed_paths.outputs.pigweedapp == 'true' + timeout-minutes: 20 + run: | + scripts/examples/mbed_example.sh -a=pigweed-app -b=$APP_TARGET -p=$APP_PROFILE + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + mbed $APP_TARGET+$APP_PROFILE pigweed-app \ + examples/pigweed-app/mbed/build-CY8CPROTO_062_4343W/release/chip-mbed-pigweed-app-example.elf \ + /tmp/bloat_reports/ + + - name: Build all-clusters-app example + if: github.event_name == 'push' || steps.changed_paths.outputs.mbed == 'true' + timeout-minutes: 20 + run: | + scripts/examples/mbed_example.sh -a=all-clusters-app -b=$APP_TARGET -p=$APP_PROFILE + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + mbed $APP_TARGET+$APP_PROFILE all-clusters-app \ + examples/all-clusters-app/mbed/build-CY8CPROTO_062_4343W/release/chip-mbed-all-clusters-app-example.elf \ + /tmp/bloat_reports/ + + - name: Build all-clusters-minimal-app example + if: github.event_name == 'push' || steps.changed_paths.outputs.mbed == 'true' + timeout-minutes: 20 + run: | + scripts/examples/mbed_example.sh -a=all-clusters-minimal-app -b=$APP_TARGET -p=$APP_PROFILE + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + mbed $APP_TARGET+$APP_PROFILE all-clusters-minimal-app \ + examples/all-clusters-minimal-app/mbed/build-CY8CPROTO_062_4343W/release/chip-mbed-all-clusters-minimal-app-example.elf \ + /tmp/bloat_reports/ + + - name: Build shell example + if: github.event_name == 'push' || steps.changed_paths.outputs.mbed == 'true' + timeout-minutes: 20 + run: | + scripts/examples/mbed_example.sh -a=shell -b=$APP_TARGET -p=$APP_PROFILE + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + mbed $APP_TARGET+$APP_PROFILE shell \ + examples/shell/mbed/build-CY8CPROTO_062_4343W/release/chip-mbed-shell-example.elf \ + /tmp/bloat_reports/ + + - name: Build ota-requestor-app example + if: github.event_name == 'push' || steps.changed_paths.outputs.mbed == 'true' + timeout-minutes: 20 + run: | + scripts/examples/mbed_example.sh -a=ota-requestor-app -b=$APP_TARGET -p=$APP_PROFILE + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + mbed $APP_TARGET+$APP_PROFILE shell \ + examples/ota-requestor-app/mbed/build-CY8CPROTO_062_4343W/release/chip-mbed-ota-requestor-app-example.elf \ + /tmp/bloat_reports/ + + - name: Build unit tests + # Temporarily disable build due to running out of flash space + if: false + timeout-minutes: 20 + run: scripts/tests/mbed/mbed_unit_tests.sh -b=$APP_TARGET -p=$APP_PROFILE + + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,Mbed-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + /tmp/bloat_reports/ diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml new file mode 100644 index 00000000000000..458bf7fa712c80 --- /dev/null +++ b/.github/workflows/examples-nrfconnect.yaml @@ -0,0 +1,211 @@ +# Copyright (c) 2020 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 - nRF Connect SDK + +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: + nrfconnect: + name: nRF Connect SDK + timeout-minutes: 125 + + env: + BUILD_TYPE: nrfconnect + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-nrf-platform:0.5.77 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform nrfconnect + - name: Detect changed paths + uses: dorny/paths-filter@v2 + id: changed_paths + with: + filters: | + nrfconnect: + - '**/nrfconnect/**' + - '**/Zephyr/**' + - '**/zephyr/**' + tests: + - '**/tests/**' + shell: + - 'examples/shell/nrfconnect/**' + pigweed-app: + - 'examples/pigweed-app/nrfconnect/**' + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Update nRF Connect SDK revision to the currently recommended. + timeout-minutes: 10 + run: scripts/run_in_build_env.sh "python3 scripts/setup/nrfconnect/update_ncs.py --update --shallow" + - name: Build example nRF Connect SDK Lock App on nRF52840 DK + if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' + timeout-minutes: 10 + run: | + scripts/examples/nrfconnect_example.sh lock-app nrf52840dk_nrf52840 + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf52840dk_nrf52840 lock-app \ + examples/lock-app/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Build example nRF Connect SDK Lighting App on nRF52840 DK + if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' + timeout-minutes: 10 + run: | + scripts/examples/nrfconnect_example.sh lighting-app nrf52840dk_nrf52840 + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf52840dk_nrf52840 lighting-app \ + examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Build example nRF Connect SDK Lighting App on nRF52840 Dongle + if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' + timeout-minutes: 10 + run: | + scripts/examples/nrfconnect_example.sh lighting-app nrf52840dongle_nrf52840 -DCONF_FILE=prj_no_dfu.conf -DCONFIG_CHIP_ROTATING_DEVICE_ID=y + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf52840dongle_nrf52840 lighting-app \ + examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Build example nRF Connect SDK Lighting App on nRF52840 DK with RPC + if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' + timeout-minutes: 20 + run: | + scripts/examples/nrfconnect_example.sh lighting-app nrf52840dk_nrf52840 -DOVERLAY_CONFIG=rpc.overlay + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf52840dk_nrf52840+rpc lighting-app \ + examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Build example nRF Connect SDK Shell on nRF52840 DK + if: github.event_name == 'push' || steps.changed_paths.outputs.shell == 'true' + timeout-minutes: 10 + run: | + scripts/examples/nrfconnect_example.sh shell nrf52840dk_nrf52840 + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf52840dk_nrf52840 shell \ + examples/shell/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Build example nRF Connect SDK Pigweed on nRF52840 DK + if: github.event_name == 'push' || steps.changed_paths.outputs.pigweed-app == 'true' + timeout-minutes: 10 + run: | + scripts/examples/nrfconnect_example.sh pigweed-app nrf52840dk_nrf52840 + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf52840dk_nrf52840 pigweed-app \ + examples/pigweed-app/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Build example nRF Connect SDK Lock App on nRF5340 DK + if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' + timeout-minutes: 10 + run: | + scripts/examples/nrfconnect_example.sh lock-app nrf5340dk_nrf5340_cpuapp + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf5340dk_nrf5340_cpuapp lock-app \ + examples/lock-app/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Build example nRF Connect SDK Lighting App on nRF5340 DK + if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' + timeout-minutes: 10 + run: | + scripts/examples/nrfconnect_example.sh lighting-app nrf5340dk_nrf5340_cpuapp + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf5340dk_nrf5340_cpuapp lighting-app \ + examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Build example nRF Connect SDK Pump App on nRF52840 DK + if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' + timeout-minutes: 10 + run: | + scripts/examples/nrfconnect_example.sh pump-app nrf52840dk_nrf52840 + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf52840dk_nrf52840 pump-app \ + examples/pump-app/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Build example nRF Connect SDK Pump Controller App on nRF52840 DK + if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' + timeout-minutes: 10 + run: | + scripts/examples/nrfconnect_example.sh pump-controller-app nrf52840dk_nrf52840 + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf52840dk_nrf52840 pump-controller-app \ + examples/pump-controller-app/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Build example nRF Connect SDK All Clusters App on nRF52840 DK + timeout-minutes: 15 + run: | + scripts/examples/nrfconnect_example.sh all-clusters-app nrf52840dk_nrf52840 -DCONF_FILE=prj_dfu.conf + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf52840dk_nrf52840 all-clusters-app \ + examples/all-clusters-app/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Build example nRF Connect SDK All Clusters Minimal App on nRF52840 DK + timeout-minutes: 15 + run: | + scripts/examples/nrfconnect_example.sh all-clusters-minimal-app nrf52840dk_nrf52840 -DCONF_FILE=prj_dfu.conf + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nrfconnect nrf52840dk_nrf52840 all-clusters-minimal-app \ + examples/all-clusters-minimal-app/nrfconnect/build/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + - name: Run unit tests for Zephyr native_posix_64 platform + if: github.event_name == 'push' || steps.changed_paths.outputs.tests == 'true' + timeout-minutes: 10 + run: | + scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target nrf-native-posix-64-tests build" + - name: Uploading Failed Test Logs + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: test-log + path: | + src/test_driver/nrfconnect/build/Testing/Temporary/LastTest.log + + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,nRFConnect-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + /tmp/bloat_reports/ diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml new file mode 100644 index 00000000000000..278d535dbe0a55 --- /dev/null +++ b/.github/workflows/examples-qpg.yaml @@ -0,0 +1,90 @@ +# Copyright (c) 2020-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 - QPG + +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: + qpg: + name: QPG + timeout-minutes: 60 + + env: + BUILD_TYPE: gn_qpg + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build:0.5.77 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform qpg + + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build QPG6105 example apps + timeout-minutes: 20 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --enable-flashbundle \ + --target-glob 'qpg-{lock,light,shell,persistent-storage}' \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Build Matter SDK library + timeout-minutes: 5 + run: | + config/qpg/chip-gn/build.sh + + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,QPG-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + /tmp/bloat_reports/ diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml new file mode 100644 index 00000000000000..58fea93d501b9f --- /dev/null +++ b/.github/workflows/examples-telink.yaml @@ -0,0 +1,87 @@ +# Copyright (c) 2020 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 - Telink + +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: + telink: + name: Telink + env: + BUILD_TYPE: telink + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-telink:0.5.77 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform telink + + - name: Set up environment for size reports + if: ${{ !env.ACT }} + env: + GH_CONTEXT: ${{ toJson(github) }} + run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" + + - name: Build example Telink Lighting App + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --no-log-timestamps --target 'telink-tlsr9518adk80d-light' build" + + - name: Build example Telink Light Switch App + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --no-log-timestamps --target 'telink-tlsr9518adk80d-light-switch' build" + + - name: Get Lighting size stats + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + telink tlsr9518adk80d lighting-app \ + out/telink-tlsr9518adk80d-light/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + + - name: Get Light Switch size stats + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + telink tlsr9518adk80d light-switch-app \ + out/telink-tlsr9518adk80d-light-switch/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + + - name: Uploading Size Reports + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: Size,Telink-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }} + path: | + /tmp/bloat_reports/ diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml new file mode 100644 index 00000000000000..eeadfd200d916b --- /dev/null +++ b/.github/workflows/examples-tizen.yaml @@ -0,0 +1,53 @@ +# 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 - Tizen + +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: + tizen: + name: Tizen + env: + BUILD_TYPE: tizen + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-tizen:0.5.77 + options: --user root + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + - "/tmp/output_binaries:/tmp/output_binaries" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform tizen + - name: Build example Tizen lighting app + run: scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target-glob 'tizen-*' build" diff --git a/.github/workflows/fixit_rotation.yaml b/.github/workflows/fixit_rotation.yaml new file mode 100644 index 00000000000000..09ccbf08fe2a26 --- /dev/null +++ b/.github/workflows/fixit_rotation.yaml @@ -0,0 +1,36 @@ +# 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: Pick Fixit Rotation + +on: + workflow_dispatch: + +jobs: + shuffle_names: + name: Shuffle names + runs-on: ubuntu-latest + + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + submodules: true + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - name: Pick fixit rotation order + run: scripts/fixit_rotation.py diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml new file mode 100644 index 00000000000000..cd278c6c1e75b0 --- /dev/null +++ b/.github/workflows/full-android.yaml @@ -0,0 +1,81 @@ +# Copyright (c) 2020 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: Full builds - Android + +on: + push: + workflow_dispatch: + +concurrency: + group: full-${{ 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: + android: + name: Run + timeout-minutes: 75 + + env: + JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64/ + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-android:0.5.77 + volumes: + - "/tmp/log_output:/tmp/test_logs" + + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + submodules: true + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build Android CHIPTool and CHIPTest (ARM) + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --no-log-timestamps --target-glob 'android-arm-chip-*' build" + - name: Clean out build output + run: rm -rf ./out + - name: Build Android CHIPTool and CHIPTest (ARM64) + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --no-log-timestamps --target-glob 'android-arm64-chip-*' build" + - name: Run Android build rule tests + run: | + ./scripts/run_in_build_env.sh \ + "ninja -C out/android-arm64-chip-tool build/chip/java/tests:java_build_test.tests" + - name: Clean out build output + run: rm -rf ./out + # - name: Build Android Studio build (arm64 only) + # run: | + # ./scripts/run_in_build_env.sh \ + # "./scripts/build/build_examples.py --no-log-timestamps --target-glob 'android-androidstudio-arm64-chip-tool' build" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml new file mode 100644 index 00000000000000..c2ecc70cdecd91 --- /dev/null +++ b/.github/workflows/fuzzing-build.yaml @@ -0,0 +1,138 @@ +# 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: Fuzzing Builds + +on: + # For now, only manual triggers. + 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 + +jobs: + build_linux_fuzzing: + name: Build on Linux + timeout-minutes: 90 + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build:0.5.77 + volumes: + - "/tmp/log_output:/tmp/test_logs" + + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + submodules: true + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - run: apt-get update + - run: apt-get install --fix-missing llvm-10 clang-10 + - name: Try to ensure the objdir-clone dir exists + run: | + mkdir objdir-clone || true + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build all-clusters-app + timeout-minutes: 20 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target linux-x64-all-clusters-no-ble-libfuzzer \ + build \ + --copy-artifacts-to objdir-clone \ + " + - name: Uploading binaries + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: objdir-linux + path: objdir-clone/ + # objdirs are big; don't hold on to them too long. + retention-days: 5 + + build_darwin_fuzzing: + name: Build on Darwin + timeout-minutes: 90 + runs-on: macos-latest + if: github.actor != 'restyled-io[bot]' + + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + submodules: true + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - name: Setup Environment + run: brew install openssl pkg-config llvm + - name: Try to ensure the objdir-clone dir exists + run: | + mkdir objdir-clone || true + - name: Fix pkgconfig link + working-directory: /usr/local/lib/pkgconfig + run: | + pwd + ls -la /usr/local/Cellar/ + ls -la /usr/local/Cellar/openssl@1.1 + OPEN_SSL_VERSION=`ls -la /usr/local/Cellar/openssl@1.1 | cat | tail -n1 | awk '{print $NF}'` + ln -s /usr/local/Cellar/openssl@1.1/$OPEN_SSL_VERSION/lib/pkgconfig/* . + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build all-clusters-app + timeout-minutes: 20 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target darwin-x64-all-clusters-no-ble-asan-libfuzzer-clang \ + build \ + --copy-artifacts-to objdir-clone \ + " + - name: Uploading binaries + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: crash-darwin + path: objdir-clone/ + # objdirs are big; don't hold on to them too long. + retention-days: 5 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000000000..b5c296573021d7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,91 @@ +# Copyright (c) 2020-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: Lint Code Base +on: + push: + pull_request: + 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 + +jobs: + code-lints: + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + 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: Check broken links + # On-push disabled until the job can run fully green + # At that point the step should be enabled. + if: github.event_name == 'workflow_dispatch' + uses: gaurav-nelson/github-action-markdown-link-check@v1 + + # git grep exits with 0 if it finds a match, but we want + # to fail (exit nonzero) on match. And we wasnt to exclude this file, + # to avoid our grep regexp matching itself. + - name: Check for incorrect error use in VerifyOrExit + if: always() + run: | + git grep -n "VerifyOrExit(.*, [A-Za-z]*_ERROR" -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 + + # git grep exits with 0 if it finds a match, but we want + # to fail (exit nonzero) on match. And we wasnt to exclude this file, + # to avoid our grep regexp matching itself. + - name: Check for use of PRI*8, which are not supported on some libcs. + if: always() + run: | + git grep -n "PRI.8" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)third_party/lwip/repo/lwip/src/include/lwip/arch.h' && exit 1 || exit 0 + + # git grep exits with 0 if it finds a match, but we want + # to fail (exit nonzero) on match. And we wasnt to exclude this file, + # to avoid our grep regexp matching itself. + - name: Check for use of PRI*16, which are not supported on some libcs. + if: always() + run: | + git grep -n "PRI.16" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)third_party/lwip/repo/lwip/src/include/lwip/arch.h' && exit 1 || exit 0 + + # git grep exits with 0 if it finds a match, but we want + # to fail (exit nonzero) on match. And we wasnt to exclude this file, + # to avoid our grep regexp matching itself. + - name: Check for use of %zu, which are not supported on some libcs. + if: always() + run: | + git grep -n "%zu" -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 + + # Comments like '{{! ... }}' should be used in zap files + - name: Do not allow TODO in generated files + if: always() + run: | + git grep -n 'TODO:' -- ./zzz_generated './*/zap-generated/*' && exit 1 || exit 0 + + - name: Check for disallowed include files + if: always() + run: scripts/tools/check_includes.sh + + - name: Ensure all PICS are set for tests (to true or false) + if: always() + run: | + scripts/tools/check_test_pics.py src/app/tests/suites/certification/ci-pics-values src/app/tests/suites/certification/PICS.yaml diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml new file mode 100644 index 00000000000000..c9e26c8cc97914 --- /dev/null +++ b/.github/workflows/qemu.yaml @@ -0,0 +1,82 @@ +# Copyright (c) 2020 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: QEMU + +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: + qemu: + name: ESP32 + timeout-minutes: 85 + + env: + BUILD_TYPE: esp32-qemu + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-esp32-qemu:0.5.77 + volumes: + - "/tmp/log_output:/tmp/test_logs" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform esp32 + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build ESP32 QEMU test images + timeout-minutes: 20 + run: | + scripts/run_in_build_env.sh " \ + ./scripts/build/build_examples.py \ + --target esp32-qemu-tests \ + build \ + " + - name: Run all tests + timeout-minutes: 40 + run: | + src/test_driver/esp32/run_qemu_image.py \ + --verbose \ + --file-image-list ./out/esp32-qemu-tests/test_images.txt + - name: Uploading Logs + uses: actions/upload-artifact@v2 + if: ${{ !env.ACT }} + with: + name: qemu-esp32-logs + path: /tmp/log_output diff --git a/.github/workflows/rebase.yaml b/.github/workflows/rebase.yaml new file mode 100644 index 00000000000000..6e4e361310ba5b --- /dev/null +++ b/.github/workflows/rebase.yaml @@ -0,0 +1,23 @@ +name: Automatic Rebase +on: + issue_comment: + types: [created] +jobs: + rebase: + name: Rebase + if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') + runs-on: ubuntu-latest + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + fetch-depth: 0 + token: ${{ secrets.APPLE_PERSONAL_ACCESS_TOKEN }} + attempt_limit: 3 + attempt_delay: 2000 + - name: Automatic Rebase + uses: cirrus-actions/rebase@1.4 + env: + GITHUB_TOKEN: ${{ secrets.APPLE_PERSONAL_ACCESS_TOKEN }} diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml new file mode 100644 index 00000000000000..4ab6fcfbe0f6b3 --- /dev/null +++ b/.github/workflows/release_artifacts.yaml @@ -0,0 +1,113 @@ +# Copyright (c) 2020 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 release artifacts + +on: + workflow_dispatch: + inputs: + releaseTag: + description: Release Tag + required: true + +jobs: + esp32: + name: ESP32 + env: + BUILD_DIRECTORY: examples/all-clusters-app/esp32/build + runs-on: ubuntu-latest + + container: + image: connectedhomeip/chip-build-esp32:0.5.77 + + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + submodules: true + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + ref: "${{ github.event.inputs.releaseTag }}" + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build + run: scripts/examples/esp_example.sh all-clusters-app + + - name: Upload artifact + run: | + scripts/helpers/upload_release_asset.py \ + --github-repository project-chip/connectedhomeip \ + --github-api-token "${{ secrets.GITHUB_TOKEN }}" \ + --release-tag "${{ github.event.inputs.releaseTag }}" \ + --bundle-files $BUILD_DIRECTORY/chip-all-clusters-app.flashbundle.txt \ + --working-directory $BUILD_DIRECTORY \ + --bundle-name esp32-chip-all-clusters-app + + efr32: + name: EFR32 + env: + EFR32_BOARD: BRD4161A + BUILD_DIRECTORY: out/lock_app_debug/BRD4161A + + runs-on: ubuntu-latest + + container: + image: connectedhomeip/chip-build-efr32:0.5.77 + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + submodules: true + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + ref: "${{ github.event.inputs.releaseTag }}" + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build example EFR32 Lock App + run: scripts/examples/gn_efr32_example.sh examples/lock-app/efr32/ + out/lock_app_debug $EFR32_BOARD + + - name: Upload artifact + run: | + scripts/helpers/upload_release_asset.py \ + --github-repository project-chip/connectedhomeip \ + --github-api-token "${{ secrets.GITHUB_TOKEN }}" \ + --release-tag "${{ github.event.inputs.releaseTag }}" \ + --bundle-files $BUILD_DIRECTORY/lock_app.flashbundle.txt \ + --working-directory $BUILD_DIRECTORY \ + --bundle-name efr32-$EFR32_BOARD-chip-lock-example diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml new file mode 100644 index 00000000000000..bf59a586b67bde --- /dev/null +++ b/.github/workflows/smoketest-android.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2020 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: Smoke test - Android + +on: + pull_request: + workflow_dispatch: + +concurrency: + group: smoke-${{ 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: + android: + name: Smoke Run - Android + timeout-minutes: 60 + + env: + JAVA_HOME: /usr/lib/jvm/java-8-openjdk-amd64/ + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-android:0.5.77 + volumes: + - "/tmp/log_output:/tmp/test_logs" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform android + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build Android CHIPTool and CHIPTest (ARM64) + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --no-log-timestamps --target android-arm64-chip-tool build" + - name: Run Android build rule tests + run: | + ./scripts/run_in_build_env.sh \ + "ninja -C out/android-arm64-chip-tool build/chip/java/tests:java_build_test.tests" diff --git a/.github/workflows/spell.yml b/.github/workflows/spell.yml new file mode 100644 index 00000000000000..98af5202d43748 --- /dev/null +++ b/.github/workflows/spell.yml @@ -0,0 +1,53 @@ +# Copyright (c) 2020-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: Run misspell + +on: + push: + paths: + - "**.md" + - ".github/.wordlist.txt" + pull_request: + paths: + - "**.md" + - ".github/.wordlist.txt" + +jobs: + check-reviewdog: + runs-on: ubuntu-latest + 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 + - uses: reviewdog/action-misspell@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + check-spellcheck: + runs-on: ubuntu-latest + 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 + - uses: igsekor/pyspelling-any@v0.0.2 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 00000000000000..771c4949340f04 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,390 @@ +# Copyright (c) 2020-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: Tests + +on: + push: + pull_request: + 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 + +jobs: + test_suites_linux: + name: Test Suites - Linux + timeout-minutes: 120 + + strategy: + matrix: + build_variant: [no-ble-tsan-clang] + chip_tool: ["", -same-event-loop] + env: + BUILD_VARIANT: ${{matrix.build_variant}} + CHIP_TOOL_VARIANT: ${{matrix.chip_tool}} + TSAN_OPTIONS: "halt_on_error=1 suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" + + if: github.actor != 'restyled-io[bot]' + runs-on: ubuntu-latest + + container: + image: connectedhomeip/chip-build:0.5.77 + options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 + net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux + - name: Try to ensure the directories for core dumping exist and we + can write them. + run: | + mkdir /tmp/cores || true + sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true + mkdir objdir-clone || true + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build Apps + timeout-minutes: 30 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target linux-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT} \ + --target linux-x64-all-clusters-${BUILD_VARIANT} \ + --target linux-x64-lock-${BUILD_VARIANT} \ + --target linux-x64-ota-provider-${BUILD_VARIANT} \ + --target linux-x64-ota-requestor-${BUILD_VARIANT} \ + --target linux-x64-tv-app-${BUILD_VARIANT} \ + build \ + --copy-artifacts-to objdir-clone \ + " + - name: Run Tests + timeout-minutes: 40 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/tests/run_test_suite.py \ + --chip-tool ./out/linux-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT}/chip-tool \ + run \ + --iterations 1 \ + --all-clusters-app ./out/linux-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \ + --lock-app ./out/linux-x64-lock-${BUILD_VARIANT}/chip-lock-app \ + --ota-provider-app ./out/linux-x64-ota-provider-${BUILD_VARIANT}/chip-ota-provider-app \ + --ota-requestor-app ./out/linux-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \ + --tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ + " + - name: Uploading core files + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: crash-core-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: /tmp/cores/ + # Cores are big; don't hold on to them too long. + retention-days: 5 + - name: Uploading objdir for debugging + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: crash-objdir-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: objdir-clone/ + # objdirs are big; don't hold on to them too long. + retention-days: 5 + test_suites_darwin: + name: Test Suites - Darwin + timeout-minutes: 120 + + strategy: + matrix: + build_variant: [no-ble-tsan-clang, no-ble-asan-clang] + chip_tool: ["", -same-event-loop] + env: + BUILD_VARIANT: ${{matrix.build_variant}} + CHIP_TOOL_VARIANT: ${{matrix.chip_tool}} + TSAN_OPTIONS: "halt_on_error=1" + + if: github.actor != 'restyled-io[bot]' + runs-on: macos-latest + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform darwin + - name: Setup Environment + # coreutils for stdbuf + run: brew install openssl pkg-config coreutils + - name: + Try to ensure the directories for core dumping and diagnostic + log collection exist and we can write them. + run: | + sudo chown ${USER} /cores || true + mkdir -p ~/Library/Logs/DiagnosticReports || true + mkdir objdir-clone || true + - name: Fix pkgconfig link + working-directory: /usr/local/lib/pkgconfig + run: | + pwd + ls -la /usr/local/Cellar/ + ls -la /usr/local/Cellar/openssl@1.1 + OPEN_SSL_VERSION=`ls -la /usr/local/Cellar/openssl@1.1 | cat | tail -n1 | awk '{print $NF}'` + ln -s /usr/local/Cellar/openssl@1.1/$OPEN_SSL_VERSION/lib/pkgconfig/* . + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build Apps + timeout-minutes: 30 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target darwin-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT} \ + --target darwin-x64-all-clusters-${BUILD_VARIANT} \ + --target darwin-x64-lock-${BUILD_VARIANT} \ + --target darwin-x64-ota-provider-${BUILD_VARIANT} \ + --target darwin-x64-ota-requestor-${BUILD_VARIANT} \ + --target darwin-x64-tv-app-${BUILD_VARIANT} \ + build \ + --copy-artifacts-to objdir-clone \ + " + - name: Run Tests + timeout-minutes: 50 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/tests/run_test_suite.py \ + --chip-tool ./out/darwin-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT}/chip-tool \ + --target-skip-glob '{TestGroupMessaging,Test_TC_DIAG_TH_NW_1_1,Test_TC_DIAG_TH_NW_1_2,Test_TC_DIAG_TH_NW_2_2,Test_TC_DIAG_TH_NW_2_3,Test_TC_DIAG_TH_NW_2_6,Test_TC_DIAG_TH_NW_2_7,Test_TC_DIAG_TH_NW_2_8,Test_TC_DIAG_TH_NW_2_9}' \ + run \ + --iterations 1 \ + --all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \ + --lock-app ./out/darwin-x64-lock-${BUILD_VARIANT}/chip-lock-app \ + --ota-provider-app ./out/darwin-x64-ota-provider-${BUILD_VARIANT}/chip-ota-provider-app \ + --ota-requestor-app ./out/darwin-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \ + --tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \ + " + - name: Uploading core files + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: crash-core-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: /cores/ + # Cores are big; don't hold on to them too long. + retention-days: 5 + - name: Uploading diagnostic logs + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: crash-log-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: ~/Library/Logs/DiagnosticReports/ + - name: Uploading objdir for debugging + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: crash-objdir-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: objdir-clone/ + # objdirs are big; don't hold on to them too long. + retention-days: 5 + repl_tests_linux: + name: REPL Tests - Linux + timeout-minutes: 120 + + env: + TSAN_OPTIONS: "halt_on_error=1 suppressions=scripts/tests/chiptest/tsan-linux-suppressions.txt" + + if: github.actor != 'restyled-io[bot]' + runs-on: ubuntu-latest + + container: + image: connectedhomeip/chip-build:0.5.77 + options: + --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 + net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux + - name: + Try to ensure the directories for core dumping exist and we + can write them. + run: | + mkdir /tmp/cores || true + sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true + mkdir objdir-clone || true + - name: Bootstrap + timeout-minutes: 10 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: + bootstrap-logs-linux-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build Python REPL and example apps + timeout-minutes: 50 + run: | + scripts/run_in_build_env.sh './scripts/build_python.sh --install_wheel build-env' + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target linux-x64-all-clusters-no-ble-no-wifi-tsan-clang-test \ + --target linux-x64-python-bindings \ + build \ + --copy-artifacts-to objdir-clone \ + " + - name: Run Tests + timeout-minutes: 30 + run: | + scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --script-args "--log-level INFO -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' + - name: Uploading core files + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-core-linux-python-repl + path: /tmp/cores/ + # Cores are big; don't hold on to them too long. + retention-days: 5 + - name: Uploading objdir for debugging + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-objdir-linux-python-repl + path: objdir-clone/ + # objdirs are big; don't hold on to them too long. + retention-days: 5 + + repl_tests_darwin: + name: REPL Tests - Darwin + timeout-minutes: 120 + + strategy: + matrix: + build_variant: [no-ble-no-wifi-tsan-clang] + env: + BUILD_VARIANT: ${{matrix.build_variant}} + TSAN_OPTIONS: "halt_on_error=1" + + if: github.actor != 'restyled-io[bot]' && false + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform darwin + - name: Setup Environment + # coreutils for stdbuf + run: brew install openssl pkg-config coreutils + - name: + Try to ensure the directories for core dumping and diagnostic + log collection exist and we can write them. + run: | + sudo chown ${USER} /cores || true + mkdir -p ~/Library/Logs/DiagnosticReports || true + mkdir objdir-clone || true + - name: Fix pkgconfig link + working-directory: /usr/local/lib/pkgconfig + run: | + pwd + ls -la /usr/local/Cellar/ + ls -la /usr/local/Cellar/openssl@1.1 + OPEN_SSL_VERSION=`ls -la /usr/local/Cellar/openssl@1.1 | cat | tail -n1 | awk '{print $NF}'` + ln -s /usr/local/Cellar/openssl@1.1/$OPEN_SSL_VERSION/lib/pkgconfig/* . + - name: Bootstrap + timeout-minutes: 25 + run: scripts/build/gn_bootstrap.sh + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: + bootstrap-logs-darwin-${{ matrix.build_variant }}${{ matrix.chip_tool }} + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Build Python REPL and example apps + timeout-minutes: 50 + run: | + scripts/run_in_build_env.sh './scripts/build_python.sh --install_wheel build-env' + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target darwin-x64-all-clusters-${BUILD_VARIANT}-test \ + build \ + --copy-artifacts-to objdir-clone \ + " + - name: Run Tests + timeout-minutes: 30 + run: | + scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/darwin-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 3840 --interface-id -1" --script-args "-t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' + - name: Uploading core files + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-core-darwin-python-repl + path: /cores/ + # Cores are big; don't hold on to them too long. + retention-days: 5 + - name: Uploading diagnostic logs + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-log-darwin-python-repl + path: ~/Library/Logs/DiagnosticReports/ + - name: Uploading objdir for debugging + uses: actions/upload-artifact@v2 + if: ${{ failure() }} && ${{ !env.ACT }} + with: + name: + crash-objdir-darwin-python-repl + path: objdir-clone/ + # objdirs are big; don't hold on to them too long. + retention-days: 5 diff --git a/.github/workflows/todos.yaml b/.github/workflows/todos.yaml new file mode 100644 index 00000000000000..e6d31a6b3d8642 --- /dev/null +++ b/.github/workflows/todos.yaml @@ -0,0 +1,44 @@ +name: Create issues from To-Dos + +on: + workflow_dispatch: + inputs: + importAll: + default: "false" + required: false + type: boolean + description: Enable, if you want to import all TODOs. Runs on checked out branch! Only use if you're sure what you are doing. +# push: Will move this to a cadence +# branches: +# - master + +permissions: + issues: write + repository-projects: read + contents: read + +jobs: + todos: + name: Scan for To-Dos + runs-on: ubuntu-latest + + 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: Run Issue Bot + uses: derjuulsn/todo-issue@main + with: + # autoAssign: false + reopenClosed: false + # label: "todo" + # disabled until this works: https://github.com/DerJuulsn/todo-issue/issues/9 + keywords: "todo,fixme,bug,TODO,FIXME,BUG" + excludePattern: "^(node_modules/|third_party/|zzz_generated/|docs/|.vscode/)" + env: + GITHUB_TOKEN: ${{ secrets.MATTER_PAT }} diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml new file mode 100644 index 00000000000000..92c5db7a27a938 --- /dev/null +++ b/.github/workflows/unit_integration_test.yaml @@ -0,0 +1,101 @@ +# Copyright (c) 2020 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: Unit / Interation Tests + +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: + unit_tests: + name: Unit / Interation Tests + timeout-minutes: 60 + if: github.actor != 'restyled-io[bot]' + + strategy: + matrix: + type: [main, clang, mbedtls, rotating_device_id] + env: + BUILD_TYPE: ${{ matrix.type }} + + runs-on: ubuntu-latest + + container: + image: connectedhomeip/chip-build:0.5.77 + volumes: + - "/tmp/log_output:/tmp/test_logs" + options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux + - name: Bootstrap + timeout-minutes: 10 + run: | + mkdir -p /tmp/log_output ; + scripts/build/gn_bootstrap.sh ; + - name: Uploading bootstrap logs + uses: actions/upload-artifact@v2 + if: ${{ always() }} && ${{ !env.ACT }} + with: + name: bootstrap-logs + path: | + .environment/gn_out/.ninja_log + .environment/pigweed-venv/*.log + - name: Artifact suffix + id: outsuffix + uses: haya14busa/action-cond@v1.0.0 + if: ${{ !env.ACT }} + with: + cond: ${{ github.event.pull_request.number == '' }} + if_true: "${{ github.sha }}" + if_false: "pull-${{ github.event.pull_request.number }}" + - name: Setup Build + run: | + case $BUILD_TYPE in + "main") GN_ARGS='';; + "clang") GN_ARGS='is_clang=true';; + "mbedtls") GN_ARGS='chip_crypto="mbedtls"';; + "rotating_device_id") GN_ARGS='chip_enable_rotating_device_id=true';; + *) ;; + esac + + scripts/build/gn_gen.sh --args="$GN_ARGS" + - name: Run Build + timeout-minutes: 30 + run: scripts/run_in_build_env.sh "ninja -C out/$BUILD_TYPE" + - name: Run Tests + timeout-minutes: 30 + run: scripts/tests/gn_tests.sh + # TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227 + # TODO https://github.com/project-chip/connectedhomeip/issues/1512 + # - name: Run Code Coverage + # if: ${{ contains('main', env.BUILD_TYPE) }} + # run: scripts/tools/codecoverage.sh + # - name: Upload Code Coverage + # if: ${{ contains('main', env.BUILD_TYPE) }} + # run: bash <(curl -s https://codecov.io/bash) diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml new file mode 100644 index 00000000000000..0584c11887fd1d --- /dev/null +++ b/.github/workflows/zap_regeneration.yaml @@ -0,0 +1,73 @@ +# Copyright (c) 2020 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: ZAP - Regenerate + +on: + 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 + +jobs: + zap_regeneration: + name: ZAP Regeneration + timeout-minutes: 60 + + runs-on: ubuntu-20.04 + container: + image: connectedhomeip/chip-build-zap:0.5.77 + defaults: + run: + shell: sh + if: github.actor != 'restyled-io[bot]' + + steps: + - uses: Wandalen/wretry.action@v1.0.15 + name: Checkout + with: + action: actions/checkout@v3 + with: | + submodules: true + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - name: Setup ZAP + timeout-minutes: 5 + run: | + cd third_party/zap/repo/ + npm ci + npm run version-stamp + npm rebuild canvas --update-binary + npm run build-spa + - name: Generate all + timeout-minutes: 5 + run: scripts/tools/zap_regen_all.py + - name: Add uncommitted changes + run: git add . + - name: Fix upstream + run: | + git remote set-url origin https://x-access-token:$COMMITTER_TOKEN@github.com/$GITHUB_REPOSITORY.git + git config --global user.email "$USER_EMAIL" + git config --global user.name "$USER_NAME" + env: + COMMITTER_TOKEN: ${{ secrets.MATTER_PAT }} + USER_EMAIL: ${{ secrets.MATTER_PAT_EMAIL }} + USER_NAME: ${{ secrets.MATTER_PAT_NAME }} + GITHUB_REPOSITORY: ${{ github.GITHUB_REPOSITORY }} + - name: Commit + run: git commit -a -m "Regenerating ZAP" + - name: Push + run: git push diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml new file mode 100644 index 00000000000000..f5a1d809540dfd --- /dev/null +++ b/.github/workflows/zap_templates.yaml @@ -0,0 +1,68 @@ +# Copyright (c) 2020 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: ZAP + +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: + zap_templates: + name: ZAP templates generation + timeout-minutes: 60 + + runs-on: ubuntu-20.04 + container: + image: connectedhomeip/chip-build-zap:0.5.77 + defaults: + run: + shell: sh + if: github.actor != 'restyled-io[bot]' + + 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: Checkout submodules + run: scripts/checkout_submodules.py --shallow --platform linux + - name: Setup ZAP + timeout-minutes: 10 + run: | + cd third_party/zap/repo/ + npm ci + npm run version-stamp + npm rebuild canvas --update-binary + npm run build-spa + - name: Generate all + timeout-minutes: 30 + run: scripts/tools/zap_regen_all.py + - name: Check for uncommited changes + run: | + git add . + # Show the full diff + git diff-index -p HEAD -- + # Also show just the files that are different, to make it easy + # to tell at a glance what might be going on. And throw in + # --exit-code to make this job fail if there is a difference. + git diff-index --exit-code HEAD --