Skip to content

Commit 913a26b

Browse files
demosdemonclaude
andauthored
ci: verify go.mod files all have the same declared go version (#1790)
## Why this should be merged Closes: #1789 ## How this works This adds a CI workflow to ensure the go version in `go.mod` is the same for all tracked files. ## How this was tested CI: https://github.com/ava-labs/firewood/actions/runs/23058274067/job/66977621517 ## Breaking Changes None --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 76a2c8c commit 913a26b

File tree

4 files changed

+50
-10
lines changed

4 files changed

+50
-10
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Verify Go Versions
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
verify-go-versions:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v6
13+
14+
- name: Install jq
15+
run: |
16+
if command -v jq >/dev/null 2>&1; then
17+
# expected on most GHA runners
18+
echo "jq is already installed"
19+
else
20+
sudo apt-get update && sudo apt-get install -y jq
21+
fi
22+
23+
- name: Extract Go versions
24+
id: go_versions
25+
run: |
26+
GO_VERSION_FFI=$(cd ffi && go mod edit -json | jq -r .Go)
27+
GO_VERSION_TEST_ETH=$(cd ffi/tests/eth && go mod edit -json | jq -r .Go)
28+
GO_VERSION_TEST_FIREWOOD=$(cd ffi/tests/firewood && go mod edit -json | jq -r .Go)
29+
echo "ffi=$GO_VERSION_FFI"
30+
echo "ffi/tests/eth=$GO_VERSION_TEST_ETH"
31+
echo "ffi/tests/firewood=$GO_VERSION_TEST_FIREWOOD"
32+
echo "GO_VERSION_FFI=$GO_VERSION_FFI" >> $GITHUB_OUTPUT
33+
echo "GO_VERSION_TEST_ETH=$GO_VERSION_TEST_ETH" >> $GITHUB_OUTPUT
34+
echo "GO_VERSION_TEST_FIREWOOD=$GO_VERSION_TEST_FIREWOOD" >> $GITHUB_OUTPUT
35+
36+
- name: Check Go versions match
37+
run: |
38+
if [ "${{ steps.go_versions.outputs.GO_VERSION_FFI }}" != "${{ steps.go_versions.outputs.GO_VERSION_TEST_ETH }}" ] || \
39+
[ "${{ steps.go_versions.outputs.GO_VERSION_FFI }}" != "${{ steps.go_versions.outputs.GO_VERSION_TEST_FIREWOOD }}" ]; then
40+
echo "Go versions do not match:"
41+
echo "ffi/go.mod: ${{ steps.go_versions.outputs.GO_VERSION_FFI }}"
42+
echo "ffi/tests/eth/go.mod: ${{ steps.go_versions.outputs.GO_VERSION_TEST_ETH }}"
43+
echo "ffi/tests/firewood/go.mod: ${{ steps.go_versions.outputs.GO_VERSION_TEST_FIREWOOD }}"
44+
exit 1
45+
fi
46+
echo "All Go versions match: ${{ steps.go_versions.outputs.GO_VERSION_FFI }}"

ffi/go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
module github.com/ava-labs/firewood/ffi
22

3-
go 1.25
4-
5-
// Changes to the toolchain version should be replicated in:
3+
// Changes to the go version should be replicated in:
64
// - ffi/go.mod (here)
75
// - ffi/tests/eth/go.mod
86
// - ffi/tests/firewood/go.mod
9-
toolchain go1.25.8
7+
go 1.25.8
108

119
require (
1210
github.com/prometheus/client_golang v1.22.0

ffi/tests/eth/go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/ava-labs/firewood/ffi/tests/eth
22

3-
go 1.25
4-
5-
toolchain go1.25.8
3+
go 1.25.8
64

75
require (
86
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.0 // this is replaced to use the parent folder

ffi/tests/firewood/go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/ava-labs/firewood/ffi/tests/firewood
22

3-
go 1.25
4-
5-
toolchain go1.25.8
3+
go 1.25.8
64

75
require (
86
github.com/ava-labs/firewood-go/ffi v0.0.0 // this is replaced to use the parent folder

0 commit comments

Comments
 (0)