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

ci: add compat check 052 x main #21174

Merged
merged 4 commits into from
Aug 7, 2024
Merged

ci: add compat check 052 x main #21174

merged 4 commits into from
Aug 7, 2024

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Aug 5, 2024

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...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

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...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • New Features

    • Introduced a compatibility checking script to automate module dependency updates for the Cosmos SDK.
    • Added a GitHub Actions workflow for testing the compatibility of the SimApp version 0.52 with the latest main branch, including notifications for success and failure.
  • Enhancements

    • Streamlined the development workflow for users by integrating automated compatibility checks and notifications.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

Walkthrough

Walkthrough

The 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

Files Change Summary
.github/scripts/check-compat.sh New script for compatibility checks of Go modules against a specified branch of Cosmos SDK.
.github/workflows/software-compat-v052.yml New GitHub Actions workflow for testing compatibility of SimApp version 0.52 with the latest main branch.

Assessment against linked issues

Objective Addressed Explanation
Add job to sync release branches with latest main for integration (#21144)
Automate compatibility testing for specified components from the release branch (#21144)
Notify Slack on failure of compatibility tests (#21144)

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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@julienrbrt julienrbrt force-pushed the julien/ci-integration branch from d9c6a00 to e1faf3e Compare August 6, 2024 19:41
@julienrbrt julienrbrt marked this pull request as ready for review August 6, 2024 20:43
@julienrbrt julienrbrt requested a review from a team as a code owner August 6, 2024 20:43
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits

Files that changed from the base of the PR and between 111a999 and 8cfb340.

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.

.github/scripts/check-compat.sh Show resolved Hide resolved
Comment on lines +51 to +54
# Apply the replaces
go mod edit $BRANCH_REPLACES $MAIN_REPLACES $REQUIRES

go mod tidy
Copy link
Contributor

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.

Suggested change
# 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; }

Comment on lines +56 to +57
# Test SimApp
go test -mod=readonly -v ./...
Copy link
Contributor

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.

Suggested change
# Test SimApp
go test -mod=readonly -v ./...
# Test SimApp
go test -mod=readonly -v ./... -timeout 10m

Comment on lines +18 to +28
# 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
Copy link
Contributor

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.

Suggested change
# 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

Comment on lines +24 to +34
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
Copy link
Contributor

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.

Suggested change
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

Comment on lines +1 to +10
name: SimApp (v2) v0.52 Integration with Main
on:
push:
branches:
- main
workflow_dispatch:
jobs:
compat:
name: Software Compat
runs-on: ubuntu-latest
Copy link
Contributor

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.

Suggested change
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

Copy link
Contributor

@testinginprod testinginprod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@julienrbrt julienrbrt added this pull request to the merge queue Aug 7, 2024
Merged via the queue into main with commit cc25f59 Aug 7, 2024
70 checks passed
@julienrbrt julienrbrt deleted the julien/ci-integration branch August 7, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI: Add job to sync release branches with latest main for integration
4 participants