Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
auricom committed Sep 23, 2024
1 parent 405bf02 commit 6c3db24
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 20 deletions.
28 changes: 16 additions & 12 deletions .github/scripts/update-go-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ get_and_update_module() {

go mod edit -replace=$module=$module@$pseudo_version

if ! go mod download $module@$pseudo_version; then
echo "Download failed. Trying with a different commit."
return 1
fi
# if ! go mod download $module@$pseudo_version; then
# return 1
# fi

return 0
}
Expand All @@ -50,25 +49,30 @@ echo "cosmos/cosmos-sdk main latest_commit: $latest_commit_main"
latest_commit_branch=$(get_latest_commit "cosmos/cosmos-sdk" "$COSMOSSDK_BRANCH")
echo "cosmos/cosmos-sdk $COSMOSSDK_BRANCH latest_commit: $latest_commit_branch"

# Version override logic
# Parse every module in go.mod, and update dependencies according to logic
for module in $modules; do

echo "module: $module"

# Checking cosmos-sdk modules
if [[ $module =~ "cosmossdk.io" ]]; then
if ! get_and_update_module "$latest_commit_branch"; then
# If it fails, get the from main
# Force specific modules to HEAD of main instead of release
if [[ $module =~ "depinject" ]] || [[ $module =~ "log" ]] || [[ $module =~ "math" ]]; then
if ! get_and_update_module "$latest_commit_main"; then
echo "Failed to update module after trying $COSMOSSDK_BRANCH and main."
echo "Failed to update module $module after trying main."
exit 1
fi
else
if ! get_and_update_module "$latest_commit_branch"; then
echo "Failed to update module $module after trying $COSMOSSDK_BRANCH."
fi
fi
elif [[ $module == "github.com/cosmos/cosmos-sdk" ]]; then
# modules that need to follow HEAD on release branch
pseudo_version=$(get_pseudo_version "github.com/cosmos/cosmos-sdk" $latest_commit_branch)
echo "Updating $module to pseudo-version $pseudo_version"
go mod edit -replace=$module=$module@$pseudo_version
go mod download $module@$pseudo_version
if ! get_and_update_module "$latest_commit_branch"; then
echo "Failed to update module $module after trying $COSMOSSDK_BRANCH."
exit 1
fi
fi
done

Expand Down
61 changes: 53 additions & 8 deletions .github/workflows/nightly-3-release-ibc-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,25 @@ on:
schedule:
- cron: 0 0 * * * # Every day at 0:00 UTC
workflow_dispatch:
pull_request:


permissions:
packages: write
contents: write

env:
RELEASE_NAME: IBC-go@main + cosmos-sdk modules@HEAD
COSMOSSDK_BRANCH: refs/heads/release/v0.50.x

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
build-wfl3:

update-dependencies:
runs-on: ubuntu-latest
outputs:
date: ${{ steps.archive.outputs.date }}
strategy:
matrix:
go-arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -51,11 +50,57 @@ jobs:
cd ibc-go/simapp
../../nightly-stack/.github/scripts/update-go-dependencies.sh
- name: DEBUG update-go-dependencies.sh
- name: show output of modified go.sum and go.mod
run: |
echo "############"
echo "# go.mod"
echo "############"
cat ibc-go/simapp/go.mod
echo -e "\n\n"
echo "############"
echo "# go.mod"
echo "############"
cat ibc-go/simapp/go.sum
- name: Upload go.mod and go.sum
uses: actions/upload-artifact@v4
with:
name: go-files
path: |
ibc-go/simapp/go.mod
ibc-go/simapp/go.sum
build-ibc:
runs-on: ubuntu-latest
needs: update-dependencies
outputs:
date: ${{ steps.archive.outputs.date }}
strategy:
matrix:
go-arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
with:
repository: cosmos/ibc-go
ref: main
token: ${{ github.token }}
path: ibc-go

- uses: actions/checkout@v4
with:
path: nightly-stack

- uses: actions/setup-go@v5
with:
go-version: "1.23"
check-latest: true

- name: Download go.mod and go.sum
uses: actions/download-artifact@v4
with:
name: go-files
path: ibc-go/simapp

- name: Create application binary
id: build
run: |
Expand Down Expand Up @@ -216,7 +261,7 @@ jobs:
merge:
name: Merge cosmos-sdk
runs-on: ubuntu-latest
needs: [build-wfl3]
needs: [build-ibc]
if: ${{ always() }}
steps:
- name: Set variables
Expand Down

0 comments on commit 6c3db24

Please sign in to comment.