-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from regen-network/9-setup-test-coverage-CI-job
[#9] add codecov coverage reporting
- Loading branch information
Showing
6 changed files
with
90 additions
and
4 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,25 @@ | ||
# | ||
# This codecov.yml is the default configuration for | ||
# all repositories on Codecov. You may adjust the settings | ||
# below in your own codecov.yml in your repository. | ||
# | ||
coverage: | ||
precision: 2 | ||
round: down | ||
range: 70...100 | ||
|
||
status: | ||
# Learn more at https://codecov.io/docs#yaml_default_commit_status | ||
project: | ||
default: | ||
threshold: 1% # allow this much decrease on project | ||
changes: false | ||
|
||
comment: | ||
layout: "header, diff" | ||
behavior: default # update if exists else create new | ||
|
||
ignore: | ||
- "docs" | ||
- "*.md" | ||
- "*.org" |
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
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
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
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,14 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
PKGS=$(go list ./...) | ||
|
||
set -e | ||
echo "mode: atomic" > coverage.txt | ||
for pkg in ${PKGS[@]}; do | ||
go test -v -timeout 30m -race -coverprofile=profile.out -covermode=atomic -tags='ledger test_ledger_mock' "$pkg" | ||
if [ -f profile.out ]; then | ||
tail -n +2 profile.out >> coverage.txt; | ||
rm profile.out | ||
fi | ||
done |
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,44 @@ | ||
package esp | ||
|
||
import ( | ||
"github.com/DATA-DOG/godog" | ||
"github.com/DATA-DOG/godog/gherkin" | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
"github.com/cosmos/cosmos-sdk/store" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/regen-network/regen-ledger/util" | ||
abci "github.com/tendermint/tendermint/abci/types" | ||
dbm "github.com/tendermint/tendermint/libs/db" | ||
"github.com/tendermint/tendermint/libs/log" | ||
"testing" | ||
) | ||
|
||
var cdc *codec.Codec | ||
var ctx sdk.Context | ||
//var keeper Keeper | ||
|
||
func setupTestInput() { | ||
db := dbm.NewMemDB() | ||
|
||
cdc = codec.New() | ||
|
||
espKey := sdk.NewKVStoreKey("espKey") | ||
|
||
ms := store.NewCommitMultiStore(db) | ||
ms.MountStoreWithDB(espKey, sdk.StoreTypeIAVL, db) | ||
_ = ms.LoadLatestVersion() | ||
|
||
//keeper = NewKeeper(espKey, agentKeeper, geoKeeper, cdc) | ||
ctx = sdk.NewContext(ms, abci.Header{ChainID: "test-chain-id"}, false, log.NewNopLogger()) | ||
} | ||
|
||
func TestMain(m *testing.M) { | ||
util.GodogMain(m, "esp", FeatureContext) | ||
} | ||
|
||
func FeatureContext(s *godog.Suite) { | ||
s.BeforeFeature(func(*gherkin.Feature) { | ||
setupTestInput() | ||
}) | ||
} | ||
|