Skip to content

Commit 5eb6dd4

Browse files
authored
Conditionally trigger integration tests based on testmask output (#4069)
## Changes Consolidate integration workflow files into a single job in `push.yml` that depends on the testmask job introduced in #4017. Integration tests are now only triggered for pull requests when the "test" target is included in the testmask output. When skipped, a success status is posted to satisfy the required check without running tests. ## Why This reduces CI resource usage for changes that don't affect code covered by integration tests (e.g., changes to ./experimental), and reduces the time-to-signal and time-to-merge for those changes. ## Tests * Integration tests were triggered in this PR * Integration tests were skipped in #4070
1 parent 0d93a6f commit 5eb6dd4

File tree

4 files changed

+74
-110
lines changed

4 files changed

+74
-110
lines changed

.github/workflows/integration-approve.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/integration-main.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/integration-pr.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/push.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,3 +355,77 @@ jobs:
355355
356356
exit 1
357357
fi
358+
359+
# Trigger integration tests in a separate repository.
360+
# Requires secrets from "test-trigger-is" environment (not available for fork PRs).
361+
# Auto-approves for merge groups to avoid running twice and queue timeouts.
362+
integration-trigger:
363+
needs:
364+
- testmask
365+
366+
if: >-
367+
(github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork) ||
368+
(github.event_name == 'merge_group') ||
369+
(github.event_name == 'push')
370+
371+
runs-on:
372+
group: databricks-deco-testing-runner-group
373+
labels: ubuntu-latest-deco
374+
375+
environment: "test-trigger-is"
376+
377+
steps:
378+
- name: Generate GitHub App Token
379+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
380+
id: generate-token
381+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
382+
with:
383+
app-id: ${{ secrets.DECO_WORKFLOW_TRIGGER_APP_ID }}
384+
private-key: ${{ secrets.DECO_WORKFLOW_TRIGGER_PRIVATE_KEY }}
385+
owner: ${{ secrets.ORG_NAME }}
386+
repositories: ${{ secrets.REPO_NAME }}
387+
388+
# Trigger integration tests if the primary "test" target is triggered by this change.
389+
- name: Trigger integration tests (pull request)
390+
if: ${{ github.event_name == 'pull_request' && contains(fromJSON(needs.testmask.outputs.targets), 'test') }}
391+
env:
392+
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
393+
run: |-
394+
gh workflow run cli-isolated-pr.yml -R ${{ secrets.ORG_NAME }}/${{ secrets.REPO_NAME }} \
395+
--ref main \
396+
-f pull_request_number=${{ github.event.pull_request.number }} \
397+
-f commit_sha=${{ github.event.pull_request.head.sha }}
398+
399+
# Skip integration tests if the primary "test" target is not triggered by this change.
400+
- name: Skip integration tests (pull request)
401+
if: ${{ github.event_name == 'pull_request' && !contains(fromJSON(needs.testmask.outputs.targets), 'test') }}
402+
env:
403+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
404+
run: |-
405+
gh api -X POST -H "Accept: application/vnd.github+json" \
406+
-H "X-GitHub-Api-Version: 2022-11-28" \
407+
/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \
408+
-f 'state=success' \
409+
-f 'context=Integration Tests Check' \
410+
-f 'description=⏭️ Skipped'
411+
412+
- name: Auto-approve for merge group
413+
if: ${{ github.event_name == 'merge_group' }}
414+
env:
415+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
416+
run: |-
417+
gh api -X POST -H "Accept: application/vnd.github+json" \
418+
-H "X-GitHub-Api-Version: 2022-11-28" \
419+
/repos/${{ github.repository }}/statuses/${{ github.sha }} \
420+
-f 'state=success' \
421+
-f 'context=Integration Tests Check' \
422+
-f 'description=⏭️ Skipped'
423+
424+
- name: Trigger integration tests (push to main)
425+
if: ${{ github.event_name == 'push' }}
426+
env:
427+
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
428+
run: |-
429+
gh workflow run cli-isolated-nightly.yml -R ${{ secrets.ORG_NAME }}/${{ secrets.REPO_NAME }} \
430+
--ref main \
431+
-f commit_sha=${{ github.event.after }}

0 commit comments

Comments
 (0)