diff --git a/.github/scripts/check-compat.sh b/.github/scripts/check-compat.sh new file mode 100755 index 000000000000..24b0efbad255 --- /dev/null +++ b/.github/scripts/check-compat.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +if [ $# -lt 3 ]; then + echo "Usage: check-compat.sh [ ...]" + 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 ./... \ No newline at end of file diff --git a/.github/workflows/software-compat-v052.yml b/.github/workflows/software-compat-v052.yml new file mode 100644 index 000000000000..ba6e7cd4b805 --- /dev/null +++ b/.github/workflows/software-compat-v052.yml @@ -0,0 +1,75 @@ +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.22" + 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.0 + 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.0 + 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: ""