Skip to content

Commit

Permalink
enable cosmos-sdk v0.52.x update mods
Browse files Browse the repository at this point in the history
  • Loading branch information
auricom committed Sep 26, 2024
1 parent a0d40b0 commit dd69c0c
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 17 deletions.
76 changes: 59 additions & 17 deletions .github/scripts/update-go-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ get_pseudo_version() {
fi
}

get_and_update_module() {
replace_module() {
local commit=$1
pseudo_version=$(get_pseudo_version "$module" "$commit")

Expand All @@ -49,6 +49,16 @@ get_and_update_module() {
return 0
}

get_module() {
local commit=$1

echo "Get $module to commit $commit"

go get $module@$commit

return 0
}

# Function to check if current module is replaced by a local path
check_replaced_local() {
go mod edit --json | jq -e --arg v "$module" '
Expand Down Expand Up @@ -98,28 +108,60 @@ for module in $modules; do
# Checking cosmos-sdk modules
case "$module" in
*cosmossdk.io*)
case "$module" in
# Force checking specific modules to HEAD of main instead of release
*core/testing*|*depinject*|*log*|*math*|*schema*)
if ! get_and_update_module "$cosmossdk_latest_commit_main"; then

if [[ "$COSMOSSDK_BRANCH" =~ "v0.50.x" ]]; then
case "$module" in
# Force checking specific modules to HEAD of main instead of release
*core/testing*|*depinject*|*log*|*math*|*schema*)
if ! replace_module "$cosmossdk_latest_commit_main"; then
echo "Failed to update module $module after trying main."
exit 1
fi
;;
*errors*|*api*|*core*)
echo "ignore $module"
;;
*)
if ! replace_module "$cosmossdk_latest_commit_branch"; then
echo "Failed to update module $module after trying $COSMOSSDK_BRANCH."
fi
;;
esac
elif [[ "$COSMOSSDK_BRANCH" =~ "v0.52.x" ]]; then
case "$module" in
# Force checking specific modules to HEAD of refs/heads/release/v0.52.x instead of main
*client/v2*|*x/*)
# Exception for x/tx
if [[ "$module" =~ "x/tx" ]]; then
if ! replace_module "$cosmossdk_latest_commit_main"; then
echo "Failed to update module $module after trying main."
exit 1
fi
elif ! replace_module "$cometbft_latest_commit_branch"; then
echo "Failed to update module $module after trying main."
exit 1
fi
;;
*errors*|*api*|*core*)
echo "ignore $module"
;;
*)
if ! get_and_update_module "$cosmossdk_latest_commit_branch"; then
echo "Failed to update module $module after trying $COSMOSSDK_BRANCH."
if ! replace_module "$cosmossdk_latest_commit_branch"; then
echo "Failed to update module $module after trying $COSMOSSDK_BRANCH."
fi
fi
;;
esac
;;
*errors*)
echo "ignore $module"
;;
*)
if ! replace_module "$cosmossdk_latest_commit_main"; then
echo "Faiif ! replace_module "$cometbft_latest_commit_branch"; then
echo "Failed to update module $module after trying main."
exit 1led to update module $module after trying main."
fi
;;
esac
fi
;;
*github.com/cosmos/cosmos-sdk*)

# modules that need to follow HEAD on release branch
if ! get_and_update_module "$cosmossdk_latest_commit_branch"; then
if ! replace_module "$cosmossdk_latest_commit_branch"; then
echo "Failed to update module $module after trying $COSMOSSDK_BRANCH."
exit 1
fi
Expand All @@ -129,7 +171,7 @@ for module in $modules; do
if [[ "$COSMOSSDK_BRANCH" == "main" ]]; then
# Exclude cometbft/cometbft-db from logic
if [[ ! "$module" =~ "cometbft-db" ]]; then
if ! get_and_update_module "$cometbft_latest_commit_branch"; then
if ! get_module "$cometbft_latest_commit_branch"; then
echo "Failed to update module $module after trying main."
exit 1
fi
Expand Down
8 changes: 8 additions & 0 deletions apps/cosmos-sdk/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ channels:
enabled: false
cosmossdk_branch: refs/heads/release/v0.52.x
tests_enabled: true
- name: v0.52.x-mods
branch: refs/heads/release/v0.52.x
platforms: ["linux/amd64","linux/arm64"]
container_tag_name: "0.52"
update_modules:
enabled: true
cosmossdk_branch: refs/heads/release/v0.52.x
tests_enabled: true

0 comments on commit dd69c0c

Please sign in to comment.