|
name: Integration Tests |
|
|
|
on: |
|
pull_request: |
|
types: [opened, synchronize] |
|
|
|
merge_group: |
|
|
|
jobs: |
|
check-token: |
|
name: Check secrets access |
|
|
|
runs-on: |
|
group: databricks-deco-testing-runner-group |
|
labels: ubuntu-latest-deco |
|
|
|
environment: "test-trigger-is" |
|
outputs: |
|
has_token: ${{ steps.set-token-status.outputs.has_token }} |
|
steps: |
|
- name: Check if required secrets are set |
|
id: set-token-status |
|
run: | |
|
if [ -z "${{ secrets.DECO_WORKFLOW_TRIGGER_APP_ID }}" ] || [ -z "${{ secrets.DECO_TEST_APPROVAL_APP_ID }}" ]; then |
|
echo "Required secrets are missing. User has no access to secrets." |
|
echo "has_token=false" >> $GITHUB_OUTPUT |
|
else |
|
echo "All required secrets are set. User has access to secrets." |
|
echo "has_token=true" >> $GITHUB_OUTPUT |
|
fi |
|
|
|
trigger-tests: |
|
name: Trigger Tests |
|
|
|
runs-on: |
|
group: databricks-release-runner-group-emu-access |
|
labels: linux-ubuntu-latest-emu-access |
|
|
|
needs: check-token |
|
if: github.event_name == 'pull_request' && needs.check-token.outputs.has_token == 'true' |
|
environment: "test-trigger-is" |
|
|
|
steps: |
|
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 |
|
|
|
- name: Generate GitHub App Token for Workflow Trigger |
|
id: generate-token |
|
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0 |
|
with: |
|
app-id: ${{ secrets.DECO_WORKFLOW_TRIGGER_APP_ID }} |
|
private-key: ${{ secrets.DECO_WORKFLOW_TRIGGER_PRIVATE_KEY }} |
|
owner: ${{ secrets.ORG_NAME }} |
|
repositories: ${{secrets.REPO_NAME}} |
|
|
|
- name: Trigger Workflow in Another Repo |
|
env: |
|
GH_TOKEN: ${{ steps.generate-token.outputs.token }} |
|
run: | |
|
gh workflow run sdk-java-isolated-pr.yml -R ${{ secrets.ORG_NAME }}/${{secrets.REPO_NAME}} \ |
|
--ref main \ |
|
-f pull_request_number=${{ github.event.pull_request.number }} \ |
|
-f commit_sha=${{ github.event.pull_request.head.sha }} |
|
|
|
# Statuses and checks apply to specific commits (by hash). |
|
# Enforcement of required checks is done both at the PR level and the merge queue level. |
|
# In case of multiple commits in a single PR, the hash of the squashed commit |
|
# will not match the one for the latest (approved) commit in the PR. |
|
# We auto approve the check for the merge queue for two reasons: |
|
# * Queue times out due to duration of tests. |
|
# * Avoid running integration tests twice, since it was already run at the tip of the branch before squashing. |
|
auto-approve: |
|
if: github.event_name == 'merge_group' |
|
|
|
runs-on: |
|
group: databricks-deco-testing-runner-group |
|
labels: ubuntu-latest-deco |
|
|
|
permissions: |
|
checks: write |
|
contents: read |
|
|
|
steps: |
|
- name: Auto-approve Check for Merge Queue |
|
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 |
|
with: |
|
script: | |
|
await github.rest.checks.create({ |
|
owner: context.repo.owner, |
|
repo: context.repo.repo, |
|
name: 'Integration Tests', |
|
head_sha: context.sha, |
|
status: 'completed', |
|
conclusion: 'success', |
|
output: { |
|
title: 'Integration Tests', |
|
summary: 'Auto-approved for merge queue (tests already passed on PR)' |
|
} |
|
}); |