-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github action to run e2e command "on-demand" (#2241)
Signed-off-by: Jorge Turrado <jorge.turrado@docplanner.com>
- Loading branch information
Jorge Turrado Ferrero
authored
Nov 5, 2021
1 parent
b6fde28
commit bedf867
Showing
5 changed files
with
134 additions
and
7 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,104 @@ | ||
name: pr-e2e-tests | ||
concurrency: e2e-tests | ||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: ghcr.io/kedacore/build-tools:main | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: khan/pull-request-comment-trigger@master | ||
id: check-comment | ||
with: | ||
trigger: '/run-e2e' | ||
reaction: rocket | ||
prefix_only: true | ||
env: | ||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | ||
|
||
- name: Check user permission | ||
if: steps.check-comment.outputs.triggered == 'true' | ||
id: check-permission | ||
uses: scherermichael-oss/action-has-permission@master | ||
with: | ||
required-permission: write | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Checkout Pull Request | ||
if: steps.check-comment.outputs.triggered == 'true' && steps.check-permission.outputs.has-permission | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
id: checkout | ||
run: | | ||
PR_URL="${{ github.event.issue.pull_request.url }}" | ||
PR_NUM=${PR_URL##*/} | ||
echo "Checking out from PR #$PR_NUM based on URL: $PR_URL" | ||
hub pr checkout $PR_NUM | ||
echo "::set-output name=pr_num::$PR_NUM" | ||
- name: Login to GitHub Container Registry | ||
if: steps.check-comment.outputs.triggered == 'true' && steps.check-permission.outputs.has-permission | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish on GitHub Container Registry | ||
if: steps.check-comment.outputs.triggered == 'true' && steps.check-permission.outputs.has-permission | ||
run: make publish | ||
env: | ||
E2E_IMAGE_TAG: "pr-${{ steps.checkout.outputs.pr_num }}" | ||
|
||
- name: Run end to end tests | ||
continue-on-error: true | ||
if: steps.check-comment.outputs.triggered == 'true' && steps.check-permission.outputs.has-permission | ||
id: test | ||
env: | ||
AZURE_SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION }} | ||
AZURE_RESOURCE_GROUP: ${{ secrets.AZURE_RESOURCE_GROUP }} | ||
AZURE_SP_ID: ${{ secrets.AZURE_SP_ID }} | ||
AZURE_SP_KEY: ${{ secrets.AZURE_SP_KEY }} | ||
AZURE_SP_TENANT: ${{ secrets.AZURE_SP_TENANT }} | ||
TEST_STORAGE_CONNECTION_STRING: ${{ secrets.TEST_STORAGE_CONNECTION_STRING }} | ||
TEST_LOG_ANALYTICS_WORKSPACE_ID: ${{ secrets.TEST_LOG_ANALYTICS_WORKSPACE_ID }} | ||
OPENSTACK_USER_ID: ${{ secrets.OPENSTACK_USER_ID }} | ||
OPENSTACK_PASSWORD: ${{ secrets.OPENSTACK_PASSWORD }} | ||
OPENSTACK_PROJECT_ID: ${{ secrets.OPENSTACK_PROJECT_ID }} | ||
OPENSTACK_AUTH_URL: ${{ secrets.OPENSTACK_AUTH_URL }} | ||
AZURE_DEVOPS_BUILD_DEFINITON_ID: ${{ secrets.AZURE_DEVOPS_BUILD_DEFINITON_ID }} | ||
AZURE_DEVOPS_ORGANIZATION_URL: ${{ secrets.AZURE_DEVOPS_ORGANIZATION_URL }} | ||
AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} | ||
AZURE_DEVOPS_POOL_NAME: ${{ secrets.AZURE_DEVOPS_POOL_NAME }} | ||
AZURE_DEVOPS_PROJECT: ${{ secrets.AZURE_DEVOPS_PROJECT }} | ||
E2E_IMAGE_TAG: "pr-${{ steps.checkout.outputs.pr_num }}" | ||
run: | | ||
MESSAGE="${{ github.event.comment.body }}" | ||
REGEX='/run-e2e (.+)' | ||
if [[ "$MESSAGE" =~ $REGEX ]] | ||
then | ||
export E2E_TEST_REGEX="${BASH_REMATCH[1]}" | ||
fi | ||
echo "${{ steps.checkout.outputs.pr_num }}" | ||
make e2e-test | ||
- name: React to comment with success | ||
uses: dkershner6/reaction-action@v1 | ||
if: steps.test.outcome == 'success' | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commentId: ${{ github.event.comment.id }} | ||
reaction: "+1" | ||
|
||
- name: React to comment with failure | ||
uses: dkershner6/reaction-action@v1 | ||
if: steps.test.outcome != 'success' | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commentId: ${{ github.event.comment.id }} | ||
reaction: "-1" |
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
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
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
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