From dd69c0ce8b7af0f0dc2380a44f5d6608761376fc Mon Sep 17 00:00:00 2001 From: auricom <27022259+auricom@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:55:59 +0200 Subject: [PATCH] enable cosmos-sdk v0.52.x update mods --- .github/scripts/update-go-modules.sh | 76 +++++++++++++++++++++------- apps/cosmos-sdk/metadata.yaml | 8 +++ 2 files changed, 67 insertions(+), 17 deletions(-) diff --git a/.github/scripts/update-go-modules.sh b/.github/scripts/update-go-modules.sh index c24b57d..bafaefd 100755 --- a/.github/scripts/update-go-modules.sh +++ b/.github/scripts/update-go-modules.sh @@ -33,7 +33,7 @@ get_pseudo_version() { fi } -get_and_update_module() { +replace_module() { local commit=$1 pseudo_version=$(get_pseudo_version "$module" "$commit") @@ -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" ' @@ -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 @@ -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 diff --git a/apps/cosmos-sdk/metadata.yaml b/apps/cosmos-sdk/metadata.yaml index 080addb..99a1f26 100644 --- a/apps/cosmos-sdk/metadata.yaml +++ b/apps/cosmos-sdk/metadata.yaml @@ -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