From c89c38811e98cd3973b04bde1492ad8b8a6a5898 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Mon, 14 Nov 2022 07:49:05 -0800 Subject: [PATCH] Add couldbuild build config file for code coverage (#23578) --- integrations/cloudbuild/build-coverage.yaml | 55 +++++++++++++++++++++ scripts/build_coverage.sh | 2 + 2 files changed, 57 insertions(+) create mode 100644 integrations/cloudbuild/build-coverage.yaml diff --git a/integrations/cloudbuild/build-coverage.yaml b/integrations/cloudbuild/build-coverage.yaml new file mode 100644 index 00000000000000..cc85632b50e7e5 --- /dev/null +++ b/integrations/cloudbuild/build-coverage.yaml @@ -0,0 +1,55 @@ +steps: + - name: gcr.io/cloud-builders/git + args: + - submodule + - update + - "--init" + - "--recursive" + id: Submodules + + - name: "connectedhomeip/chip-build-vscode:0.6.06" + env: + - PW_ENVIRONMENT_ROOT=/pwenv + args: + - "-c" + - source ./scripts/bootstrap.sh + id: Bootstrap + waitFor: + - Submodules + entrypoint: /usr/bin/bash + volumes: + - name: pwenv + path: /pwenv + timeout: 900s + + - name: "connectedhomeip/chip-build-vscode:0.6.06" + env: + - PW_ENVIRONMENT_ROOT=/pwenv + args: + - "-c" + - ./scripts/build_coverage.sh + id: BuildCoverage + waitFor: + - Bootstrap + entrypoint: /usr/bin/bash + volumes: + - name: pwenv + path: /pwenv + timeout: 900s + +logsBucket: matter-build-automation-build-logs + +# Global timeout for all steps +timeout: 21600s +queueTtl: 21600s + +artifacts: + objects: + location: "gs://matter-build-automation-artifacts/$PROJECT_ID/$COMMIT_SHA/" + paths: ["/out/coverage/coverage/coverage_html.tar.gz"] + +# Using higher CPU machines generally speeds up builds, except bootstrap is always +# slow. +options: + machineType: "E2_HIGHCPU_32" + diskSizeGb: 500 diff --git a/scripts/build_coverage.sh b/scripts/build_coverage.sh index c8aa555ff264ec..a978b8d608c00c 100755 --- a/scripts/build_coverage.sh +++ b/scripts/build_coverage.sh @@ -168,3 +168,5 @@ lcov --initial --capture --directory "$OUTPUT_ROOT/obj/src" --exclude="$PWD"/zzz lcov --capture --directory "$OUTPUT_ROOT/obj/src" --exclude="$PWD"/zzz_generated/* --exclude="$PWD"/third_party/* --exclude=/usr/include/* --output-file "$COVERAGE_ROOT/lcov_test.info" lcov --add-tracefile "$COVERAGE_ROOT/lcov_base.info" --add-tracefile "$COVERAGE_ROOT/lcov_test.info" --output-file "$COVERAGE_ROOT/lcov_final.info" genhtml "$COVERAGE_ROOT/lcov_final.info" --output-directory "$COVERAGE_ROOT/html" + +tar czvf "$COVERAGE_ROOT/coverage_html.tar.gz" -C "$COVERAGE_ROOT/html" .