From 19d459357f1b6794e12f156b3ef7b3288a9b694f Mon Sep 17 00:00:00 2001 From: Zhongnan Su Date: Wed, 23 Jun 2021 14:35:20 -0700 Subject: [PATCH 1/2] Add codecov Signed-off-by: Zhongnan Su --- ...boards-reports-test-and-build-workflow.yml | 8 ++++ ...orts-scheduler-test-and-build-workflow.yml | 10 +++++ reports-scheduler/.codecov.yml | 39 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 reports-scheduler/.codecov.yml diff --git a/.github/workflows/dashboards-reports-test-and-build-workflow.yml b/.github/workflows/dashboards-reports-test-and-build-workflow.yml index 1fc6eaa9..6e1ad9dc 100644 --- a/.github/workflows/dashboards-reports-test-and-build-workflow.yml +++ b/.github/workflows/dashboards-reports-test-and-build-workflow.yml @@ -6,6 +6,7 @@ env: PLUGIN_NAME: reportsDashboards OPENSEARCH_VERSION: '1.0' OPENSEARCH_PLUGIN_VERSION: 1.0.0.0-rc1 + CODECOV_TOKEN: '50c9356f-775f-472c-bcfb-2094fc71819c' jobs: build: @@ -51,6 +52,13 @@ jobs: max_attempts: 3 command: cd OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}; yarn test + - name: Upload coverage + uses: codecov/codecov-action@v1 + with: + flags: dashboards-reports + directory: OpenSearch-Dashboards/plugins/ + token: ${{ env.CODECOV_TOKEN }} + - name: Build Artifact run: | cd OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} diff --git a/.github/workflows/reports-scheduler-test-and-build-workflow.yml b/.github/workflows/reports-scheduler-test-and-build-workflow.yml index 28b088f5..6f86251e 100644 --- a/.github/workflows/reports-scheduler-test-and-build-workflow.yml +++ b/.github/workflows/reports-scheduler-test-and-build-workflow.yml @@ -2,6 +2,9 @@ name: Test and Build Reports Scheduler on: [push, pull_request] +env: + CODECOV_TOKEN: '50c9356f-775f-472c-bcfb-2094fc71819c' + jobs: build: runs-on: ubuntu-latest @@ -54,6 +57,13 @@ jobs: cd reports-scheduler ./gradlew build -Dopensearch.version=1.0.0-rc1 + - name: Upload coverage + uses: codecov/codecov-action@v1 + with: + flags: reports-scheduler + directory: reports-scheduler/ + token: ${{ env.CODECOV_TOKEN }} + - name: Create Artifact Path run: | mkdir -p reports-scheduler-builds diff --git a/reports-scheduler/.codecov.yml b/reports-scheduler/.codecov.yml new file mode 100644 index 00000000..84e02daa --- /dev/null +++ b/reports-scheduler/.codecov.yml @@ -0,0 +1,39 @@ +## +# SPDX-License-Identifier: Apache-2.0 +# +# The OpenSearch Contributors require contributions made to +# this file be licensed under the Apache-2.0 license or a +# compatible open source license. +# +# Modifications Copyright OpenSearch Contributors. See +# GitHub history for details. +## + +## +# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# or in the "license" file accompanying this file. This file 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. +# +## + +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "70...100" + status: + project: + default: + target: 70% # the required coverage value + threshold: 1% # the leniency in hitting the target \ No newline at end of file From 4485953eba2ad3748a22a0ac377085c5a7fe510d Mon Sep 17 00:00:00 2001 From: Zhongnan Su Date: Wed, 23 Jun 2021 14:50:41 -0700 Subject: [PATCH 2/2] add yarn test --coverage --- .../workflows/dashboards-reports-test-and-build-workflow.yml | 5 ++--- .../workflows/reports-scheduler-test-and-build-workflow.yml | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dashboards-reports-test-and-build-workflow.yml b/.github/workflows/dashboards-reports-test-and-build-workflow.yml index 6e1ad9dc..fe51bf88 100644 --- a/.github/workflows/dashboards-reports-test-and-build-workflow.yml +++ b/.github/workflows/dashboards-reports-test-and-build-workflow.yml @@ -6,7 +6,6 @@ env: PLUGIN_NAME: reportsDashboards OPENSEARCH_VERSION: '1.0' OPENSEARCH_PLUGIN_VERSION: 1.0.0.0-rc1 - CODECOV_TOKEN: '50c9356f-775f-472c-bcfb-2094fc71819c' jobs: build: @@ -50,14 +49,14 @@ jobs: with: timeout_minutes: 30 max_attempts: 3 - command: cd OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}; yarn test + command: cd OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}; yarn test --coverage - name: Upload coverage uses: codecov/codecov-action@v1 with: flags: dashboards-reports directory: OpenSearch-Dashboards/plugins/ - token: ${{ env.CODECOV_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} - name: Build Artifact run: | diff --git a/.github/workflows/reports-scheduler-test-and-build-workflow.yml b/.github/workflows/reports-scheduler-test-and-build-workflow.yml index 6f86251e..1785064c 100644 --- a/.github/workflows/reports-scheduler-test-and-build-workflow.yml +++ b/.github/workflows/reports-scheduler-test-and-build-workflow.yml @@ -2,8 +2,6 @@ name: Test and Build Reports Scheduler on: [push, pull_request] -env: - CODECOV_TOKEN: '50c9356f-775f-472c-bcfb-2094fc71819c' jobs: build: @@ -62,7 +60,7 @@ jobs: with: flags: reports-scheduler directory: reports-scheduler/ - token: ${{ env.CODECOV_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} - name: Create Artifact Path run: |