Skip to content

Commit 7d8046e

Browse files
authored
feat: reduce environment approvals (#117)
Closes #116.
1 parent 674a488 commit 7d8046e

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

adbc_drivers_dev/generate.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ class LangBuildConfig(BaseModel):
7676
description="Install tools for these languages to use in the build.",
7777
)
7878

79+
environment_contexts: list[str] = Field(
80+
default_factory=lambda: ["test", "validate"],
81+
alias="environment-contexts",
82+
description="What parts of the build require the environment.",
83+
)
84+
7985

8086
class LangConfig(BaseModel):
8187
model_config = {

adbc_drivers_dev/templates/test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
- { platform: linux, arch: amd64, runner: ubuntu-latest }
100100
- { platform: macos, arch: arm64, runner: macos-latest }
101101
- { platform: windows, arch: amd64, runner: windows-latest }
102-
<% if environment %>
102+
<% if environment and "test" in lang_config.build.environment_contexts or "build:test" in lang_config.build.environment_contexts %>
103103
environment: <{environment}>
104104
<% endif %>
105105
permissions:
@@ -279,7 +279,7 @@ jobs:
279279
include:
280280
# I think we only need to test one platform, but we can change that later
281281
- { platform: linux, arch: amd64, runner: ubuntu-latest }
282-
<% if environment %>
282+
<% if environment and "validate" in lang_config.build.environment_contexts or "build:test" in lang_config.build.environment_contexts %>
283283
environment: <{environment}>
284284
<% endif %>
285285
permissions:
@@ -468,7 +468,7 @@ jobs:
468468
<% endif %>
469469
- { platform: macos, arch: arm64, runner: macos-latest }
470470
- { platform: windows, arch: amd64, runner: windows-latest }
471-
<% if environment %>
471+
<% if environment and "build:release" in lang_config.build.environment_contexts %>
472472
environment: <{environment}>
473473
<% endif %>
474474
permissions:
@@ -669,7 +669,7 @@ jobs:
669669
- { platform: linux, arch: amd64, runner: ubuntu-latest }
670670
- { platform: macos, arch: arm64, runner: macos-latest }
671671
- { platform: windows, arch: amd64, runner: windows-latest }
672-
<% if environment %>
672+
<% if environment and "build:test" in lang_config.build.environment_contexts %>
673673
environment: <{environment}>
674674
<% endif %>
675675
steps:

adbc_drivers_dev/workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def generate_workflows(args) -> int:
126126
f"{lang}_test.yaml",
127127
{
128128
**params.to_dict(),
129-
"pull_request_trigger_paths": [".github/workflows/go_test.yaml"],
129+
"pull_request_trigger_paths": [f".github/workflows/{lang}_test.yaml"],
130130
"release": False,
131131
"workflow_name": "Test",
132132
"lang": lang,

0 commit comments

Comments
 (0)