|
1 | 1 | name: Integration Tests
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - pull_request: |
5 |
| - types: [opened, synchronize] |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize] |
6 | 6 |
|
7 |
| - merge_group: |
| 7 | + merge_group: |
8 | 8 |
|
9 | 9 | jobs:
|
10 |
| - check-token: |
11 |
| - name: Check secrets access |
12 |
| - runs-on: ubuntu-latest |
13 |
| - environment: "test-trigger-is" |
14 |
| - outputs: |
15 |
| - has_token: ${{ steps.set-token-status.outputs.has_token }} |
16 |
| - steps: |
17 |
| - - name: Check if DECO_WORKFLOW_TRIGGER_APP_ID is set |
18 |
| - id: set-token-status |
19 |
| - run: | |
20 |
| - if [ -z "${{ secrets.DECO_WORKFLOW_TRIGGER_APP_ID }}" ]; then |
21 |
| - echo "DECO_WORKFLOW_TRIGGER_APP_ID is empty. User has no access to secrets." |
22 |
| - echo "::set-output name=has_token::false" |
23 |
| - else |
24 |
| - echo "DECO_WORKFLOW_TRIGGER_APP_ID is set. User has access to secrets." |
25 |
| - echo "::set-output name=has_token::true" |
26 |
| - fi |
| 10 | + check-token: |
| 11 | + name: Check secrets access |
27 | 12 |
|
28 |
| - trigger-tests: |
29 |
| - name: Trigger Tests |
30 |
| - runs-on: ubuntu-latest |
31 |
| - needs: check-token |
32 |
| - if: github.event_name == 'pull_request' && needs.check-token.outputs.has_token == 'true' |
33 |
| - environment: "test-trigger-is" |
34 |
| - steps: |
35 |
| - - uses: actions/checkout@v3 |
| 13 | + runs-on: |
| 14 | + group: databricks-deco-testing-runner-group |
| 15 | + labels: ubuntu-latest-deco |
36 | 16 |
|
37 |
| - - name: Generate GitHub App Token |
38 |
| - id: generate-token |
39 |
| - uses: actions/create-github-app-token@v1 |
40 |
| - with: |
41 |
| - app-id: ${{ secrets.DECO_WORKFLOW_TRIGGER_APP_ID }} |
42 |
| - private-key: ${{ secrets.DECO_WORKFLOW_TRIGGER_PRIVATE_KEY }} |
43 |
| - owner: ${{ secrets.ORG_NAME }} |
44 |
| - repositories: ${{secrets.REPO_NAME}} |
| 17 | + environment: "test-trigger-is" |
| 18 | + outputs: |
| 19 | + has_token: ${{ steps.set-token-status.outputs.has_token }} |
| 20 | + steps: |
| 21 | + - name: Check if DECO_WORKFLOW_TRIGGER_APP_ID is set |
| 22 | + id: set-token-status |
| 23 | + run: | |
| 24 | + if [ -z "${{ secrets.DECO_WORKFLOW_TRIGGER_APP_ID }}" ]; then |
| 25 | + echo "DECO_WORKFLOW_TRIGGER_APP_ID is empty. User has no access to secrets." |
| 26 | + echo "::set-output name=has_token::false" |
| 27 | + else |
| 28 | + echo "DECO_WORKFLOW_TRIGGER_APP_ID is set. User has access to secrets." |
| 29 | + echo "::set-output name=has_token::true" |
| 30 | + fi |
45 | 31 |
|
46 |
| - - name: Trigger Workflow in Another Repo |
47 |
| - env: |
48 |
| - GH_TOKEN: ${{ steps.generate-token.outputs.token }} |
49 |
| - run: | |
50 |
| - gh workflow run sdk-java-isolated-pr.yml -R ${{ secrets.ORG_NAME }}/${{secrets.REPO_NAME}} \ |
51 |
| - --ref main \ |
52 |
| - -f pull_request_number=${{ github.event.pull_request.number }} \ |
53 |
| - -f commit_sha=${{ github.event.pull_request.head.sha }} |
| 32 | + trigger-tests: |
| 33 | + name: Trigger Tests |
54 | 34 |
|
55 |
| - # Statuses and checks apply to specific commits (by hash). |
56 |
| - # Enforcement of required checks is done both at the PR level and the merge queue level. |
57 |
| - # In case of multiple commits in a single PR, the hash of the squashed commit |
58 |
| - # will not match the one for the latest (approved) commit in the PR. |
59 |
| - # We auto approve the check for the merge queue for two reasons: |
60 |
| - # * Queue times out due to duration of tests. |
61 |
| - # * Avoid running integration tests twice, since it was already run at the tip of the branch before squashing. |
62 |
| - auto-approve: |
63 |
| - if: github.event_name == 'merge_group' |
64 |
| - runs-on: ubuntu-latest |
65 |
| - steps: |
66 |
| - - name: Mark Check |
67 |
| - env: |
68 |
| - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
69 |
| - shell: bash |
70 |
| - run: | |
71 |
| - gh api -X POST -H "Accept: application/vnd.github+json" \ |
72 |
| - -H "X-GitHub-Api-Version: 2022-11-28" \ |
73 |
| - /repos/${{ github.repository }}/statuses/${{ github.sha }} \ |
74 |
| - -f 'state=success' \ |
75 |
| - -f 'context=Integration Tests Check' |
| 35 | + runs-on: |
| 36 | + group: databricks-deco-testing-runner-group |
| 37 | + labels: ubuntu-latest-deco |
| 38 | + |
| 39 | + needs: check-token |
| 40 | + if: github.event_name == 'pull_request' && needs.check-token.outputs.has_token == 'true' |
| 41 | + environment: "test-trigger-is" |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v3 |
| 44 | + |
| 45 | + - name: Generate GitHub App Token |
| 46 | + id: generate-token |
| 47 | + uses: actions/create-github-app-token@v1 |
| 48 | + with: |
| 49 | + app-id: ${{ secrets.DECO_WORKFLOW_TRIGGER_APP_ID }} |
| 50 | + private-key: ${{ secrets.DECO_WORKFLOW_TRIGGER_PRIVATE_KEY }} |
| 51 | + owner: ${{ secrets.ORG_NAME }} |
| 52 | + repositories: ${{secrets.REPO_NAME}} |
| 53 | + |
| 54 | + - name: Trigger Workflow in Another Repo |
| 55 | + env: |
| 56 | + GH_TOKEN: ${{ steps.generate-token.outputs.token }} |
| 57 | + run: | |
| 58 | + gh workflow run sdk-java-isolated-pr.yml -R ${{ secrets.ORG_NAME }}/${{secrets.REPO_NAME}} \ |
| 59 | + --ref main \ |
| 60 | + -f pull_request_number=${{ github.event.pull_request.number }} \ |
| 61 | + -f commit_sha=${{ github.event.pull_request.head.sha }} |
| 62 | +
|
| 63 | + # Statuses and checks apply to specific commits (by hash). |
| 64 | + # Enforcement of required checks is done both at the PR level and the merge queue level. |
| 65 | + # In case of multiple commits in a single PR, the hash of the squashed commit |
| 66 | + # will not match the one for the latest (approved) commit in the PR. |
| 67 | + # We auto approve the check for the merge queue for two reasons: |
| 68 | + # * Queue times out due to duration of tests. |
| 69 | + # * Avoid running integration tests twice, since it was already run at the tip of the branch before squashing. |
| 70 | + auto-approve: |
| 71 | + if: github.event_name == 'merge_group' |
| 72 | + |
| 73 | + runs-on: |
| 74 | + group: databricks-deco-testing-runner-group |
| 75 | + labels: ubuntu-latest-deco |
| 76 | + |
| 77 | + steps: |
| 78 | + - name: Mark Check |
| 79 | + env: |
| 80 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + shell: bash |
| 82 | + run: | |
| 83 | + gh api -X POST -H "Accept: application/vnd.github+json" \ |
| 84 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 85 | + /repos/${{ github.repository }}/statuses/${{ github.sha }} \ |
| 86 | + -f 'state=success' \ |
| 87 | + -f 'context=Integration Tests Check' |
0 commit comments