From e4356283a8854b56e85e06c65b2db4b1a00951af Mon Sep 17 00:00:00 2001 From: OlegIvaniv Date: Thu, 27 Apr 2023 13:09:50 +0200 Subject: [PATCH] ci: Additionally checkout PR head for e2e tests (no-changelog) (#6105) * ci: Do not force branch for PR e2e smoke tests * Use commit SHA for smoke test * Debug: Echo git before running e2e * Debugging: Create local merge commit * Use container with git installed * Debugging: Manual git checkout PR * Do not skip checkout * Use container with git installed * Add breaking test, install git manualyl * Use sudo * Use container with git preinstalled * Remove debugging e2e --- .github/workflows/ci-pull-requests.yml | 5 +++-- .github/workflows/e2e-reusable.yml | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-pull-requests.yml b/.github/workflows/ci-pull-requests.yml index 5895e8d82b..e6d4cdabd7 100644 --- a/.github/workflows/ci-pull-requests.yml +++ b/.github/workflows/ci-pull-requests.yml @@ -112,12 +112,13 @@ jobs: name: E2E [Electron/Node 16] uses: ./.github/workflows/e2e-reusable.yml with: - branch: ${{ github.event.pull_request.head.ref }} + branch: ${{ github.event.pull_request.base.ref }} user: ${{ github.event.inputs.user || 'PR User' }} spec: ${{ github.event.inputs.spec || 'e2e/0-smoke.cy.ts' }} - run-env: base:16.18.1 + run-env: browsers:node16.18.0-chrome107-ff106-edge record: false parallel: false + pr_number: ${{ github.event.number }} containers: '[1]' secrets: CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} diff --git a/.github/workflows/e2e-reusable.yml b/.github/workflows/e2e-reusable.yml index df2b04a058..45b842044b 100644 --- a/.github/workflows/e2e-reusable.yml +++ b/.github/workflows/e2e-reusable.yml @@ -7,7 +7,6 @@ on: description: 'GitHub branch to test.' required: false type: string - default: 'master' user: description: 'User who kicked this off.' required: false @@ -43,6 +42,10 @@ on: required: false default: '[1, 2, 3, 4, 5, 6, 7, 8]' type: string + pr_number: + description: 'PR number to run tests for.' + required: false + type: number secrets: CYPRESS_RECORD_KEY: description: 'Cypress record key.' @@ -79,6 +82,12 @@ jobs: repository: n8n-io/n8n ref: ${{ inputs.branch }} + - name: Checkout PR + if: ${{ inputs.pr_number }} + run: | + git fetch origin pull/${{ inputs.pr_number }}/head + git checkout FETCH_HEAD + - name: Setup pnpm uses: pnpm/action-setup@v2.2.4 with: @@ -123,6 +132,12 @@ jobs: repository: n8n-io/n8n ref: ${{ inputs.branch }} + - name: Checkout PR + if: ${{ inputs.pr_number }} + run: | + git fetch origin pull/${{ inputs.pr_number }}/head + git checkout FETCH_HEAD + - name: Setup pnpm uses: pnpm/action-setup@v2.2.4