From ce1f4efea7115e82bd94141afc312da366326b8d Mon Sep 17 00:00:00 2001 From: Mutasem Aldmour <4711238+mutdmour@users.noreply.github.com> Date: Tue, 17 Jan 2023 13:44:19 +0100 Subject: [PATCH] test: Add e2e tests for PRs (#5176) * test: add e2e tests for PRs * test: update condition * test: update job * test: update with label --- .github/workflows/e2e-tests-pr.yml | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/e2e-tests-pr.yml diff --git a/.github/workflows/e2e-tests-pr.yml b/.github/workflows/e2e-tests-pr.yml new file mode 100644 index 000000000..ad21fa770 --- /dev/null +++ b/.github/workflows/e2e-tests-pr.yml @@ -0,0 +1,59 @@ +name: PR E2E (skip with label skip-e2e) + +on: + pull_request_review: + types: [submitted] + branch: + - 'master' + +jobs: + runTests: + name: 'Run E2E tests' + runs-on: ubuntu-latest + if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-e2e') }} + + timeout-minutes: 30 + + strategy: + matrix: + node-version: [16.x] + + steps: + - name: 'Cancel previous runs' + uses: styfle/cancel-workflow-action@0.9.0 + with: + access_token: ${{ github.token }} + + - name: 'Cancel if PR is not approved' + if: github.event.review.state != 'approved' + uses: andymckay/cancel-action@0.2 + + - uses: actions/checkout@v3 + + - uses: pnpm/action-setup@v2.2.4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build + run: pnpm build + + - name: Test E2E + run: | + pnpm cypress:install + pnpm test:e2e:all + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + if: failure() + with: + name: cypress-screenshots + path: | + cypress/screenshots + retention-days: 1