Fix CI failures: Update Playwright configuration and resolve snapshot test issues #595
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: [develop] | |
push: | |
branches: [stable, develop] | |
workflow_dispatch: | |
inputs: | |
reason: | |
description: Why was the workflow triggered manually? | |
required: true | |
type: string | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Run build and unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js and install NPM dependencies | |
uses: ./.github/actions/install-npm-deps | |
- name: Check code format | |
run: npm run format | |
- name: Lint | |
run: | | |
npm run lint | |
- name: Build | |
run: | | |
npm run build:lib | |
npm run build:demo -- --progress=false | |
npm run build:example -- --progress=false | |
- name: Test | |
run: | | |
npm run test:lib | |
npm run test:demo | |
npm run test:example | |
- name: Upload library build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-ng-in-viewport | |
path: dist/ng-in-viewport | |
- name: Upload demo application build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-demo | |
path: dist/demo | |
- name: Upload example application build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-example | |
path: dist/example | |
- name: Upload code coverage report to Codecov | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage/ng-in-viewport/lcov.info | |
flags: unittests | |
e2e: | |
name: Run E2E tests | |
needs: build | |
strategy: | |
matrix: | |
project: ['demo', 'example'] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js and install NPM dependencies | |
uses: ./.github/actions/install-npm-deps | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifacts-${{ matrix.project }} | |
path: dist/${{ matrix.project }} | |
- name: Install Playwright browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npm run e2e | |
- name: Upload Playwright test results | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: failed-e2e-${{ matrix.project }}-test-results | |
path: test-results/ |