Skip to content

Commit

Permalink
Improve cypress.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lokeshwar777 committed Jun 7, 2024
1 parent c019233 commit 53b1dc9
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
name: Cypress Tests
on: [push]
name: Cypress End-to-End Tests

on: push

jobs:
cypress-run:
cypress-tests:
name: Run Cypress Tests
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node: [18, 20, 22]
containers: [1, 2, 3, 4, 5]

name: E2E Testing with Cypress
node: [18]
containers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

env:
CI: false

steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Cache Node.js modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -51,9 +50,8 @@ jobs:
- name: Prepare Firebase Service Account
run: |
cd functions
mkdir -p private
echo "${{ secrets.FIREBASE_SERVICE_ACCOUNT_CODELABZ_2CD64 }}" > private/cl-dev-pk.json
mkdir -p functions/private
echo "${{ secrets.FIREBASE_SERVICE_ACCOUNT_CODELABZ_2CD64 }}" > functions/private/cl-dev-pk.json
- name: Install Functions Dependencies
run: cd functions && npm install --legacy-peer-deps
Expand All @@ -69,37 +67,46 @@ jobs:
- name: Run Cypress Tests
uses: cypress-io/github-action@v6
with:
browser: chrome
record: true
tag: node-${{ matrix.node }}
parallel: true
config-file: cypress.config.js
group: "GitHub Actions"
install-command: npm install --legacy-peer-deps
# build: npm run build
build: npm run build
start: npm run dev
wait-on: "http://localhost:5173"
browser: chrome
record: true
parallel: true
tag: node-${{ matrix.node }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_INFO_BRANCH: ${{ github.ref_name }}

print-results:
name: Print Cypress Cloud URL
needs: cypress-tests
runs-on: ubuntu-latest
if: always()
steps:
- name: Print Cypress Cloud URL
run: |
echo Cypress finished with: ${{ needs.cypress-tests.outcome }}
echo See results at ${{ needs.cypress-tests.outputs.resultsUrl }}
handle-failure:
name: Handle Failure
if: ${{ failure() }}
runs-on: ubuntu-latest
steps:
- name: Upload Cypress Artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: Cypress Artifacts
path: |
cypress/screenshots
cypress/videos/
- name: Print Cypress Cloud URL
if: always()
run: |
echo Cypress finished with: ${{ steps.cypress.outcome }}
echo See results at ${{ steps.cypress.outputs.resultsUrl }}
cypress/videos
if-no-files-found: ignore

- name: Notify on Failure
if: failure()
run: echo "The workflow has failed!"

0 comments on commit 53b1dc9

Please sign in to comment.