From 1536436c0499f7e6928fcb50f12fce3714172482 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 18 Nov 2021 01:36:30 -0500 Subject: [PATCH] Remove scripts/build/gn_build.sh (#11905) * Remove scripts/build/gn_build.sh * Update python lib build logic: remove extra for loop, fix arguments and output path * use out directly in the test workflow: build type variable is not exported * Fix darwin build type logic: global argument not needed, update for loop * Use run in build environment to execute ninja * Add .sh suffix to run_in_build_env * Make run in build env be able to run in both linux and mac * Run ninja in the build env for happy tests as well --- .github/workflows/build.yaml | 59 +++----------------- .github/workflows/unit_integration_test.yaml | 2 +- scripts/build/gn_build.sh | 31 ---------- scripts/run_in_build_env.sh | 2 +- src/test_driver/happy/README.md | 2 +- 5 files changed, 12 insertions(+), 84 deletions(-) delete mode 100755 scripts/build/gn_build.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9e248813cd2855..0ffe9051d7c5eb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -68,7 +68,7 @@ jobs: 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/build/gn_build.sh + run: scripts/run_in_build_env.sh "ninja -C ./out" - name: Run Tests timeout-minutes: 2 run: scripts/tests/gn_tests.sh @@ -84,12 +84,12 @@ jobs: run: scripts/build/gn_gen.sh --args="chip_detail_logging=false" - name: Run Build Without Detail Logging timeout-minutes: 20 - run: scripts/build/gn_build.sh + 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/build/gn_build.sh + run: scripts/run_in_build_env.sh "ninja -C ./out" build_linux: name: Build on Linux (gcc_release, clang, mbedtls) timeout-minutes: 60 @@ -146,7 +146,7 @@ jobs: esac scripts/build/gn_gen.sh --args="$GN_ARGS" - scripts/build/gn_build.sh + scripts/run_in_build_env.sh "ninja -C ./out" scripts/tests/gn_tests.sh done - name: Build using build_examples.py @@ -156,7 +156,7 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --no-log-timestamps --target-glob 'linux-x64-*' 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 @@ -202,64 +202,23 @@ jobs: uses: actions/checkout@v2 with: submodules: true - # - name: Initialize CodeQL - # if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/master' }} - # uses: github/codeql-action/init@v1 - # with: - # languages: "cpp" - - name: Bootstrap timeout-minutes: 10 run: scripts/build/gn_bootstrap.sh - # - name: Uploading bootstrap logs - # uses: actions/upload-artifact@v2 - # if: ${{ always() }} - # with: - # name: bootstrap-logs - # path: | - # .environment/gn_out/.ninja_log - # .environment/pigweed-venv/*.log - name: Setup Build, Run Build and Run Tests timeout-minutes: 50 run: | - for BUILD_TYPE in python_lib; do - case $BUILD_TYPE in - "python_lib") GN_ARGS='enable_rtti=true enable_pylib=true chip_config_memory_debug_checks=false chip_config_memory_debug_dmalloc=false';; - esac - - scripts/build/gn_gen.sh --args="$GN_ARGS" - scripts/build/gn_build.sh - scripts/tests/gn_tests.sh - done + 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)' - # 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_darwin: name: Build on Darwin (clang, python_lib) timeout-minutes: 90 - - env: - BUILD_TYPE: clang - runs-on: macos-latest if: github.actor != 'restyled-io[bot]' @@ -305,7 +264,7 @@ jobs: "python_lib") GN_ARGS='enable_rtti=true enable_pylib=true';; esac scripts/build/gn_gen.sh --args="$GN_ARGS" - scripts/build/gn_build.sh + scripts/run_in_build_env.sh "ninja -C ./out" scripts/tests/gn_tests.sh done - name: Uploading diagnostic logs diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index 9b392a900f5146..67b5439c51e1a7 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -85,7 +85,7 @@ jobs: scripts/build/gn_gen.sh --args="$GN_ARGS chip_enable_happy_tests=true" - name: Run Build timeout-minutes: 8 - run: scripts/build/gn_build.sh + run: scripts/run_in_build_env.sh "ninja -C out/$BUILD_TYPE" - name: Run Tests timeout-minutes: 15 run: RUN_HAPPY_TESTS=1 scripts/tests/gn_tests.sh diff --git a/scripts/build/gn_build.sh b/scripts/build/gn_build.sh deleted file mode 100755 index 3aeca6520ec3fc..00000000000000 --- a/scripts/build/gn_build.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -# -# 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. -# - -set -e - -# Build script for GN build GitHub workflow. - -CHIP_ROOT="$(dirname "$0")/../.." - -source "$CHIP_ROOT/scripts/activate.sh" - -set -x - -env - -ninja -v -C "$CHIP_ROOT/out/$BUILD_TYPE" diff --git a/scripts/run_in_build_env.sh b/scripts/run_in_build_env.sh index 5b07cb4f20f5c5..890f86fc5b6025 100755 --- a/scripts/run_in_build_env.sh +++ b/scripts/run_in_build_env.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash # # Copyright (c) 2020 Project CHIP Authors # diff --git a/src/test_driver/happy/README.md b/src/test_driver/happy/README.md index d8537c542749c2..6ed3eef1a67e64 100644 --- a/src/test_driver/happy/README.md +++ b/src/test_driver/happy/README.md @@ -35,7 +35,7 @@ $ scripts/build/gn_bootstrap.sh $ scripts/build/gn_gen.sh --args="chip_enable_happy_tests=true" - $ scripts/build/gn_build.sh + $ ninja -C ./out - Run Tests