refactor: limit breaking changes for next version (#22972)
This commit is contained in:
parent
751679fc2e
commit
ca559989da
57
.github/scripts/check-compat.sh
vendored
57
.github/scripts/check-compat.sh
vendored
@ -1,57 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 3 ]; then
|
||||
echo "Usage: check-compat.sh <branch> <simapp_version> [<go_mod_name1> <go_mod_name2> ...]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dir="tmp"
|
||||
branch=$1
|
||||
simapp_version=$2
|
||||
shift 3
|
||||
go_mod_names=("$@")
|
||||
|
||||
# clone cosmos-sdk
|
||||
export FILTER_BRANCH_SQUELCH_WARNING=1
|
||||
git clone -b $branch --depth 1 https://github.com/cosmos/cosmos-sdk $dir
|
||||
|
||||
# save last commit branch commit
|
||||
COMMIT=$(git rev-parse HEAD)
|
||||
# save the last main commit
|
||||
latest_commit=$(git ls-remote https://github.com/cosmos/cosmos-sdk.git refs/heads/main | cut -f1 || "main")
|
||||
|
||||
# if simapp_version is v2 then use simapp/v2
|
||||
if [ $simapp_version == "v2" ]; then
|
||||
cd $dir/simapp/v2
|
||||
else
|
||||
cd $dir/simapp
|
||||
fi
|
||||
|
||||
# bump all cosmos-sdk packages to latest branch commit
|
||||
VERSIONS=$(go mod edit -json | jq -r '.Replace[].Old.Path')
|
||||
|
||||
# Initialize variables for different types of replaces
|
||||
BRANCH_REPLACES=""
|
||||
MAIN_REPLACES=""
|
||||
REQUIRES=""
|
||||
|
||||
for version in $VERSIONS; do
|
||||
if [[ " ${go_mod_names[@]} " =~ " ${version} " ]]; then
|
||||
MAIN_REPLACES+=" -replace $version=$version@$latest_commit"
|
||||
continue
|
||||
elif [[ $version == "github.com/cosmos/cosmos-sdk"* || $version == "cosmossdk.io/"* ]]; then
|
||||
BRANCH_REPLACES+=" -replace $version=$version@$COMMIT"
|
||||
fi
|
||||
done
|
||||
|
||||
for mod in ${go_mod_names[@]}; do
|
||||
REQUIRES+=" -require $mod@$latest_commit"
|
||||
done
|
||||
|
||||
# Apply the replaces
|
||||
go mod edit $BRANCH_REPLACES $MAIN_REPLACES $REQUIRES
|
||||
|
||||
go mod tidy
|
||||
|
||||
# Test SimApp
|
||||
go test -mod=readonly -v ./...
|
||||
75
.github/workflows/software-compat-v052.yml
vendored
75
.github/workflows/software-compat-v052.yml
vendored
@ -1,75 +0,0 @@
|
||||
name: SimApp (v2) v0.52 Integration with Main
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
compat:
|
||||
name: Software Compat
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.github/scripts/check-compat.sh
|
||||
sparse-checkout-cone-mode: false
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.23"
|
||||
check-latest: true
|
||||
- name: Test v052 with latest main
|
||||
run: |
|
||||
.github/scripts/check-compat.sh $BRANCH $SIMAPP_VERSION cosmossdk.io/runtime/v2 cosmossdk.io/server/v2 cosmossdk.io/store/v2 cosmossdk.io/server/v2/stf cosmossdk.io/server/v2/appmanager cosmossdk.io/api cosmossdk.io/store cosmossdk.io/core cosmossdk.io/core/testing
|
||||
env:
|
||||
BRANCH: release/v0.52.x
|
||||
SIMAPP_VERSION: v1
|
||||
- name: Test v052 v2 with latest main
|
||||
run: |
|
||||
.github/scripts/check-compat.sh $BRANCH $SIMAPP_VERSION cosmossdk.io/runtime/v2 cosmossdk.io/server/v2 cosmossdk.io/store/v2 cosmossdk.io/server/v2/stf cosmossdk.io/server/v2/appmanager cosmossdk.io/api cosmossdk.io/store cosmossdk.io/core cosmossdk.io/core/testing
|
||||
env:
|
||||
BRANCH: release/v0.52.x
|
||||
SIMAPP_VERSION: v2
|
||||
sims-notify-success:
|
||||
needs: [compat]
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ success() }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Get previous workflow status
|
||||
uses: ./.github/actions/last-workflow-status
|
||||
id: last_status
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Notify Slack on success
|
||||
if: ${{ steps.last_status.outputs.last_status == 'failure' }}
|
||||
uses: rtCamp/action-slack-notify@v2.3.2
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
SLACK_CHANNEL: sdk-sims
|
||||
SLACK_USERNAME: release/v0.52.x x main compat
|
||||
SLACK_ICON_EMOJI: ":white_check_mark:"
|
||||
SLACK_COLOR: good
|
||||
SLACK_MESSAGE: Latest main x v0.52.x is compatible
|
||||
SLACK_FOOTER: ""
|
||||
|
||||
sims-notify-failure:
|
||||
permissions:
|
||||
contents: none
|
||||
needs: [compat]
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ failure() }}
|
||||
steps:
|
||||
- name: Notify Slack on failure
|
||||
uses: rtCamp/action-slack-notify@v2.3.2
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
SLACK_CHANNEL: sdk-sims
|
||||
SLACK_USERNAME: release/v0.52.x x main compat
|
||||
SLACK_ICON_EMOJI: ":skull:"
|
||||
SLACK_COLOR: danger
|
||||
SLACK_MESSAGE: Latest main x v0.52.x is breaking
|
||||
SLACK_FOOTER: ""
|
||||
@ -15,7 +15,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/integration"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/x/counter"
|
||||
counterkeeper "github.com/cosmos/cosmos-sdk/testutil/x/counter/keeper"
|
||||
@ -38,7 +37,7 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
||||
|
||||
logger := log.NewNopLogger()
|
||||
keys := storetypes.NewKVStoreKeys(countertypes.StoreKey)
|
||||
cms := integration.CreateMultiStore(keys, logger)
|
||||
cms := moduletestutil.CreateMultiStore(keys, logger)
|
||||
s.ctx = sdk.NewContext(cms, true, logger)
|
||||
cfg := moduletestutil.MakeTestEncodingConfig(testutil.CodecOptions{}, counter.AppModule{})
|
||||
s.cdc = cfg.Codec
|
||||
|
||||
@ -26,7 +26,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/testutil/integration"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
@ -75,7 +74,7 @@ func TestFundsMigration(t *testing.T) {
|
||||
authtypes.StoreKey, banktypes.StoreKey, disttypes.StoreKey,
|
||||
)
|
||||
logger := log.NewTestLogger(t)
|
||||
cms := integration.CreateMultiStore(keys, logger)
|
||||
cms := moduletestutil.CreateMultiStore(keys, logger)
|
||||
encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, auth.AppModule{}, bank.AppModule{}, distribution.AppModule{})
|
||||
ctx := sdk.NewContext(cms, true, logger)
|
||||
addressCodec := addresscodec.NewBech32Codec(sdk.Bech32MainPrefix)
|
||||
|
||||
@ -1,22 +1,9 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
coretesting "cosmossdk.io/core/testing"
|
||||
"cosmossdk.io/log"
|
||||
"cosmossdk.io/store"
|
||||
"cosmossdk.io/store/metrics"
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
)
|
||||
|
||||
// CreateMultiStore is a helper for setting up multiple stores for provided modules.
|
||||
func CreateMultiStore(keys map[string]*storetypes.KVStoreKey, logger log.Logger) storetypes.CommitMultiStore {
|
||||
db := coretesting.NewMemDB()
|
||||
cms := store.NewCommitMultiStore(db, logger, metrics.NewNoOpMetrics())
|
||||
|
||||
for key := range keys {
|
||||
cms.MountStoreWithDB(keys[key], storetypes.StoreTypeIAVL, db)
|
||||
}
|
||||
|
||||
_ = cms.LoadLatestVersion()
|
||||
return cms
|
||||
}
|
||||
// Deprecated: use github.com/cosmos/cosmos-sdk/types/module/testutil.CreateMultiStore instead.
|
||||
var CreateMultiStore = moduletestutil.CreateMultiStore
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
package testutil
|
||||
|
||||
import (
|
||||
coretesting "cosmossdk.io/core/testing"
|
||||
"cosmossdk.io/log"
|
||||
"cosmossdk.io/store"
|
||||
"cosmossdk.io/store/metrics"
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/testutil"
|
||||
@ -78,3 +84,16 @@ type TestTxBuilder struct {
|
||||
func (b *TestTxBuilder) SetExtensionOptions(extOpts ...*types.Any) {
|
||||
b.ExtOptions = extOpts
|
||||
}
|
||||
|
||||
// CreateMultiStore is a helper for setting up multiple stores for provided modules.
|
||||
func CreateMultiStore(keys map[string]*storetypes.KVStoreKey, logger log.Logger) storetypes.CommitMultiStore {
|
||||
db := coretesting.NewMemDB()
|
||||
cms := store.NewCommitMultiStore(db, logger, metrics.NewNoOpMetrics())
|
||||
|
||||
for key := range keys {
|
||||
cms.MountStoreWithDB(keys[key], storetypes.StoreTypeIAVL, db)
|
||||
}
|
||||
|
||||
_ = cms.LoadLatestVersion()
|
||||
return cms
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user