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

feat(test): automate testing of network upgrades #1821

Merged
merged 1 commit into from
May 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
4 changes: 3 additions & 1 deletion .github/workflows/release-dry-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ defaults:
shell: bash

on:
pull_request:
push:
branches:
- master
- mainnet/main
pull_request:
tags:
- v*

jobs:
dry-run:
Expand Down
41 changes: 37 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,44 @@ on:
- v*

jobs:
ensure-dry-run:
runs-on: ubuntu-latest
steps:
- name: Ensure release/dry-run PASS
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: 'dry-run'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
allowed-conclusions: success
ensure-tests:
runs-on: ubuntu-latest
steps:
- name: Ensure tests PASS
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: 'tests'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
allowed-conclusions: success
ensure-tools:
runs-on: ubuntu-latest
steps:
- name: Ensure tools PASS
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: 'tools'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
allowed-conclusions: success
publish:
runs-on: ubuntu-latest
needs:
- ensure-dry-run
- ensure-tests
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
Expand All @@ -27,10 +63,7 @@ jobs:
uses: docker/setup-buildx-action@v2
- name: release version
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- if: (github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/mainnet/main')
name: release dry-run GORELEASER_SKIP_VALIDATE=true
run: make release-dry-run GORELEASER_SKIP_VALIDATE=true
- name: release dry-run
- name: release
run: make release
- name: Login to GHCR
uses: docker/login-action@v2
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/upgrades-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: upgrades
defaults:
run:
shell: bash

on:
push:
tags:
- v*
jobs:
ensure-release:
runs-on: ubuntu-latest
steps:
- name: Ensure release PASS
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: 'release'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
allowed-conclusions: success
test:
runs-on: upgrade-tester
needs:
- ensure-release
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GOLANG_VERSION }}"
- name: configure variables
run: |
test_required=$(./script/upgrades.sh test-required ${{ github.ref }})
echo "TEST_REQUIRED=$test_required" >> $GITHUB_ENV
echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: run test
if: env.TEST_REQUIRED == 'true'
run: |
cd tests/upgrade
UPGRADE_BINARY_VERSION=${{ env.RELEASE_TAG }} make test
45 changes: 45 additions & 0 deletions .github/workflows/upgrades.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: tests
defaults:
run:
shell: bash

on:
pull_request:
push:
branches:
- master
- mainnet/main

jobs:
upgrade:
runs-on: upgrade-tester
steps:
- uses: actions/checkout@v3
- run: git fetch --prune --unshallow
- name: set environment
uses: HatsuneMiku3939/direnv-action@v1
- uses: actions/setup-go@v3
with:
go-version: "${{ env.GOLANG_VERSION }}"
- name: configure variables
run: |
test_required=$(./script/upgrades.sh test-required ${{ github.ref }})
echo "TEST_REQUIRED=$test_required" >> $GITHUB_ENV
- name: run test
id: test
if: env.TEST_REQUIRED == 'true'
run: |
cd tests/upgrade
make test
- name: upload stderr
if: always() && steps.test.outcome != 'skipped'
uses: actions/upload-artifact@v3
with:
name: stderr.log
path: .cache/run/upgrade/stderr.log
- name: upload stdout
if: always() && steps.test.outcome != 'skipped'
uses: actions/upload-artifact@v3
with:
name: stdout.log
path: .cache/run/upgrade/stdout.log
3 changes: 2 additions & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"log"
"math/rand"

"github.com/spf13/viper"

abci "github.com/tendermint/tendermint/abci/types"
logger "github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
Expand All @@ -17,7 +19,6 @@ import (
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/spf13/viper"
)

// ExportAppStateAndValidators exports the state of the application for a genesis
Expand Down
4 changes: 1 addition & 3 deletions cmd/akash/cmd/testnetify/accounts.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package testnetify

import (
"fmt"

"github.com/theckman/yacspin"

"github.com/cosmos/cosmos-sdk/codec"
Expand All @@ -19,7 +17,7 @@ func (ga *GenesisState) modifyAccounts(sp *yacspin.Spinner, cdc codec.Codec, cfg
}
}

sp.Message(fmt.Sprintf("added new accounts"))
sp.Message("added new accounts")

return nil
}
3 changes: 1 addition & 2 deletions cmd/akash/cmd/testnetify/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,7 @@ func (ga *GenesisState) AddNewAccount(cdc codec.Codec, addr sdk.AccAddress, pubk
return fmt.Errorf("account (%s) already exists", addr.String()) // nolint: goerr113
}

var genAccount authtypes.GenesisAccount
genAccount = authtypes.NewBaseAccount(addr, pubkey, ga.app.AuthState.nextAccountNumber(), 0)
genAccount := authtypes.NewBaseAccount(addr, pubkey, ga.app.AuthState.nextAccountNumber(), 0)

if err := genAccount.Validate(); err != nil {
return fmt.Errorf("failed to validate new genesis account: %s", err.Error()) // nolint: goerr113
Expand Down
19 changes: 13 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ require (
github.com/cosmos/cosmos-sdk v0.45.15
github.com/cosmos/ibc-go/v3 v3.4.0
github.com/gogo/protobuf v1.3.3
github.com/google/go-github/v52 v52.0.0
github.com/gorilla/mux v1.8.0
github.com/gorilla/websocket v1.5.0
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.14.0
Expand All @@ -26,7 +28,8 @@ require (
github.com/tendermint/tm-db v0.6.7
github.com/theckman/yacspin v0.13.12
go.step.sm/crypto v0.26.0
golang.org/x/mod v0.7.0
golang.org/x/mod v0.8.0
golang.org/x/oauth2 v0.7.0
golang.org/x/sync v0.1.0
google.golang.org/grpc v1.53.0
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -67,13 +70,15 @@ require (
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
github.com/DataDog/zstd v1.5.0 // indirect
github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/Workiva/go-datastructures v1.0.53 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cloudflare/circl v1.3.1 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20220817183557-09c6e030a677 // indirect
Expand Down Expand Up @@ -113,6 +118,7 @@ require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
Expand Down Expand Up @@ -168,12 +174,13 @@ require (
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/exp v0.0.0-20221019170559-20944726eadf // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/term v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230209215440-0dfe4f8abfcc // indirect
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand Down
Loading