Skip to content

Commit cc25f59

Browse files
authored
ci: add compat check 052 x main (#21174)
1 parent 5b7d8b6 commit cc25f59

2 files changed

Lines changed: 132 additions & 0 deletions

File tree

.github/scripts/check-compat.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
if [ $# -lt 3 ]; then
4+
echo "Usage: check-compat.sh <branch> <simapp_version> [<go_mod_name1> <go_mod_name2> ...]"
5+
exit 1
6+
fi
7+
8+
dir="tmp"
9+
branch=$1
10+
simapp_version=$2
11+
shift 3
12+
go_mod_names=("$@")
13+
14+
# clone cosmos-sdk
15+
export FILTER_BRANCH_SQUELCH_WARNING=1
16+
git clone -b $branch --depth 1 https://github.com/cosmos/cosmos-sdk $dir
17+
18+
# save last commit branch commit
19+
COMMIT=$(git rev-parse HEAD)
20+
# save the last main commit
21+
latest_commit=$(git ls-remote https://github.com/cosmos/cosmos-sdk.git refs/heads/main | cut -f1 || "main")
22+
23+
# if simapp_version is v2 then use simapp/v2
24+
if [ $simapp_version == "v2" ]; then
25+
cd $dir/simapp/v2
26+
else
27+
cd $dir/simapp
28+
fi
29+
30+
# bump all cosmos-sdk packages to latest branch commit
31+
VERSIONS=$(go mod edit -json | jq -r '.Replace[].Old.Path')
32+
33+
# Initialize variables for different types of replaces
34+
BRANCH_REPLACES=""
35+
MAIN_REPLACES=""
36+
REQUIRES=""
37+
38+
for version in $VERSIONS; do
39+
if [[ " ${go_mod_names[@]} " =~ " ${version} " ]]; then
40+
MAIN_REPLACES+=" -replace $version=$version@$latest_commit"
41+
continue
42+
elif [[ $version == "github.com/cosmos/cosmos-sdk"* || $version == "cosmossdk.io/"* ]]; then
43+
BRANCH_REPLACES+=" -replace $version=$version@$COMMIT"
44+
fi
45+
done
46+
47+
for mod in ${go_mod_names[@]}; do
48+
REQUIRES+=" -require $mod@$latest_commit"
49+
done
50+
51+
# Apply the replaces
52+
go mod edit $BRANCH_REPLACES $MAIN_REPLACES $REQUIRES
53+
54+
go mod tidy
55+
56+
# Test SimApp
57+
go test -mod=readonly -v ./...
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: SimApp (v2) v0.52 Integration with Main
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
jobs:
8+
compat:
9+
name: Software Compat
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out source
13+
uses: actions/checkout@v4
14+
with:
15+
sparse-checkout: |
16+
.github/scripts/check-compat.sh
17+
sparse-checkout-cone-mode: false
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: "1.22"
22+
check-latest: true
23+
- name: Test v052 with latest main
24+
run: |
25+
.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
26+
env:
27+
BRANCH: release/v0.52.x
28+
SIMAPP_VERSION: v1
29+
- name: Test v052 v2 with latest main
30+
run: |
31+
.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
32+
env:
33+
BRANCH: release/v0.52.x
34+
SIMAPP_VERSION: v2
35+
sims-notify-success:
36+
needs: [compat]
37+
runs-on: ubuntu-latest
38+
if: ${{ success() }}
39+
steps:
40+
- uses: actions/checkout@v4
41+
- name: Get previous workflow status
42+
uses: ./.github/actions/last-workflow-status
43+
id: last_status
44+
with:
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Notify Slack on success
48+
if: ${{ steps.last_status.outputs.last_status == 'failure' }}
49+
uses: rtCamp/action-slack-notify@v2.3.0
50+
env:
51+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
52+
SLACK_CHANNEL: sdk-sims
53+
SLACK_USERNAME: release/v0.52.x x main compat
54+
SLACK_ICON_EMOJI: ":white_check_mark:"
55+
SLACK_COLOR: good
56+
SLACK_MESSAGE: Latest main x v0.52.x is compatible
57+
SLACK_FOOTER: ""
58+
59+
sims-notify-failure:
60+
permissions:
61+
contents: none
62+
needs: [compat]
63+
runs-on: ubuntu-latest
64+
if: ${{ failure() }}
65+
steps:
66+
- name: Notify Slack on failure
67+
uses: rtCamp/action-slack-notify@v2.3.0
68+
env:
69+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
70+
SLACK_CHANNEL: sdk-sims
71+
SLACK_USERNAME: release/v0.52.x x main compat
72+
SLACK_ICON_EMOJI: ":skull:"
73+
SLACK_COLOR: danger
74+
SLACK_MESSAGE: Latest main x v0.52.x is breaking
75+
SLACK_FOOTER: ""

0 commit comments

Comments
 (0)