Skip to content

Commit a3679dc

Browse files
authored
feat: handle Go toolchain in script builds (#99)
With Rust it's ok for us to spawn the container; with Go it gets tricky so assume the build script will spawn the container itself
1 parent d679896 commit a3679dc

3 files changed

Lines changed: 30 additions & 9 deletions

File tree

adbc_drivers_dev/generate.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ class LangBuildConfig(BaseModel):
6464
description="A list of additional arguments to pass to adbc-make.",
6565
)
6666

67+
go_mod_path: str = Field(
68+
default="go",
69+
alias="go-mod-path",
70+
description="Path containing the go.mod file for Go drivers. Used to cache dependencies in CI.",
71+
)
72+
6773
lang_tools: list[str] = Field(
6874
default_factory=list,
6975
alias="lang-tools",

adbc_drivers_dev/make.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,27 @@ def build_script(
462462
# Force use of Git Bash on GitHub Actions
463463
args = [r"C:\Program Files\Git\bin\bash.EXE", *args]
464464

465+
toolchain = get_var("TOOLCHAIN", "")
466+
if not toolchain:
467+
raise ValueError("Must specify TOOLCHAIN=toolchain for script-based build")
468+
469+
container = {
470+
"go": "manylinux",
471+
"rust": "manylinux-rust",
472+
}.get(toolchain)
473+
if container is None:
474+
raise ValueError(f"Unsupported TOOLCHAIN={toolchain} for script-based build")
475+
476+
# if we're using a script, don't invoke docker for Go; the script itself
477+
# will invoke docker
478+
465479
maybe_build_docker(
466480
repo_root=repo_root,
467481
driver_root=driver_root,
468482
env=env,
469483
args=args,
470-
ci=ci,
484+
ci=ci and toolchain != "go",
485+
container=container,
471486
)
472487

473488
output = (repo_root / "build" / target).resolve()

adbc_drivers_dev/templates/test.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ jobs:
143143
<% if "go" in lang_tools %>
144144
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
145145
with:
146-
cache-dependency-path: go/go.sum
146+
cache-dependency-path: <{lang_config.build.go_mod_path}>/go.sum
147147
check-latest: true
148-
go-version-file: go/go.mod
148+
go-version-file: <{lang_config.build.go_mod_path}>/go.mod
149149
<% endif %>
150150
<% if "rust" in lang_tools %>
151151
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2
@@ -323,9 +323,9 @@ jobs:
323323
<% if "go" in lang_tools %>
324324
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
325325
with:
326-
cache-dependency-path: go/go.sum
326+
cache-dependency-path: <{lang_config.build.go_mod_path}>/go.sum
327327
check-latest: true
328-
go-version-file: go/go.mod
328+
go-version-file: <{lang_config.build.go_mod_path}>/go.mod
329329
<% endif %>
330330
<% if "rust" in lang_tools %>
331331
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2
@@ -504,9 +504,9 @@ jobs:
504504
<% if "go" in lang_tools %>
505505
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
506506
with:
507-
cache-dependency-path: go/go.sum
507+
cache-dependency-path: <{lang_config.build.go_mod_path}>/go.sum
508508
check-latest: true
509-
go-version-file: go/go.mod
509+
go-version-file: <{lang_config.build.go_mod_path}>/go.mod
510510
<% endif %>
511511
<% if "rust" in lang_tools %>
512512
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2
@@ -843,8 +843,8 @@ jobs:
843843
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
844844
working-directory: <{ lang_subdir }>
845845
run: |
846-
git tag go/v1000.0.0
847-
tag=go/v1000.0.0
846+
git tag <{ lang_subdir }>/v1000.0.0
847+
tag=<{ lang_subdir }>/v1000.0.0
848848
849849
pixi run release --dry-run $(pwd) $tag
850850
echo gh release upload $tag $(find ~/packages -name '*.tar.gz') $(find ~/packages -name 'manifest.yaml') $(find ~/packages -name '*.md')

0 commit comments

Comments
 (0)