-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
887d63c
commit 8f02572
Showing
2 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Integration Tests | ||
on: | ||
repository_dispatch: | ||
types: [integration-check] | ||
jobs: | ||
myEvent: | ||
runs-on: ubuntu-latest | ||
steps: | ||
#################################################### | ||
# Update the status to show that the queued message | ||
# was received and is being processed | ||
#################################################### | ||
- name: Acknowledge Request | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
gh api -X PATCH -H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-f 'status=in_progress' \ | ||
-f 'output[title]=Integration Tests' \ | ||
-f 'output[summary]=Running Integration Tests for Py SDK' \ | ||
/repos/${{ github.repository }}/check-runs/${{ github.event.client_payload.checkRunId }} | ||
#################################################### | ||
# Actually, we'll just sleep to simulate some work | ||
#################################################### | ||
- name: Processing | ||
run: sleep 10 | ||
|
||
##################################################### | ||
# Send a final message to complete the run and | ||
# provide any final updates. Doing this one in JSON | ||
# to make it more readable. This approach can also | ||
# be used to get total control over the serialized | ||
# data types (for example, integers). | ||
##################################################### | ||
- name: Complete Check | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
gh api -X PATCH -H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{ github.repository }}/check-runs/${{ github.event.client_payload.checkRunId }} \ | ||
--input - <<- EOF | ||
{ | ||
"conclusion": "success", | ||
"details_url": "TODO", | ||
"output": { | ||
"title": "Integration Tests", | ||
"summary": "**Summary**: The run completed.", | ||
"text": "Everything worked as expected." | ||
} | ||
} | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Integration Tests Validation | ||
|
||
# To trigger the check | ||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
start-check: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
checks: write # Permission to create a Check Run | ||
contents: write # Permission to write a repository_dispatch requests | ||
steps: | ||
- name: Integration Tests Check | ||
id: testcheck # An ID to allow the step to be referenced | ||
env: | ||
GH_TOKEN: ${{ github.token }} # Expose the token for GH CLI | ||
run: | | ||
########################################################## | ||
# Create a Check Run and indicate that it is being queued | ||
# Use --jq to return the ID | ||
########################################################## | ||
CHECKID=$(gh api -X POST -H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-f name='Integration Tests Check' \ | ||
-f head_sha='${{ github.event.pull_request.head.sha }}' \ | ||
-f status='queued' \ | ||
-f 'output[title]=Integration Tests' \ | ||
-f 'output[summary]=Pending Integration Tests for Py SDK' \ | ||
--jq '.id' \ | ||
/repos/${{ github.repository }}/check-runs) | ||
#################################################### | ||
# Put the ID into a step variable | ||
#################################################### | ||
echo "checkId=$CHECKID" >> $GITHUB_OUTPUT | ||
- name: Trigger Integration Tests | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
########################################################## | ||
# Create a repository_dispatch event of type my-check | ||
# Send the SHA and the Check Run ID in the client_payload | ||
########################################################## | ||
gh api -X POST -H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-f 'event_type=integration-check' \ | ||
-f 'client_payload[checkRunId]=${{ steps.testcheck.outputs.checkId }}' \ | ||
-f 'client_payload[sha]=${{ github.sha }}' \ | ||
/repos/${{ github.repository }}/dispatches |