Skip to content

Commit ec86c6c

Browse files
ci: dispatch coverage-fanout on merged source PRs (#879)
* 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> * ai: apply changes for #879 (1 review thread) Addresses: - #3641231149 at .github/workflows/trigger-integration-tests.yml:468 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com> * ai: apply changes for #879 (1 review thread) Addresses: - #3641618444 at .github/workflows/trigger-integration-tests.yml:459 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com> --------- Signed-off-by: Eric Wang <e.wang@databricks.com> Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com> Co-authored-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
1 parent 9775996 commit ec86c6c

1 file changed

Lines changed: 60 additions & 2 deletions

File tree

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

Lines changed: 60 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,61 @@ 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+
github.event.pull_request.base.ref == 'main'
467+
runs-on:
468+
group: databricks-protected-runner-group
469+
labels: linux-ubuntu-latest
470+
permissions:
471+
contents: read
472+
pull-requests: read
473+
steps:
474+
- name: Check if driver source changed
475+
id: changed
476+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # pinned
477+
with:
478+
script: |
479+
const files = await github.paginate(github.rest.pulls.listFiles, {
480+
owner: context.repo.owner,
481+
repo: context.repo.repo,
482+
pull_number: context.payload.pull_request.number,
483+
per_page: 100,
484+
});
485+
// The whole repo IS the driver. Count a merge as source-affecting when it changes a file under src/.
486+
// Docs/CI/test-only merges do not warrant a full multi-language fan-out.
487+
const isSource = (f) => f.startsWith('src/');
488+
const srcChanged = files.some((f) => isSource(f.filename));
489+
console.log(`driver source changed: ${srcChanged}`);
490+
core.setOutput('source', srcChanged.toString());
491+
492+
- name: Generate GitHub App token (databricks-driver-test)
493+
if: steps.changed.outputs.source == 'true'
494+
id: app-token
495+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # pinned
496+
with:
497+
app-id: ${{ secrets.INTEGRATION_TEST_APP_ID }}
498+
private-key: ${{ secrets.INTEGRATION_TEST_PRIVATE_KEY }}
499+
owner: databricks
500+
repositories: databricks-driver-test
501+
502+
- name: Dispatch coverage-fanout
503+
if: steps.changed.outputs.source == 'true'
504+
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
505+
with:
506+
token: ${{ steps.app-token.outputs.token }}
507+
repository: databricks/databricks-driver-test
508+
event-type: coverage-fanout
509+
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)