Skip to content

Commit 00a4a20

Browse files
committed
fix: ensure that IDL submodules and go modules are synced
1 parent cb3492c commit 00a4a20

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed

.github/workflows/ci-checks.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ on:
44
pull_request:
55

66
jobs:
7+
idl-submodule-points-to-master:
8+
name: IDL submodule points to master
9+
runs-on: ubuntu-latest # uses ubuntu as runner
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
submodules: true # ensures git submodules are intialized and updated
16+
fetch-depth: 0 # get full history for branch checking
17+
18+
- name: Check IDL submodule status (must point to master)
19+
run: make .idl-status
20+
721
golang-unit-test:
822
name: Golang unit test
923
runs-on: ubuntu-latest
@@ -153,4 +167,4 @@ jobs:
153167
name: go-integration-grpc-coverage
154168
path: .build/*/coverage/*.out
155169
include-hidden-files: true
156-
170+

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,30 @@ $(BUILD)/go_mod_check: go.mod internal/tools/go.mod
165165
$Q ./scripts/check-gomod-version.sh go.uber.org/thriftrw $(if $(verbose),-v)
166166
$Q touch $@
167167

168+
# checks that the idl submodule points to a commit on master, and that it matches the go module (which must be a pseudo version).
169+
# this is only used in an explicit CI step, because it's expected to fail when developing.
170+
#
171+
# `git ls-tree HEAD idls` is selected because this only cares about the committed/checked-out target,
172+
# not whatever the current status is, because only the committed value will exist for others.
173+
#
174+
# and last but not least: this avoids using `go` to make this check take only a couple seconds in CI,
175+
# so the whole docker container doesn't have to be prepared.
176+
.idl-status:
177+
$(Q) cd idls && \
178+
SUBMODULE_COMMIT=$$(git rev-parse HEAD) && \
179+
BRANCH_INFO=$$(git branch -r --contains "$$SUBMODULE_COMMIT" | head -n1) && \
180+
if ! git branch -r --contains "$$SUBMODULE_COMMIT" | grep -q "origin/master"; then \
181+
echo "Error: Submodule commit $$SUBMODULE_COMMIT belongs to $$BRANCH_INFO, not to master branch" && \
182+
exit 1; \
183+
fi
184+
$(Q) idlsha=$$(git ls-tree HEAD idls | awk '{print substr($$3,0,12)}') && \
185+
gosha=$$(grep github.com/uber/cadence-idl go.mod | tr '-' '\n' | tail -n1) && \
186+
if [[ "$$idlsha" != "$$gosha" ]]; then \
187+
echo "IDL submodule sha ($$idlsha) does not match go module sha ($$gosha)." >&2 && \
188+
echo "Make sure the IDL PR has been merged, and this PR is updated, before merging here." >&2 && \
189+
exit 1; \
190+
fi
191+
168192
# ====================================
169193
# Codegen targets
170194
# ====================================

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/robfig/cron v1.2.0
1717
github.com/stretchr/testify v1.9.0
1818
github.com/uber-go/tally v3.3.15+incompatible
19-
github.com/uber/cadence-idl v0.0.0-20251027200124-0857e5075a96
19+
github.com/uber/cadence-idl v0.0.0-20251030234320-a2d398f4e4df
2020
github.com/uber/jaeger-client-go v2.22.1+incompatible
2121
github.com/uber/tchannel-go v1.32.1
2222
go.uber.org/atomic v1.11.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ github.com/uber-go/mapdecode v1.0.0/go.mod h1:b5nP15FwXTgpjTjeA9A2uTHXV5UJCl4arw
202202
github.com/uber-go/tally v3.3.12+incompatible/go.mod h1:YDTIBxdXyOU/sCWilKB4bgyufu1cEi0jdVnRdxvjnmU=
203203
github.com/uber-go/tally v3.3.15+incompatible h1:9hLSgNBP28CjIaDmAuRTq9qV+UZY+9PcvAkXO4nNMwg=
204204
github.com/uber-go/tally v3.3.15+incompatible/go.mod h1:YDTIBxdXyOU/sCWilKB4bgyufu1cEi0jdVnRdxvjnmU=
205-
github.com/uber/cadence-idl v0.0.0-20251027200124-0857e5075a96 h1:4TWSibG2Ucx+xRna6BsHSNPPnpfzYT7v26uorKuJD0k=
206-
github.com/uber/cadence-idl v0.0.0-20251027200124-0857e5075a96/go.mod h1:oyUK7GCNCRHCCyWyzifSzXpVrRYVBbAMHAzF5dXiKws=
205+
github.com/uber/cadence-idl v0.0.0-20251030234320-a2d398f4e4df h1:zwr4iPLB4przghbqi6gwoLkKLr0vHE1oW6zJI8v9csY=
206+
github.com/uber/cadence-idl v0.0.0-20251030234320-a2d398f4e4df/go.mod h1:oyUK7GCNCRHCCyWyzifSzXpVrRYVBbAMHAzF5dXiKws=
207207
github.com/uber/jaeger-client-go v2.22.1+incompatible h1:NHcubEkVbahf9t3p75TOCR83gdUHXjRJvjoBh1yACsM=
208208
github.com/uber/jaeger-client-go v2.22.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
209209
github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=

0 commit comments

Comments
 (0)