From 189c2a6fc0ec262712dd7800f5e83b836fcccad8 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Thu, 12 Jan 2023 13:01:06 -0800 Subject: [PATCH] Use compute engine to build coverage and app engine to publish the result --- integrations/appengine/README.md | 36 ++++++++++++ integrations/appengine/webapp_config.yaml | 10 ++++ .../cloudbuild/build-coverage-remote.yaml | 18 ------ integrations/cloudbuild/build-coverage.yaml | 55 ------------------- scripts/build_coverage.sh | 2 - 5 files changed, 46 insertions(+), 75 deletions(-) create mode 100644 integrations/appengine/README.md create mode 100644 integrations/appengine/webapp_config.yaml delete mode 100644 integrations/cloudbuild/build-coverage-remote.yaml delete mode 100644 integrations/cloudbuild/build-coverage.yaml diff --git a/integrations/appengine/README.md b/integrations/appengine/README.md new file mode 100644 index 00000000000000..45ecbe50d585eb --- /dev/null +++ b/integrations/appengine/README.md @@ -0,0 +1,36 @@ +## Deploy Static Website on App Engine + +### Setup google cloud integration + +Follow https://cloud.google.com/sdk/docs/install. + +### Build Coverage Report + +To check out the Matter repository: + +``` +git clone --recurse-submodules git@github.com:project-chip/connectedhomeip.git +``` + +Run the following command to build coverage report: + +``` +cd connectedhomeip +./scripts/build_coverage.sh +``` + +After a successful build, the coverage report is located at +`out/coverage/coverage` + +#### Upload your static website to Google App Engine + +File `integrations/appengine/webapp_config.yaml` is used to configure the +settings of your App Engine application. + +Directory `out/coverage/coverage` contains the coverage report files, such as +HTML, CSS, images, and JavaScript. + +``` +cd out/coverage/coverage +gcloud app deploy ../../../integrations/appengine/webapp_config.yaml +``` diff --git a/integrations/appengine/webapp_config.yaml b/integrations/appengine/webapp_config.yaml new file mode 100644 index 00000000000000..839b6aa94d671b --- /dev/null +++ b/integrations/appengine/webapp_config.yaml @@ -0,0 +1,10 @@ +runtime: python27 +api_version: 1 +threadsafe: true +handlers: + - url: / + static_files: html/index.html + upload: html/index.html + - url: /(.*) + static_files: html/\1 + upload: html/(.*) diff --git a/integrations/cloudbuild/build-coverage-remote.yaml b/integrations/cloudbuild/build-coverage-remote.yaml deleted file mode 100644 index 1d78608cfe8a4d..00000000000000 --- a/integrations/cloudbuild/build-coverage-remote.yaml +++ /dev/null @@ -1,18 +0,0 @@ -steps: - - name: gcr.io/$PROJECT_ID/remote-builder - env: - - GIT_CLONE_CMD=git clone --recurse-submodules https://github.com/project-chip/connectedhomeip.git; - - RUN_COVERAGE_CMD=connectedhomeip/scripts/build_coverage.sh; - - CLEANUP_CMD=rm -rf connectedhomeip; - - PROJECT_ID=$PROJECT_ID - -logsBucket: matter-build-automation-coverage-logs - -# Global timeout for all steps -timeout: 21600s -queueTtl: 21600s - -artifacts: - objects: - location: "gs://matter-build-automation-coverage-logs/$PROJECT_ID/$COMMIT_SHA/" - paths: ["/workspace/coverage_html.tar.gz"] \ No newline at end of file diff --git a/integrations/cloudbuild/build-coverage.yaml b/integrations/cloudbuild/build-coverage.yaml deleted file mode 100644 index 53f5c88195d7d7..00000000000000 --- a/integrations/cloudbuild/build-coverage.yaml +++ /dev/null @@ -1,55 +0,0 @@ -steps: - - name: gcr.io/cloud-builders/git - args: - - submodule - - update - - "--init" - - "--recursive" - id: Submodules - - - name: "connectedhomeip/chip-build:0.6.30" - 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:0.6.30" - 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 a978b8d608c00c..c8aa555ff264ec 100755 --- a/scripts/build_coverage.sh +++ b/scripts/build_coverage.sh @@ -168,5 +168,3 @@ 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" .