Skip to content

Commit

Permalink
Add test coverage collection (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
tigrannajaryan authored May 13, 2022
1 parent 53396b1 commit b15d4c8
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ jobs:
- name: Install dependencies
if: steps.module-cache.outputs.cache-hit != 'true'
run: make gomoddownload
- name: Cache Tools
id: tool-cache
uses: actions/cache@v3
with:
path: /home/runner/go/bin
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }}
- name: Install Tools
if: steps.tool-cache.outputs.cache-hit != 'true'
run: make install-tools

build-and-test:
runs-on: ubuntu-latest
needs: [setup-environment]
Expand Down Expand Up @@ -56,3 +66,43 @@ jobs:
key: go-build-unittest-${{ runner.os }}-${{ hashFiles('**/go.mod', '**/go.sum') }}
- name: Build and Test
run: make

test-coverage:
runs-on: ubuntu-latest
needs: [setup-environment]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Setup Go Environment
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Cache Go
id: module-cache
uses: actions/cache@v3
with:
path: /home/runner/go/pkg/mod
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Cache Tools
id: tool-cache
uses: actions/cache@v3
with:
path: /home/runner/go/bin
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }}
- name: Cache Build
uses: actions/cache@v3
with:
path: /home/runner/.cache/go-build
key: go-build-coverage-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Run Unit Tests With Coverage
run: make test-with-cover
- name: Upload coverage report
uses: codecov/codecov-action@v3
with:
file: ./coverage.out
fail_ci_if_error: true
verbose: true
1 change: 1 addition & 0 deletions internal/tools/empty.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package tools
29 changes: 29 additions & 0 deletions internal/tools/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module github.com/open-telemetry/opamp-go/internal/tools

go 1.17

require github.com/ory/go-acc v0.2.8

require (
github.com/cespare/xxhash v1.1.0 // indirect
github.com/dgraph-io/ristretto v0.0.2 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/google/uuid v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mitchellh/mapstructure v1.3.2 // indirect
github.com/ory/viper v1.7.5 // indirect
github.com/pborman/uuid v1.2.0 // indirect
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v1.0.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
golang.org/x/text v0.3.2 // indirect
gopkg.in/ini.v1 v1.57.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
)
Loading

0 comments on commit b15d4c8

Please sign in to comment.