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

ci(codecov): add Codecov reporting #1189

Merged
merged 7 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test Coverage

on:
pull_request:

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
cache: true

- name: Run all unit tests.
run: make test-coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
6 changes: 3 additions & 3 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: goreleaser
on:
push:
tags:
- '*'
- "*"

permissions:
contents: write
Expand All @@ -20,8 +20,8 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version: '>=1.19.3'
go-version: ">=1.19.3"

- run: make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ build
*_old
mockdata/
docs
dist
dist
coverage.txt
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* [#1192](https://github.com/NibiruChain/nibiru/pull/1192) - feat: chaosnet docker-compose
* [#1191](https://github.com/NibiruChain/nibiru/pull/1191) - fix(oracle): default whitelisted pairs
* [#1189](https://github.com/NibiruChain/nibiru/pull/1189) - ci(codecov): add Codecov reporting
* [#1184](https://github.com/NibiruChain/nibiru/pull/1184) - docs(oracle): proto type docs, (2) spec clean-up, and (3) remove panic case
* [#1181](https://github.com/NibiruChain/nibiru/pull/1181) - refactor(oracle): keeper method locations
* [#1180](https://github.com/NibiruChain/nibiru/pull/1180) - refactor(oracle): whitelist refactor
Expand Down
25 changes: 25 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ignore:
- "**/*.pb.go"
- "**/*.pb.gw.go"
- "**/mocks/.*"
- "**/kubernetes_mock/.*"
- "pkg"
comment: false
codecov:
require_ci_to_pass: true
parsers:
gcov:
branch_detection:
loop: yes
macro: no
method: no
conditional: yes
coverage:
range: 40..100
round: down
precision: 2
status:
project:
default:
if_not_found: success
if_ci_failed: error
11 changes: 8 additions & 3 deletions contrib/make/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
### Tests ###
###############################################################################

PACKAGES_NOSIMULATION = $(shell go list ./... | grep -v '/simapp')
PACKAGES_NOSIMULATION = ${shell go list ./... | grep -v simapp}

.PHONY: test-unit
test-unit:
@go test $(PACKAGES_NOSIMULATION) -short -cover
go test -v $(PACKAGES_NOSIMULATION) -short -coverprofile=coverage.txt -covermode=count

.PHONY: test-integration
test-integration:
@go test -v $(PACKAGES_NOSIMULATION) -cover
go test -v $(PACKAGES_NOSIMULATION) -coverprofile=coverage.txt -covermode=count

# Used for CI by Codecov
.PHONY: test-coverage
test-coverage:
go test ./... -coverprofile=coverage.txt -covermode=atomic -race

# Require Python3
.PHONY: test-create-test-cases
Expand Down