Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated test-unit.yml to comment a coverage report #407

21 changes: 13 additions & 8 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,27 @@ jobs:
- uses: actions/checkout@v3
with: { fetch-depth: 1 }
- uses: actions/setup-go@v3
with: { go-version: "${{ matrix.go }}" }
with:
go-version: "${{ matrix.go }}"
- run: go version
- run: make test-unit race=true
- uses: codecov/codecov-action@v1
- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
file: tmp/unit.cov
flags: unit
if: matrix.os == 'ubuntu-latest'

file: coverage.out
- name: Comment coverage report
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ] || [ "${{ matrix.os }}" == "windows-latest" ] || [ "${{ matrix.os }}" == "macOS-latest" ]; then
curl -sSfL https://codecov.io/bash | bash -s -- -Z -K -f coverage.out || echo "Codecov upload failed"
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like this should be the uploader as mentioned in https://about.codecov.io/blog/getting-started-with-code-coverage-for-golang/.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I will look into that.

bench:
name: Benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with: { fetch-depth: 1 }
- uses: actions/setup-go@v3
with: { go-version: '1.x' }
with:
go-version: '1.x'
- run: go version
- run: make test-bench
- run: make test-bench
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Updated Developer guide to include docker build instructions ([#385](https://github.com/opensearch-project/opensearch-go/pull/385)
- Test against version 2.9.0,2.10.0, run tests in all branches, change intergration tests to wait for OpenSearch to start ([#392](https://github.com/opensearch-project/opensearch-go/pull/392))
- Makefile: use docker golangci-lint, run integration test on `.` folder, change coverage generation ([#392](https://github.com/opensearch-project/opensearch-go/pull/392))
- test-unit.yml: added PR comment for unit test coverage report ([#407](https://github.com/opensearch-project/opensearch-go/pull/407))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems like uploading results to CodeCov, no?

Copy link
Contributor Author

@tannerjones4075 tannerjones4075 Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was exploring leveraging CodeCov as it is already being used. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to understand the output. Is it running it twice?


### Deprecated

Expand Down
Loading