Skip to content

Commit eb8f394

Browse files
authored
feat: allow 'custom' workflow config for ad-hoc builds (#72)
## What's Changed - Add a 'custom' language option for ad-hoc builds - Check out submodules - Pass through PROTOC env var for Rust builds
1 parent ac8c34a commit eb8f394

File tree

3 files changed

+48
-25
lines changed

3 files changed

+48
-25
lines changed

adbc_drivers_dev/make.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def build_rust(
345345

346346
env = {}
347347
# Some env vars need to be explicitly propagated into Docker
348-
smuggle_vars = set()
348+
smuggle_vars = {"PROTOC"}
349349

350350
if platform.system() == "Darwin":
351351
# https://doc.rust-lang.org/nightly/rustc/platform-support/apple-darwin.html#os-version
@@ -363,6 +363,8 @@ def build_rust(
363363
for var in smuggle_vars:
364364
if var in env:
365365
smuggle_env += f'{var}="{shlex.quote(env[var])}" '
366+
elif var in os.environ:
367+
smuggle_env += f'{var}="{shlex.quote(os.environ[var])}" '
366368

367369
command = [
368370
"docker",

adbc_drivers_dev/templates/test.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,14 @@ jobs:
119119
with:
120120
fetch-depth: 0
121121
persist-credentials: false
122+
submodules: 'recursive'
122123
<% else %>
123124
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
124125
if: github.event_name != 'workflow_dispatch'
125126
with:
126127
fetch-depth: 0
127128
persist-credentials: false
129+
submodules: 'recursive'
128130

129131
- name: "checkout remote"
130132
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -134,6 +136,7 @@ jobs:
134136
ref: ${{ inputs.ref }}
135137
fetch-depth: 0
136138
persist-credentials: false
139+
submodules: 'recursive'
137140
<% endif %>
138141

139142
<% if lang == "go" %>
@@ -194,6 +197,8 @@ jobs:
194197
go build ./...
195198
<% elif lang == "rust" %>
196199
cargo build --locked
200+
<% elif lang == "script" %>
201+
./ci/scripts/build.sh test ${{ matrix.platform }} ${{ matrix.arch }}
197202
<% else %>
198203
<{not_implemented(lang)}>
199204
<% endif %>
@@ -243,6 +248,8 @@ jobs:
243248
go test -tags assert -v ./...
244249
<% elif lang == "rust" %>
245250
cargo test
251+
<% elif lang == "script" %>
252+
./ci/scripts/test.sh ${{ matrix.platform }} ${{ matrix.arch }}
246253
<% else %>
247254
<{not_implemented(lang)}>
248255
<% endif %>
@@ -290,12 +297,14 @@ jobs:
290297
with:
291298
fetch-depth: 0
292299
persist-credentials: false
300+
submodules: 'recursive'
293301
<% else %>
294302
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
295303
if: github.event_name != 'workflow_dispatch'
296304
with:
297305
fetch-depth: 0
298306
persist-credentials: false
307+
submodules: 'recursive'
299308

300309
- name: "checkout remote"
301310
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -305,6 +314,7 @@ jobs:
305314
ref: ${{ inputs.ref }}
306315
fetch-depth: 0
307316
persist-credentials: false
317+
submodules: 'recursive'
308318
<% endif %>
309319

310320
<% if lang == "go" %>
@@ -464,12 +474,14 @@ jobs:
464474
with:
465475
fetch-depth: 0
466476
persist-credentials: false
477+
submodules: 'recursive'
467478
<% else %>
468479
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
469480
if: github.event_name != 'workflow_dispatch'
470481
with:
471482
fetch-depth: 0
472483
persist-credentials: false
484+
submodules: 'recursive'
473485

474486
- name: "checkout remote"
475487
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -479,6 +491,7 @@ jobs:
479491
ref: ${{ inputs.ref }}
480492
fetch-depth: 0
481493
persist-credentials: false
494+
submodules: 'recursive'
482495
<% endif %>
483496

484497
<% if lang == "go" %>
@@ -550,12 +563,14 @@ jobs:
550563
with:
551564
fetch-depth: 0
552565
persist-credentials: false
566+
submodules: 'recursive'
553567
<% else %>
554568
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
555569
if: github.event_name != 'workflow_dispatch'
556570
with:
557571
fetch-depth: 0
558572
persist-credentials: false
573+
submodules: 'recursive'
559574

560575
- name: "checkout remote"
561576
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -565,6 +580,7 @@ jobs:
565580
ref: ${{ inputs.ref }}
566581
fetch-depth: 0
567582
persist-credentials: false
583+
submodules: 'recursive'
568584
<% endif %>
569585

570586
<% if lang == "go" %>
@@ -675,12 +691,14 @@ jobs:
675691
with:
676692
fetch-depth: 1
677693
persist-credentials: false
694+
submodules: 'recursive'
678695
<% else %>
679696
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
680697
if: github.event_name != 'workflow_dispatch'
681698
with:
682699
fetch-depth: 1
683700
persist-credentials: false
701+
submodules: 'recursive'
684702
- name: "checkout remote"
685703
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
686704
if: github.event_name == 'workflow_dispatch'
@@ -689,6 +707,7 @@ jobs:
689707
ref: ${{ inputs.ref }}
690708
fetch-depth: 1
691709
persist-credentials: false
710+
submodules: 'recursive'
692711
<% endif %>
693712
- name: load package
694713
<% if private or secrets["build:test"] %>
@@ -748,12 +767,14 @@ jobs:
748767
with:
749768
fetch-depth: 0
750769
persist-credentials: false
770+
submodules: 'recursive'
751771
<% else %>
752772
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
753773
if: github.event_name != 'workflow_dispatch'
754774
with:
755775
fetch-depth: 0
756776
persist-credentials: false
777+
submodules: 'recursive'
757778

758779
- name: "checkout remote"
759780
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -763,6 +784,7 @@ jobs:
763784
ref: ${{ inputs.ref }}
764785
fetch-depth: 0
765786
persist-credentials: false
787+
submodules: 'recursive'
766788
<% endif %>
767789

768790
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0

adbc_drivers_dev/workflow.py

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,17 @@ def generate_workflows(args) -> int:
105105
langs = {
106106
"go": ("Go", "go"),
107107
"rust": ("Rust", "rust"),
108+
"script": ("Custom", "src"),
108109
}
109110

111+
retcode = 0
110112
for lang, (lang_human, lang_subdir) in langs.items():
111113
lang_config = params.lang.get(lang)
112114
if not lang_config:
113115
continue
114116

117+
(args.repository / lang_subdir).mkdir(parents=True, exist_ok=True)
118+
115119
template = env.get_template("test.yaml")
116120
write_workflow(
117121
workflows,
@@ -153,6 +157,25 @@ def generate_workflows(args) -> int:
153157
},
154158
)
155159

160+
template = env.get_template("pixi.toml")
161+
write_workflow(
162+
args.repository / lang_subdir,
163+
template,
164+
"pixi.toml",
165+
{
166+
**params.to_dict(),
167+
"lang": lang,
168+
"lang_human": lang_human,
169+
"lang_subdir": lang_subdir,
170+
"lang_config": lang_config,
171+
},
172+
)
173+
174+
license_template = args.repository / lang_subdir / "license.tpl"
175+
if not license_template.is_file():
176+
print(f"Missing {license_template}", file=sys.stderr)
177+
retcode = 1
178+
156179
if lang == "go":
157180
template = env.get_template("golangci.toml")
158181
write_workflow(
@@ -175,30 +198,6 @@ def generate_workflows(args) -> int:
175198
},
176199
)
177200

178-
template = env.get_template("pixi.toml")
179-
180-
retcode = 0
181-
for lang, enabled in params.lang.items():
182-
if not enabled:
183-
continue
184-
write_workflow(
185-
args.repository / lang,
186-
template,
187-
"pixi.toml",
188-
{
189-
**params.to_dict(),
190-
"lang": lang,
191-
"lang_human": lang_human,
192-
"lang_subdir": lang_subdir,
193-
"lang_config": lang_config,
194-
},
195-
)
196-
197-
license_template = args.repository / lang / "license.tpl"
198-
if not license_template.is_file():
199-
print(f"Missing {license_template}", file=sys.stderr)
200-
retcode = 1
201-
202201
return retcode
203202

204203

0 commit comments

Comments
 (0)