-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
ci: add compat check 052 x main #21174
Conversation
WalkthroughWalkthroughThe recent changes introduce a compatibility check script and a GitHub Actions workflow to streamline the integration of the SimApp version 0.52 with the latest main branch of the Cosmos SDK. The script automates the process of updating Go module dependencies and validating their compatibility, while the workflow manages the execution of these checks and notifies stakeholders of the results, enhancing the continuous integration process. Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
d9c6a00
to
e1faf3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Outside diff range, codebase verification and nitpick comments (3)
.github/scripts/check-compat.sh (2)
1-6
: Ensure consistent indentation.The script uses both tabs and spaces for indentation. It's best to stick to one for consistency.
- echo "Usage: check-compat.sh <branch> <simapp_version> [<go_mod_name1> <go_mod_name2> ...]" - exit 1 + echo "Usage: check-compat.sh <branch> <simapp_version> [<go_mod_name1> <go_mod_name2> ...]" + exit 1
30-45
: Improve readability of the loop conditions.Use more descriptive variable names and improve readability of the conditions.
- 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 + for mod_version in $VERSIONS; do + if [[ " ${go_mod_names[@]} " =~ " ${mod_version} " ]]; then + MAIN_REPLACES+=" -replace $mod_version=$mod_version@$latest_commit" + continue + elif [[ $mod_version == "github.com/cosmos/cosmos-sdk"* || $mod_version == "cosmossdk.io/"* ]]; then + BRANCH_REPLACES+=" -replace $mod_version=$mod_version@$COMMIT" + fi.github/workflows/software-compat-v052.yml (1)
12-23
: Ensure correct Go version setup.The specified Go version "1.22" does not appear to be available. Please verify if this is the intended version or if an alternative version should be used.
- File:
.github/workflows/software-compat-v052.yml
- Lines: 12-23
Analysis chain
Ensure correct Go version setup.
Double-check if Go version 1.22 is intended, as it might be a future or incorrect version.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correct Go version setup. # Test: Check the available Go versions. Expect: Go 1.22 should be available. gh api -H "Accept: application/vnd.github.v3+json" /repos/actions/setup-go/releases | jq '.[].tag_name'Length of output: 376
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (2)
- .github/scripts/check-compat.sh (1 hunks)
- .github/workflows/software-compat-v052.yml (1 hunks)
Additional comments not posted (2)
.github/workflows/software-compat-v052.yml (2)
59-75
: Ensure Slack notification security.Ensure that the
SLACK_WEBHOOK
secret is correctly set and not exposed.
35-58
: Ensure Slack notification security.Ensure that the
SLACK_WEBHOOK
secret is correctly set and not exposed.
# Apply the replaces | ||
go mod edit $BRANCH_REPLACES $MAIN_REPLACES $REQUIRES | ||
|
||
go mod tidy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check for errors during go mod edit
and go mod tidy
.
It's good practice to check for errors after running these commands.
- go mod edit $BRANCH_REPLACES $MAIN_REPLACES $REQUIRES
- go mod tidy
+ go mod edit $BRANCH_REPLACES $MAIN_REPLACES $REQUIRES || { echo "go mod edit failed"; exit 1; }
+ go mod tidy || { echo "go mod tidy failed"; exit 1; }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
# Apply the replaces | |
go mod edit $BRANCH_REPLACES $MAIN_REPLACES $REQUIRES | |
go mod tidy | |
# Apply the replaces | |
go mod edit $BRANCH_REPLACES $MAIN_REPLACES $REQUIRES || { echo "go mod edit failed"; exit 1; } | |
go mod tidy || { echo "go mod tidy failed"; exit 1; } |
# Test SimApp | ||
go test -mod=readonly -v ./... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a timeout to the go test
command.
To prevent tests from running indefinitely, consider adding a timeout.
- go test -mod=readonly -v ./...
+ go test -mod=readonly -v ./... -timeout 10m
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
# Test SimApp | |
go test -mod=readonly -v ./... | |
# Test SimApp | |
go test -mod=readonly -v ./... -timeout 10m |
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle potential errors in commit retrieval.
If the git ls-remote
command fails, it should handle the error gracefully.
- latest_commit=$(git ls-remote https://github.com/cosmos/cosmos-sdk.git refs/heads/main | cut -f1 || "main")
+ latest_commit=$(git ls-remote https://github.com/cosmos/cosmos-sdk.git refs/heads/main | cut -f1)
+ if [ -z "$latest_commit" ]; then
+ latest_commit="main"
+ fi
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
# 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 | |
# 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) | |
if [ -z "$latest_commit" ]; then | |
latest_commit="main" | |
fi | |
# if simapp_version is v2 then use simapp/v2 | |
if [ $simapp_version == "v2" ]; then | |
cd $dir/simapp/v2 | |
else | |
cd $dir/simapp | |
fi |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid redundancy in compatibility check steps.
The steps for testing v0.52 with the latest main and v0.52 v2 with the latest main are almost identical. Consider combining them to avoid redundancy.
- - 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
+ - name: Test v052 with latest main
+ run: |
+ for version in v1 v2; do
+ .github/scripts/check-compat.sh $BRANCH $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
+ done
+ env:
+ BRANCH: release/v0.52.x
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
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 | |
- name: Test v052 with latest main | |
run: | | |
for version in v1 v2; do | |
.github/scripts/check-compat.sh $BRANCH $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 | |
done | |
env: | |
BRANCH: release/v0.52.x |
name: SimApp (v2) v0.52 Integration with Main | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
jobs: | ||
compat: | ||
name: Software Compat | ||
runs-on: ubuntu-latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a schedule trigger.
To ensure regular compatibility checks, consider adding a schedule trigger.
push:
branches:
- main
workflow_dispatch:
+ schedule:
+ - cron: '0 0 * * 0' # Runs every Sunday at midnight
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
name: SimApp (v2) v0.52 Integration with Main | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
compat: | |
name: Software Compat | |
runs-on: ubuntu-latest | |
name: SimApp (v2) v0.52 Integration with Main | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' # Runs every Sunday at midnight | |
jobs: | |
compat: | |
name: Software Compat | |
runs-on: ubuntu-latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Description
Closes: #21144
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit
New Features
Enhancements