From 0417a7822858a0828df2df0b2a5208fb13504966 Mon Sep 17 00:00:00 2001
From: David Li
Date: Mon, 3 Aug 2026 10:25:34 +0900
Subject: [PATCH] feat: only run post-test if it exists, but always run it
---
adbc_drivers_dev/templates/test.yaml | 60 +++++++++++++++++++++++++---
adbc_drivers_dev/workflow.py | 6 +++
2 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/adbc_drivers_dev/templates/test.yaml b/adbc_drivers_dev/templates/test.yaml
index 509d77a..e6300d3 100644
--- a/adbc_drivers_dev/templates/test.yaml
+++ b/adbc_drivers_dev/templates/test.yaml
@@ -269,9 +269,34 @@ jobs:
<{not_implemented(lang)}>
<% endif %>
- if [[ -f ci/scripts/post-test.sh ]]; then
- ./ci/scripts/post-test.sh
+<% if file_exists("ci/scripts/post-test.sh") %>
+ - name: Post-Test
+ if: always()
+<% if secrets["test"] %>
+ env:
+<% for name, val in secrets["test"].items() %>
+ <{name}>: ${{ secrets.<{val}> }} # zizmor: ignore[secrets-outside-env]
+<% endfor %>
+<% endif %>
+ working-directory: <{ lang_subdir }>
+ run: |
+ set -a
+ if [[ -f .env ]]; then
+ source .env
+ fi
+ if [[ -f .env.${{ matrix.platform }} ]]; then
+ source .env.${{ matrix.platform }}
+ fi
+ if [[ -f .env.ci ]]; then
+ source .env.ci
+ fi
+ if [[ -f .env.override ]]; then
+ source .env.override
fi
+ set +a
+
+ ./ci/scripts/post-test.sh
+<% endif %>
<% if lang == "go" %>
- name: go mod tidy
@@ -473,11 +498,36 @@ jobs:
pixi run validate
fi
- if [[ -f ci/scripts/post-test.sh ]]; then
- ./ci/scripts/post-test.sh
+ cp validation-report.xml validation-report-${{ matrix.vendor_version }}.xml
+
+<% if file_exists("ci/scripts/post-test.sh") %>
+ - name: Post-Test
+ if: always()
+<% if secrets["validate"] %>
+ env:
+<% for name, val in secrets["validate"].items() %>
+ <{name}>: ${{ secrets.<{val}> }} # zizmor: ignore[secrets-outside-env]
+<% endfor %>
+<% endif %>
+ working-directory: <{ lang_subdir }>
+ run: |
+ set -a
+ if [[ -f .env ]]; then
+ source .env
fi
+ if [[ -f .env.${{ matrix.platform }} ]]; then
+ source .env.${{ matrix.platform }}
+ fi
+ if [[ -f .env.ci ]]; then
+ source .env.ci
+ fi
+ if [[ -f .env.override ]]; then
+ source .env.override
+ fi
+ set +a
- cp validation-report.xml validation-report-${{ matrix.vendor_version }}.xml
+ ./ci/scripts/post-test.sh
+<% endif %>
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
diff --git a/adbc_drivers_dev/workflow.py b/adbc_drivers_dev/workflow.py
index 30501fe..3323a36 100644
--- a/adbc_drivers_dev/workflow.py
+++ b/adbc_drivers_dev/workflow.py
@@ -61,6 +61,10 @@ def template_not_implemented(message: str) -> str:
raise NotImplementedError(message)
+def file_exists(root: Path, path: str) -> bool:
+ return (root / path).is_file()
+
+
def generate_workflows(args) -> int:
env = jinja2.Environment(
loader=jinja2.PackageLoader("adbc_drivers_dev"),
@@ -133,6 +137,7 @@ def generate_workflows(args) -> int:
if lang == "go"
else langs["go"][1]
)
+ lang_file_exists = functools.partial(file_exists, args.repository / lang_subdir)
lang_ctx = {
"lang": lang,
"lang_human": lang_human,
@@ -142,6 +147,7 @@ def generate_workflows(args) -> int:
"go_mod_path": go_mod_path,
"lang_config": lang_config,
"lang_tools": lang_tools,
+ "file_exists": lang_file_exists,
}
write_workflow(