From bece92c4593f45fc0be3ccf3b63f4eecc31c3fb4 Mon Sep 17 00:00:00 2001 From: Rob DiCiuccio Date: Thu, 19 Nov 2020 10:03:58 -0800 Subject: [PATCH 1/5] Use pull_request_target event to run cypress in order to access repo secrets --- .github/workflows/superset-e2e.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/superset-e2e.yml b/.github/workflows/superset-e2e.yml index 2edc695dfdb7f..3f660bcc11abc 100644 --- a/.github/workflows/superset-e2e.yml +++ b/.github/workflows/superset-e2e.yml @@ -1,13 +1,22 @@ name: E2E -on: [push, pull_request] +on: + push: + branches: + - master + pull_request_target: jobs: Cypress: 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 @@ -30,8 +39,15 @@ jobs: ports: - 16379:6379 steps: - - name: Checkout code + - name: Checkout code (master) + if: github.event_name == 'push' uses: actions/checkout@v2 + - name: Checkout code (PR) + if: github.event_name == 'pull_request_target' + uses: actions/checkout@v2 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} - name: Setup Python uses: actions/setup-python@v2 with: From 55b1ed8cd0c32ca35231c10cd746cc81792c6068 Mon Sep 17 00:00:00 2001 From: Rob DiCiuccio Date: Tue, 15 Dec 2020 16:06:28 -0800 Subject: [PATCH 2/5] Summary job for branch protection requirements --- .github/workflows/superset-e2e.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/superset-e2e.yml b/.github/workflows/superset-e2e.yml index f184c33363f8d..9a98af91b9bf3 100644 --- a/.github/workflows/superset-e2e.yml +++ b/.github/workflows/superset-e2e.yml @@ -7,7 +7,7 @@ on: pull_request_target: jobs: - Cypress: + cypress-matrix: runs-on: ubuntu-18.04 strategy: # when one test fails, DO NOT cancel the other @@ -105,3 +105,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 From cc13b58994892c81f95e2521cc0432aa6edaf5b9 Mon Sep 17 00:00:00 2001 From: Rob DiCiuccio Date: Tue, 15 Dec 2020 16:51:10 -0800 Subject: [PATCH 3/5] Restore pull_request trigger --- .github/workflows/superset-e2e.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/superset-e2e.yml b/.github/workflows/superset-e2e.yml index 9a98af91b9bf3..3765bde2e8fdd 100644 --- a/.github/workflows/superset-e2e.yml +++ b/.github/workflows/superset-e2e.yml @@ -4,6 +4,7 @@ on: push: branches: - master + pull_request: pull_request_target: jobs: @@ -44,10 +45,10 @@ jobs: with: access_token: ${{ github.token }} - name: Checkout code (master) - if: github.event_name == "push" + if: github.event_name == 'push' uses: actions/checkout@v2 - name: Checkout code (PR) - if: github.event_name == "pull_request_target" + if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' uses: actions/checkout@v2 with: ref: ${{github.event.pull_request.head.ref}} From 9cbb40ecaf20ffe50dd8f5c59fa2e7b7c4b2c043 Mon Sep 17 00:00:00 2001 From: Rob DiCiuccio Date: Tue, 15 Dec 2020 20:17:35 -0800 Subject: [PATCH 4/5] Use merge base for e2e tests --- .github/workflows/superset-e2e.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/superset-e2e.yml b/.github/workflows/superset-e2e.yml index 3765bde2e8fdd..62411c233c9a3 100644 --- a/.github/workflows/superset-e2e.yml +++ b/.github/workflows/superset-e2e.yml @@ -51,8 +51,7 @@ jobs: if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' uses: actions/checkout@v2 with: - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} + ref: 'refs/pull/${{ github.event.number }}/merge' - name: Setup Python uses: actions/setup-python@v2 with: From 1bd3b80ff026b95afcc49fce86e1f26df6d86245 Mon Sep 17 00:00:00 2001 From: Rob DiCiuccio Date: Wed, 16 Dec 2020 09:03:50 -0800 Subject: [PATCH 5/5] Restore push trigger for all branches --- .github/workflows/superset-e2e.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/superset-e2e.yml b/.github/workflows/superset-e2e.yml index 62411c233c9a3..5499d39fb2948 100644 --- a/.github/workflows/superset-e2e.yml +++ b/.github/workflows/superset-e2e.yml @@ -1,11 +1,6 @@ name: E2E -on: - push: - branches: - - master - pull_request: - pull_request_target: +on: [push, pull_request, pull_request_target] jobs: cypress-matrix: @@ -44,10 +39,10 @@ jobs: uses: styfle/cancel-workflow-action@0.6.0 with: access_token: ${{ github.token }} - - name: Checkout code (master) + - name: Checkout code (push) if: github.event_name == 'push' uses: actions/checkout@v2 - - name: Checkout code (PR) + - name: Checkout code (pull_request) if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' uses: actions/checkout@v2 with: