diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c60f25..fe1d7b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,29 +26,15 @@ jobs: uses: ballerina-platform/ballerina-action/@nightly with: args: - test --code-coverage + test --test-report --code-coverage --coverage-format=xml env: CLIENT_ID: ${{ secrets.CLIENT_ID }} CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} WORKING_DIR: ./gpeople - # Read the ballerina test results - - name: Read Ballerina Test Results - id: test_results - run: | - content=`cat ./gpeople/target/report/test_results.json` - content="${content//'%'/'%25'}" - content="${content//$'\n'/'%0A'}" - content="${content//$'\r'/'%0D'}" - echo "::set-output name=testResultsJson::$content" - - # Print the code coverage information - - name: Code Coverage - run: | - echo "Covered Code Lines : ${{fromJson(steps.test_results.outputs.testResultsJson).coveredLines}}" - echo "Total Code Lines : $(expr ${{fromJson(steps.test_results.outputs.testResultsJson).missedLines}} + ${{fromJson(steps.test_results.outputs.testResultsJson).coveredLines}})" - echo "Code Coverage Percentage : ${{fromJson(steps.test_results.outputs.testResultsJson).coveragePercentage}}" + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 - name: Alert notifier on failure if: failure() && (github.event.action == 'check_connector_for_breaking_changes') diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index cf584d1..ec3eafe 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -32,7 +32,7 @@ jobs: uses: ballerina-platform/ballerina-action/@nightly with: args: - test --code-coverage + test --test-report --code-coverage --coverage-format=xml env: JAVA_HOME: /usr/lib/jvm/default-jvm CLIENT_ID: ${{ secrets.CLIENT_ID }} @@ -40,22 +40,8 @@ jobs: REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} WORKING_DIR: ./gpeople - # Read the ballerina test results - - name: Read Ballerina Test Results - id: test_results - run: | - content=`cat ./gpeople/target/report/test_results.json` - content="${content//'%'/'%25'}" - content="${content//$'\n'/'%0A'}" - content="${content//$'\r'/'%0D'}" - echo "::set-output name=testResultsJson::$content" - - # Print the code coverage information - - name: Code Coverage - run: | - echo "Covered Code Lines : ${{fromJson(steps.test_results.outputs.testResultsJson).coveredLines}}" - echo "Total Code Lines : $(expr ${{fromJson(steps.test_results.outputs.testResultsJson).missedLines}} + ${{fromJson(steps.test_results.outputs.testResultsJson).coveredLines}})" - echo "Code Coverage Percentage : ${{fromJson(steps.test_results.outputs.testResultsJson).coveragePercentage}}" + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 # Send notification when build fails - name: Notify failure diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 214098e..6e32ad3 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -20,9 +20,12 @@ jobs: uses: ballerina-platform/ballerina-action/@nightly with: args: - test + test --test-report --code-coverage --coverage-format=xml env: CLIENT_ID: ${{ secrets.CLIENT_ID }} CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} WORKING_DIR: ./gpeople + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 diff --git a/README.md b/README.md index 7504e45..6ca8ce1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Ballerina Google People API Connector [![Build](https://github.com/ballerina-platform/module-ballerinax-googleapis.people/workflows/CI/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-googleapis.people/actions?query=workflow%3ACI) +[![codecov](https://codecov.io/gh/ballerina-platform/module-ballerinax-googleapis.people/branch/master/graph/badge.svg)](https://codecov.io/gh/ballerina-platform/module-ballerinax-googleapis.people) [![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerinax-googleapis.people.svg)](https://github.com/ballerina-platform/module-ballerinax-googleapis.people/commits/master) [![GraalVM Check](https://github.com/ballerina-platform/module-ballerinax-googleapis.people/actions/workflows/build-with-bal-test-native.yml/badge.svg)](https://github.com/ballerina-platform/module-ballerinax-googleapis.people/actions/workflows/build-with-bal-test-native.yml) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)