-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Getting those runners going to update Cosmos for the three images, and also check for any build updates to automate #23165
Changes from all commits
8452d68
57d9b6e
22d8eab
1df449c
3e82d17
901a5ac
b3c5138
f960bf7
f3b15fe
388668e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,42 @@ | ||||||||||||||||||||||||||||||||||||||||
name: Go | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
on: | ||||||||||||||||||||||||||||||||||||||||
push: | ||||||||||||||||||||||||||||||||||||||||
branches: [ "main" ] | ||||||||||||||||||||||||||||||||||||||||
pull_request: | ||||||||||||||||||||||||||||||||||||||||
branches: [ "main" ] | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
jobs: | ||||||||||||||||||||||||||||||||||||||||
build-and-test: | ||||||||||||||||||||||||||||||||||||||||
strategy: | ||||||||||||||||||||||||||||||||||||||||
matrix: | ||||||||||||||||||||||||||||||||||||||||
os: [ubuntu-24.04, macos-latest, windows-latest] | ||||||||||||||||||||||||||||||||||||||||
runs-on: ${{ matrix.os }} | ||||||||||||||||||||||||||||||||||||||||
steps: | ||||||||||||||||||||||||||||||||||||||||
- uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
- name: Set up Go | ||||||||||||||||||||||||||||||||||||||||
uses: actions/setup-go@v5.2.0 | ||||||||||||||||||||||||||||||||||||||||
with: | ||||||||||||||||||||||||||||||||||||||||
go-version: '1.20' # You can specify a version range or use 'stable' if you want the latest stable version | ||||||||||||||||||||||||||||||||||||||||
cache: true | ||||||||||||||||||||||||||||||||||||||||
cache-dependency-path: go.sum | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
- name: Fetch Latest Cosmos SDK Version | ||||||||||||||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||||||||||||||
# Fetch the latest release tag from GitHub | ||||||||||||||||||||||||||||||||||||||||
LATEST_VERSION=$(curl -s "https://api.github.com/repos/cosmos/cosmos-sdk/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | ||||||||||||||||||||||||||||||||||||||||
echo "Latest Cosmos SDK version: $LATEST_VERSION" | ||||||||||||||||||||||||||||||||||||||||
echo "COSMOS_VERSION=$LATEST_VERSION" >> $GITHUB_ENV | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
Comment on lines
+26
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling for curl command and improve version extraction The current implementation lacks error handling for the curl command and uses complex sed parsing which might break. Consider using jq for more reliable JSON parsing. - LATEST_VERSION=$(curl -s "https://api.github.com/repos/cosmos/cosmos-sdk/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
- echo "Latest Cosmos SDK version: $LATEST_VERSION"
- echo "COSMOS_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
+ if ! RESPONSE=$(curl -sf "https://api.github.com/repos/cosmos/cosmos-sdk/releases/latest"); then
+ echo "Failed to fetch latest Cosmos SDK version"
+ exit 1
+ fi
+ LATEST_VERSION=$(echo "$RESPONSE" | jq -r .tag_name)
+ if [[ -n "$LATEST_VERSION" ]]; then
+ echo "Latest Cosmos SDK version: $LATEST_VERSION"
+ echo "COSMOS_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
+ else
+ echo "Failed to extract version from response"
+ exit 1
+ fi 📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.4)26-26: shellcheck reported issue in this script: SC2086:info:4:42: Double quote to prevent globbing and word splitting (shellcheck) |
||||||||||||||||||||||||||||||||||||||||
- name: Update Go Modules | ||||||||||||||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||||||||||||||
# Update go.mod with the latest Cosmos SDK version | ||||||||||||||||||||||||||||||||||||||||
go get github.com/cosmos/cosmos-sdk@${{ env.COSMOS_VERSION }} | ||||||||||||||||||||||||||||||||||||||||
go mod tidy | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
Comment on lines
+34
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling for go get command The module update steps lack error handling which could lead to silent failures. - go get github.com/cosmos/cosmos-sdk@${{ env.COSMOS_VERSION }}
- go mod tidy
+ if ! go get github.com/cosmos/cosmos-sdk@${{ env.COSMOS_VERSION }}; then
+ echo "Failed to update Cosmos SDK"
+ exit 1
+ fi
+ if ! go mod tidy; then
+ echo "Failed to tidy modules"
+ exit 1
+ fi 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
- name: Build | ||||||||||||||||||||||||||||||||||||||||
run: go build -v ./... | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
- name: Test | ||||||||||||||||||||||||||||||||||||||||
run: go test -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.
Update Go version to latest stable
Given the current date (January 2025), Go 1.20 is outdated. Consider using a more recent version for security updates and performance improvements.
📝 Committable suggestion