Additional CI workflows #16

Merged
ashwin merged 5 commits from pm-add-workflows into main 2024-03-07 09:11:54 +00:00
5 changed files with 41 additions and 15 deletions
Showing only changes of commit 593a767a06 - Show all commits

27
.gitea/workflows/lint.yml Normal file
View File

@ -0,0 +1,27 @@
name: Lint
# Lint runs golangci-lint over the entire repository This workflow is
# run on every pull request and push to main The `golangci` will pass without
# running if no *.{go, mod, sum} files have been changed.
on:
pull_request:
push:
branches:
- main
jobs:
golangci:
name: Run golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# Required: setup-go, for all versions v3.0.0+ of golangci-lint
- uses: actions/setup-go@v3
with:
go-version: 1.21
check-latest: true
- uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v3.3.1
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
args: --timeout 10m
github-token: ${{ secrets.github_token }}

View File

@ -73,7 +73,7 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
/* Handle fee distribution state. */
// withdraw all validator commission
app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
_ = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator())
if err != nil {
panic(err)
@ -114,7 +114,7 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
ctx = ctx.WithBlockHeight(0)
// reinitialize all validators
app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
_ = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator())
if err != nil {
panic(err)
@ -171,20 +171,20 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
/* Handle staking state. */
// iterate through redelegations, reset creation height
app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) {
_ = app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) {
for i := range red.Entries {
red.Entries[i].CreationHeight = 0
}
app.StakingKeeper.SetRedelegation(ctx, red)
_ = app.StakingKeeper.SetRedelegation(ctx, red)
return false
})
// iterate through unbonding delegations, reset creation height
app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
_ = app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
for i := range ubd.Entries {
ubd.Entries[i].CreationHeight = 0
}
app.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
_ = app.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
return false
})
@ -208,7 +208,7 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
validator.Jailed = true
}
app.StakingKeeper.SetValidator(ctx, validator)
_ = app.StakingKeeper.SetValidator(ctx, validator)
counter++
}

View File

@ -6,6 +6,7 @@ import (
"strconv"
"github.com/cosmos/cosmos-sdk/client"
types "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
@ -216,7 +217,7 @@ func (q queryResolver) GetAccount(ctx context.Context, address string) (*Account
if err != nil {
return nil, err
}
var account authtypes.AccountI
var account types.AccountI
err = q.ctx.Codec.UnpackAny(accountResponse.GetAccount(), &account)
if err != nil {
return nil, err

View File

@ -130,19 +130,16 @@ func (ets *E2ETestSuite) createAuctionAndBid(createAuction, createBid bool) stri
return auctionId
}
func (ets *E2ETestSuite) cleanupBidFiles() error {
func (ets *E2ETestSuite) cleanupBidFiles() {
matches, err := filepath.Glob(fmt.Sprintf("%s-*.json", bidderAccount))
if err != nil {
ets.T().Errorf("Error matching bidder files: %v\n", err)
return err
}
for _, match := range matches {
err := os.Remove(match)
if err != nil {
return err
ets.T().Errorf("Error removing bidder file: %v\n", err)
}
}
return nil
}

View File

@ -25,10 +25,11 @@ type KeeperTestSuite struct {
}
func (kts *KeeperTestSuite) SetupTest() {
kts.TestFixture.Setup()
err := kts.TestFixture.Setup()
assert.Nil(kts.T(), err)
// set default params
err := kts.RegistryKeeper.Params.Set(kts.SdkCtx, types.DefaultParams())
err = kts.RegistryKeeper.Params.Set(kts.SdkCtx, types.DefaultParams())
assert.Nil(kts.T(), err)
qr := kts.App.QueryHelper()