Skip to content

Commit

Permalink
Add Code Coverage Badge (aws#129)
Browse files Browse the repository at this point in the history
* code coverage test

* fixing yml file

* testing variable

* fixing yml

* fixing badge extract

* fix extract url

* fixing build

* adding checkout ref

* Commit Code Coverage Badge

* adding badge for others platforms

* Commit Code Coverage Badge

* fix mac and linux build

* fix badge dir

* Commit Code Coverage Badge

* adding git pull before commit badge

* removing mkdir

* Commit Code Coverage Badge

* Commit Code Coverage Badge

* Commit Code Coverage Badge

* Apply suggestions from code review

Co-authored-by: Bruce Irschick <[email protected]>

* fix commit

* fix commit badge

* Commit Code Coverage Badge

* fixing commit badge

* adding git folder

* Commit Code Coverage Badge

* Commit Code Coverage Badge

* Commit Code Coverage Badge

* Commit Code Coverage Badge

Co-authored-by: affonsoBQ <[email protected]>
Co-authored-by: Bruce Irschick <[email protected]>
  • Loading branch information
3 people authored Oct 26, 2022
1 parent 2bc0602 commit fed5f3a
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/badges/coverage_badge_linux.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .github/badges/coverage_badge_macOS.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .github/badges/coverage_badge_windows.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0

- name: Get Java distribution
run: |
sudo apt-get -y install software-properties-common
Expand Down Expand Up @@ -310,6 +314,34 @@ jobs:
./build/odbc/bin/documentdb-odbc-tests --catch_system_errors=false
gcovr --exclude-directories cmake-build64/odbc-test/CMakeFiles/documentdb-odbc-tests.dir$ --cobertura --output coverage.cobertura.xml
- name: Update Repository Before Commit Badge
run: |
git pull
- name: Code Coverage Badge
uses: irongut/[email protected]
with:
filename: coverage.cobertura.xml
badge: true
format: text
indicators: true
output: both

- name: Extract Code Coverage Badge
run: |
COVERAGE_BADGE=$(head -1 code-coverage-results.txt )
COVERAGE_BADGE="${COVERAGE_BADGE/'Code%20Coverage'/'Linux%20Code%20Coverage'}"
curl $COVERAGE_BADGE > .github/badges/coverage_badge_linux.svg
- name: Commit Coverage Badge
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_options: '--allow-empty --no-verify'
commit_message: Commit Code Coverage Badge
file_pattern: '*.svg'
skip_fetch: true
skip_dirty_check: true

- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/mac-debug-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,44 @@ jobs:
needs: build-mac-debug
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0


- name: Retrieve coverage
uses: actions/download-artifact@v2
with:
name: code-coverage

- name: Code Coverage Badge
uses: irongut/[email protected]
with:
filename: coverage.cobertura.xml
badge: true
format: text
indicators: true
output: both

- name: Extract Code Coverage Badge
run: |
COVERAGE_BADGE=$(head -1 code-coverage-results.txt )
COVERAGE_BADGE="${COVERAGE_BADGE/'Code%20Coverage'/'macOS%20Code%20Coverage'}"
curl $COVERAGE_BADGE > .github/badges/coverage_badge_macOS.svg
- name: Update Repository Before Commit Badge
run: |
git pull
- name: Commit Coverage Badge
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_options: '--allow-empty --no-verify'
commit_message: Commit Code Coverage Badge
file_pattern: '*.svg'
skip_fetch: true
skip_dirty_check: true

- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
Expand Down
35 changes: 33 additions & 2 deletions .github/workflows/win-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,9 @@ jobs:
needs: build-windows64_coverage
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0

- name: Retrieve coverage
uses: actions/download-artifact@v2
Expand All @@ -531,11 +534,39 @@ jobs:
indicators: true
output: both

- name: Code Coverage Badge
uses: irongut/[email protected]
with:
filename: coverage.cobertura.xml
badge: true
format: text
indicators: true
output: both

- name: Extract Code Coverage Badge
run: |
COVERAGE_BADGE=$(head -1 code-coverage-results.txt )
COVERAGE_BADGE="${COVERAGE_BADGE/'Code%20Coverage'/'Windows%20Code%20Coverage'}"
curl $COVERAGE_BADGE > .github/badges/coverage_badge_windows.svg
- name: Update Repository Before Commit Badge
run: |
git pull
- name: Commit Coverage Badge
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_options: '--allow-empty --no-verify'
commit_message: Commit Code Coverage Badge
file_pattern: '*.svg'
skip_fetch: true
skip_dirty_check: true

- name: Add Header for Code Coverage Summary Report
run: |
echo "## Windows 2022 (x32) Debug Build Unit Test Results Check" > coverage-cobertura.md
echo "## Windows 2022 (x64) Debug Build Unit Test Results Check" > coverage-cobertura.md
cat code-coverage-results.md >> coverage-cobertura.md
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Amazon DocumentDB ODBC Driver
![Code Coverage Windows](./.github/badges/coverage_badge_windows.svg)
![Code Coverage macOS](./.github/badges/coverage_badge_macOS.svg)
![Code Coverage Linux](./.github/badges/coverage_badge_linux.svg)

## Overview

Expand Down

0 comments on commit fed5f3a

Please sign in to comment.