From d5e12035693a6ebf69278d24fcb53f2600784c1b Mon Sep 17 00:00:00 2001 From: Vijayan Balasubramanian Date: Wed, 5 Aug 2020 20:49:25 -0700 Subject: [PATCH] Test code coverage (#202) * Workflow changes for AD release Update release workflow to be triggered only, when a new tag is pushed ( starts with v ) * Add badge for testing and code coverage Added flag: cli for cli project Added flag: plugin for java * Include threshold * Include flag in code covereage --- .github/workflows/CI.yml | 1 + .../esad-cli-publish-artifact-workflow.yml | 7 +++-- .../esad-cli-test-and-build-workflow.yml | 2 +- README.md | 2 +- cli/README.md | 3 +- codecov.yml | 30 +++++++++++++++++++ 6 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index fe0600c9..69172c80 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -79,4 +79,5 @@ jobs: uses: codecov/codecov-action@v1 with: file: ./build/reports/jacoco/test/jacocoTestReport.xml + flags: plugin diff --git a/.github/workflows/esad-cli-publish-artifact-workflow.yml b/.github/workflows/esad-cli-publish-artifact-workflow.yml index 86b58946..a90e7035 100644 --- a/.github/workflows/esad-cli-publish-artifact-workflow.yml +++ b/.github/workflows/esad-cli-publish-artifact-workflow.yml @@ -1,5 +1,8 @@ -name: Publish -on: [pull_request, push] +name: Publish AD CLI +on: + push: + tags: + - v* jobs: build: diff --git a/.github/workflows/esad-cli-test-and-build-workflow.yml b/.github/workflows/esad-cli-test-and-build-workflow.yml index 840a0897..e3fbd8ef 100644 --- a/.github/workflows/esad-cli-test-and-build-workflow.yml +++ b/.github/workflows/esad-cli-test-and-build-workflow.yml @@ -70,5 +70,5 @@ jobs: with: token: ${{secrets.CODECOV_TOKEN}} file: cli/coverage.out - flags: unittests + flags: cli name: codecov-umbrella diff --git a/README.md b/README.md index 1f824776..7ea3ff58 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![AD Test](https://github.com/opendistro-for-elasticsearch/anomaly-detection/workflows/Build%20and%20Test%20Anomaly%20detection/badge.svg)](https://github.com/opendistro-for-elasticsearch/anomaly-detection/actions?query=workflow%3A%22Build+and+Test+Anomaly+detection%22+branch%3A%22master%22) -[![codecov](https://codecov.io/gh/opendistro-for-elasticsearch/anomaly-detection/branch/master/graph/badge.svg)](https://codecov.io/gh/opendistro-for-elasticsearch/anomaly-detection) +[![codecov](https://codecov.io/gh/opendistro-for-elasticsearch/anomaly-detection/branch/master/graph/badge.svg?flag=plugin)](https://codecov.io/gh/opendistro-for-elasticsearch/anomaly-detection) [![Documentation](https://img.shields.io/badge/doc-reference-blue)](https://opendistro.github.io/for-elasticsearch-docs/docs/ad/) [![Forum](https://img.shields.io/badge/chat-on%20forums-blue)](https://discuss.opendistrocommunity.dev/c/Use-this-category-for-all-questions-around-machine-learning-plugins) ![PRs welcome!](https://img.shields.io/badge/PRs-welcome!-success) diff --git a/cli/README.md b/cli/README.md index 4ff674b4..7869dcec 100644 --- a/cli/README.md +++ b/cli/README.md @@ -1,4 +1,5 @@ -![AD CLI Test and Build](https://github.com/opendistro-for-elasticsearch/anomaly-detection/workflows/AD%20CLI%20Test%20and%20Build/badge.svg) +[![AD CLI Test](https://github.com/opendistro-for-elasticsearch/anomaly-detection/workflows/AD%20CLI%20Test%20and%20Build/badge.svg)](https://github.com/opendistro-for-elasticsearch/anomaly-detection/actions?query=workflow%3A%22AD+CLI+Test+and+Build%22+branch%3Amaster) +[![codecov](https://codecov.io/gh/opendistro-for-elasticsearch/anomaly-detection/branch/master/graph/badge.svg?flag=cli)](https://codecov.io/gh/opendistro-for-elasticsearch/anomaly-detection) # Open Distro for Elasticsearch AD CLI The AD CLI component in Open Distro for Elasticsearch (ODFE) is a command line interface for ODFE AD plugin. diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..4922c28d --- /dev/null +++ b/codecov.yml @@ -0,0 +1,30 @@ +coverage: + status: + project: + default: + threshold: 1 + target: auto + plugin: + target: 70% + paths: + - "!cli/" + flags: + - plugin + cli: + target: 78% + paths: + - "cli/" + flags: + - cli +comment: + layout: "reach, diff, flags, files" + behavior: default + require_changes: false + require_base: no + require_head: no + branches: null +flags: + plugin: + carryforward: true + cli: + carryforward: true \ No newline at end of file