From 8fe9ee04c8cc71c981e75ef1fec44e379f1be5d6 Mon Sep 17 00:00:00 2001 From: Rob DiCiuccio Date: Wed, 16 Dec 2020 10:45:21 -0800 Subject: [PATCH] build(cypress): Use pull_request_target event to run cypress (#11750) * Use pull_request_target event to run cypress in order to access repo secrets * Summary job for branch protection requirements * Restore pull_request trigger * Use merge base for e2e tests * Restore push trigger for all branches --- .github/workflows/superset-e2e.yml | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/superset-e2e.yml b/.github/workflows/superset-e2e.yml index 578a7d2d69..5499d39fb2 100644 --- a/.github/workflows/superset-e2e.yml +++ b/.github/workflows/superset-e2e.yml @@ -1,13 +1,18 @@ name: E2E -on: [push, pull_request] +on: [push, pull_request, pull_request_target] jobs: - Cypress: + cypress-matrix: runs-on: ubuntu-18.04 strategy: - fail-fast: true + # when one test fails, DO NOT cancel the other + # containers, because this will kill Cypress processes + # leaving the Dashboard hanging ... + # https://github.com/cypress-io/github-action/issues/48 + fail-fast: false matrix: + containers: [1, 2, 3] browser: ["chrome"] env: FLASK_ENV: development @@ -34,8 +39,14 @@ jobs: uses: styfle/cancel-workflow-action@0.6.0 with: access_token: ${{ github.token }} - - name: Checkout code + - name: Checkout code (push) + if: github.event_name == 'push' uses: actions/checkout@v2 + - name: Checkout code (pull_request) + if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' + uses: actions/checkout@v2 + with: + ref: 'refs/pull/${{ github.event.number }}/merge' - name: Setup Python uses: actions/setup-python@v2 with: @@ -89,3 +100,12 @@ jobs: with: name: screenshots path: ${{ github.workspace }}/superset-frontend/cypress-base/cypress/screenshots + Cypress: + if: ${{ always() }} + name: Cypress (chrome) + runs-on: ubuntu-18.04 + needs: cypress-matrix + steps: + - name: Check build matrix status + if: ${{ needs.cypress-matrix.result != 'success' }} + run: exit 1