forked from eclipse-kanto/aws-connector
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#218] Add workflows to test go coverage actions
Signed-off-by: Ivan Marinov <ivan.marinov@bosch.io>
- Loading branch information
1 parent
175a638
commit 4ad0c15
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Create Coverage | ||
|
||
on: push | ||
permissions: write-all | ||
jobs: | ||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.21.0' | ||
- name: test | ||
run: go test -v ./... | ||
- name: Update coverage report | ||
uses: ncruces/go-coverage-report@v0 | ||
with: | ||
report: true | ||
chart: true | ||
amend: true | ||
reuse-go: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Create Coverage | ||
|
||
on: push | ||
permissions: write-all | ||
jobs: | ||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.21.0' | ||
- name: Setup | ||
run: | | ||
go mod download | ||
go get -t ./... | ||
go build | ||
- name: generate test coverage | ||
run: go test ./... -coverprofile=coverage.out | ||
|
||
- name: check test coverage | ||
uses: vladopajic/go-test-coverage@v2 | ||
with: | ||
profile: coverage.out | ||
local-prefix: github.com/eclipse-kanto/aws-connector | ||
threshold-file: 80 | ||
threshold-package: 80 | ||
threshold-total: 95 | ||
## when token is not specified (value '') this feature is turend off | ||
## in this example badge is created and committed only for main brach | ||
## git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }} | ||
git-token: ${{ secrets.GITHUB_TOKEN }} | ||
## name of branch where badges are stored | ||
## ideally this should be orphan branch (see below how to create this branch) | ||
git-branch: badges | ||
|