Skip to content

Commit

Permalink
feat: activate e2e tests execution
Browse files Browse the repository at this point in the history
  • Loading branch information
aloisio-m-bastian committed Feb 13, 2025
1 parent 7bf11cd commit 9adc989
Showing 1 changed file with 123 additions and 123 deletions.
246 changes: 123 additions & 123 deletions .github/workflows/pre-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,123 +41,123 @@ jobs:
coverage/unit/sonar-report.xml
retention-days: 1

# run-prod-e2e-tests:
# name: Run Dev E2E Tests
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# group: [2, 3, 4, 5, 6, 7]
# steps:
# - uses: actions/checkout@v4

# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 18

# - name: Run Cypress Tests
# uses: cypress-io/github-action@v6
# env:
# PROD_CYPRESS_EMAIL: ${{ secrets.PROD_CYPRESS_EMAIL }}
# PROD_CYPRESS_PASSWORD: ${{ secrets.PROD_CYPRESS_PASSWORD }}
# VITE_ENVIRONMENT: 'production'
# with:
# build: yarn build
# start: yarn dev --logLevel=warn
# browser: chrome
# wait-on: 'http://localhost:5173/'
# wait-on-timeout: 120
# config-file: cypress.config.prod.js
# env: environment=prod,grepTags=@dev${{ matrix.group }}+-@xfail+-@dont_run_prod

# - name: Generate Specs JSON
# run: yarn generate-specs-json

# - name: Validate Specs Tags
# run: node ./scripts/check_tags.js specs.json

# - name: Move Coverage Files
# run: mv .nyc_output/out.json .nyc_output/out_${{ matrix.group }}.json

# - name: Upload Cypress Screenshots
# if: ${{ failure() }}
# uses: actions/upload-artifact@v4
# with:
# name: cypress_screenshots_${{ matrix.group }}
# path: cypress/screenshots
# retention-days: 4

# - name: Upload Cypress Videos
# if: ${{ failure() }}
# uses: actions/upload-artifact@v4
# with:
# name: cypress_videos_${{ matrix.group }}
# path: cypress/videos
# retention-days: 1

# - name: Upload Coverage Files
# uses: actions/upload-artifact@v4
# with:
# name: coverage_report_${{ matrix.group }}
# path: .nyc_output/*
# retention-days: 1
# include-hidden-files: true

# download_and_merge:
# name: Download and Merge Coverage Reports
# needs: run-prod-e2e-tests
# runs-on: ubuntu-latest

# steps:
# - name: Checkout Code
# uses: actions/checkout@v4

# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 18

# - name: Install Dependencies
# run: npm install --global nyc

# - name: Download Coverage Artifacts
# uses: actions/download-artifact@v4
# with:
# path: coverage_report
# pattern: coverage_report_*
# merge-multiple: true

# - name: Merge Coverage Reports
# run: npx nyc merge ./coverage_report .nyc_output/out.json

# - name: Generate Text Coverage Report
# run: npx nyc report --reporter=text-summary

# - name: Generate HTML Coverage Report
# run: npx nyc report --reporter=html --report-dir=./coverage/e2e

# - name: Generate LCOV Report
# run: npx nyc report --reporter=lcovonly --report-dir=./coverage/e2e

# - name: Check E2E Test Coverage
# if: ${{ always() }}
# run: node ./scripts/check_coverage.js ./coverage/e2e/lcov.info 20

# - name: Compress Coverage Reports
# if: ${{ always() }}
# run: zip -r coverage.zip coverage

# - name: Upload Coverage Report Artifact
# if: ${{ always() }}
# uses: actions/upload-artifact@v4
# with:
# name: coverage_e2e_report
# path: coverage.zip
# retention-days: 7
run-prod-e2e-tests:
name: Run Dev E2E Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
group: [2, 3, 4, 5, 6, 7]
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Run Cypress Tests
uses: cypress-io/github-action@v6
env:
PROD_CYPRESS_EMAIL: ${{ secrets.PROD_CYPRESS_EMAIL }}
PROD_CYPRESS_PASSWORD: ${{ secrets.PROD_CYPRESS_PASSWORD }}
VITE_ENVIRONMENT: 'production'
with:
build: yarn build
start: yarn dev --logLevel=warn
browser: chrome
wait-on: 'http://localhost:5173/'
wait-on-timeout: 120
config-file: cypress.config.prod.js
env: environment=prod,grepTags=@dev${{ matrix.group }}+-@xfail+-@dont_run_prod

- name: Generate Specs JSON
run: yarn generate-specs-json

- name: Validate Specs Tags
run: node ./scripts/check_tags.js specs.json

- name: Move Coverage Files
run: mv .nyc_output/out.json .nyc_output/out_${{ matrix.group }}.json

- name: Upload Cypress Screenshots
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress_screenshots_${{ matrix.group }}
path: cypress/screenshots
retention-days: 4

- name: Upload Cypress Videos
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress_videos_${{ matrix.group }}
path: cypress/videos
retention-days: 1

- name: Upload Coverage Files
uses: actions/upload-artifact@v4
with:
name: coverage_report_${{ matrix.group }}
path: .nyc_output/*
retention-days: 1
include-hidden-files: true

download_and_merge:
name: Download and Merge Coverage Reports
needs: run-prod-e2e-tests
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install Dependencies
run: npm install --global nyc

- name: Download Coverage Artifacts
uses: actions/download-artifact@v4
with:
path: coverage_report
pattern: coverage_report_*
merge-multiple: true

- name: Merge Coverage Reports
run: npx nyc merge ./coverage_report .nyc_output/out.json

- name: Generate Text Coverage Report
run: npx nyc report --reporter=text-summary

- name: Generate HTML Coverage Report
run: npx nyc report --reporter=html --report-dir=./coverage/e2e

- name: Generate LCOV Report
run: npx nyc report --reporter=lcovonly --report-dir=./coverage/e2e

- name: Check E2E Test Coverage
if: ${{ always() }}
run: node ./scripts/check_coverage.js ./coverage/e2e/lcov.info 20

- name: Compress Coverage Reports
if: ${{ always() }}
run: zip -r coverage.zip coverage

- name: Upload Coverage Report Artifact
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: coverage_e2e_report
path: coverage.zip
retention-days: 7

sonarcloud:
# needs: [run-tests, download_and_merge]
needs: [run-tests, download_and_merge]
needs: [run-tests]
runs-on: ubuntu-latest
steps:
Expand All @@ -169,15 +169,15 @@ jobs:
with:
name: coverage_unit_report

# - uses: actions/download-artifact@v4
# with:
# name: coverage_e2e_report
- uses: actions/download-artifact@v4
with:
name: coverage_e2e_report

# - name: Extract E2E Coverage Report
# run: |
# unzip coverage.zip -d coverage_e2e
# pwd
# find ./
- name: Extract E2E Coverage Report
run: |
unzip coverage.zip -d coverage_e2e
pwd
find ./
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@v2.3.0
Expand Down

0 comments on commit 9adc989

Please sign in to comment.