Skip to content

Commit eaf99a9

Browse files
ci: dispatch coverage-fanout to databricks-driver-test on merged source PRs
Wires databricks-sql-python into the multi-language coverage fan-out. When a PR merges to main and touched driver source (a file under src/), dispatch a `coverage-fanout` repository_dispatch to databricks/databricks-driver-test. Its coverage-fanout-tracker.yml then opens a tracking issue and runs the language-agnostic fan-out (a spec authored from this PR's diff, conformed across every driver). - Adds `closed` to the pull_request trigger types; the new trigger-coverage-fanout job gates on pull_request.merged == true. - Source-path filter (src/): docs/CI/test-only merges don't warrant a full fan-out. - Reuses the existing INTEGRATION_TEST App token (scoped to driver-test) + the same peter-evans/repository-dispatch pin adbc-drivers/databricks uses. - Tightens skip-integration-tests-pr's guard to exclude `closed` so it doesn't re-stamp a check on merged PRs. Co-authored-by: Isaac Signed-off-by: Eric Wang <e.wang@databricks.com>
1 parent 9775996 commit eaf99a9

1 file changed

Lines changed: 56 additions & 2 deletions

File tree

.github/workflows/trigger-integration-tests.yml

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ name: Trigger Integration Tests
4444

4545
on:
4646
pull_request:
47-
types: [opened, synchronize, reopened, labeled]
47+
types: [opened, synchronize, reopened, labeled, closed]
4848
merge_group: # Trigger when added to merge queue
4949

5050
jobs:
@@ -125,7 +125,7 @@ jobs:
125125
# checks would block every PR that doesn't bother labelling.
126126
# =============================================================================
127127
skip-integration-tests-pr:
128-
if: github.event_name == 'pull_request' && github.event.action != 'labeled'
128+
if: github.event_name == 'pull_request' && github.event.action != 'labeled' && github.event.action != 'closed'
129129
runs-on:
130130
group: databricks-protected-runner-group
131131
labels: linux-ubuntu-latest
@@ -449,3 +449,57 @@ jobs:
449449
}
450450
});
451451
}
452+
453+
# =============================================================================
454+
# After merge: trigger the multi-language coverage fan-out.
455+
# Fires when a PR lands on main (merge queue or direct merge) and touched
456+
# driver source. Dispatches `coverage-fanout` to databricks-driver-test, whose
457+
# coverage-fanout-tracker.yml opens a tracking issue and runs the
458+
# language-agnostic fan-out (a spec authored from THIS PR's diff, conformed as
459+
# tests across every driver) as peco-engineer-bot.
460+
# =============================================================================
461+
trigger-coverage-fanout:
462+
if: |
463+
github.event_name == 'pull_request' &&
464+
github.event.action == 'closed' &&
465+
github.event.pull_request.merged == true
466+
runs-on:
467+
group: databricks-protected-runner-group
468+
labels: linux-ubuntu-latest
469+
steps:
470+
- name: Check if driver source changed
471+
id: changed
472+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # pinned
473+
with:
474+
script: |
475+
const files = await github.paginate(github.rest.pulls.listFiles, {
476+
owner: context.repo.owner,
477+
repo: context.repo.repo,
478+
pull_number: context.payload.pull_request.number,
479+
per_page: 100,
480+
});
481+
// The whole repo IS the driver. Count a merge as source-affecting when it changes a file under src/.
482+
// Docs/CI/test-only merges do not warrant a full multi-language fan-out.
483+
const isSource = (f) => f.startsWith('src/');
484+
const srcChanged = files.some((f) => isSource(f.filename));
485+
console.log(`driver source changed: ${srcChanged}`);
486+
core.setOutput('source', srcChanged.toString());
487+
488+
- name: Generate GitHub App token (databricks-driver-test)
489+
if: steps.changed.outputs.source == 'true'
490+
id: app-token
491+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # pinned
492+
with:
493+
app-id: ${{ secrets.INTEGRATION_TEST_APP_ID }}
494+
private-key: ${{ secrets.INTEGRATION_TEST_PRIVATE_KEY }}
495+
owner: databricks
496+
repositories: databricks-driver-test
497+
498+
- name: Dispatch coverage-fanout
499+
if: steps.changed.outputs.source == 'true'
500+
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
501+
with:
502+
token: ${{ steps.app-token.outputs.token }}
503+
repository: databricks/databricks-driver-test
504+
event-type: coverage-fanout
505+
client-payload: '{"reference_repo": "${{ github.repository }}", "pr_number": "${{ github.event.pull_request.number }}", "pr_url": "${{ github.event.pull_request.html_url }}"}'

0 commit comments

Comments
 (0)