Split the workflow to trigger e2e test in 2 different jobs
name: pr-e2e-tests
-concurrency: e2e-tests
on:
issue_comment:
types: [created]
jobs:
- build:
+ check:
runs-on: ubuntu-latest
- container: ghcr.io/kedacore/build-tools:main
+ name: Comment evaluate
+ outputs:
+ run-e2e: ${{ steps.check-comment.outputs.triggered == 'true' && steps.check-permission.outputs.has-permission }}
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 }}'
@@ -29,8 +27,25 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Checkout Pull Request
+ - name: React to comment with rocket
+ uses: dkershner6/reaction-action@v1
if: steps.check-comment.outputs.triggered == 'true' && steps.check-permission.outputs.has-permission
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ commentId: ${{ github.event.comment.id }}
+ reaction: "rocket"
+
+ run-test:
+ needs: check
+ runs-on: ubuntu-latest
+ name: Execute e2e tests
+ container: ghcr.io/kedacore/build-tools:main
+ concurrency: e2e-tests
+ if: needs.check.outputs.run-e2e == '1'
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Checkout Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: checkout
@@ -42,7 +57,6 @@ jobs:
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
@@ -50,14 +64,12 @@ jobs:
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 }}
@@ -89,7 +101,7 @@ jobs:
- name: React to comment with success
uses: dkershner6/reaction-action@v1
- if: steps.check-comment.outputs.triggered == 'true' && steps.check-permission.outputs.has-permission && steps.test.outcome == 'success'
+ if: steps.test.outcome == 'success'
with:
token: ${{ secrets.GITHUB_TOKEN }}
commentId: ${{ github.event.comment.id }}
@@ -97,7 +109,7 @@ jobs:
- name: React to comment with failure
uses: dkershner6/reaction-action@v1
- if: steps.check-comment.outputs.triggered == 'true' && steps.check-permission.outputs.has-permission && steps.test.outcome != 'success'
+ if: steps.test.outcome != 'success'
with:
token: ${{ secrets.GITHUB_TOKEN }}
commentId: ${{ github.event.comment.id }}
