Skip to content

.github/workflows/playwright.yml #14584

.github/workflows/playwright.yml

.github/workflows/playwright.yml #14584

Workflow file for this run

on:
merge_group:
types:
- checks_requested
pull_request:
# We do not run tests on master as the changes were already tested when opening a PR,
# and we require every PR to be up-to-date before merging it to master.
types:
- opened
- synchronize
- reopened
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
jobs:
playwright-test:
strategy:
fail-fast: false
matrix:
repository:
- '@adeira/abacus-backoffice'
- '@adeira/abacus-kochka'
- '@adeira/abacus-tools'
- '@adeira/sx-design'
- '@adeira/typescript-test'
- 'mrtnzlml-meta'
include:
- repository: '@adeira/abacus-backoffice'
source: 'src/abacus-backoffice/**'
playwrightReportName: 'playwright-report-abacus-backoffice'
playwrightReportPath: 'src/abacus-backoffice/playwright/test-results/'
- repository: '@adeira/abacus-kochka'
source: 'src/abacus-kochka/**'
playwrightReportName: 'playwright-report-abacus-kochka'
playwrightReportPath: 'src/abacus-kochka/playwright/test-results/'
- repository: '@adeira/abacus-tools'
source: 'src/abacus-tools/**'
playwrightReportName: 'playwright-report-abacus-tools'
playwrightReportPath: 'src/abacus-tools/playwright/test-results/'
- repository: '@adeira/sx-design'
source: 'src/sx-design/**'
playwrightReportName: 'playwright-report-sx-design'
playwrightReportPath: 'src/sx-design/playwright/test-results/'
- repository: '@adeira/typescript-test'
source: 'src/typescript-test/**'
playwrightReportName: 'playwright-report-typescript-test'
playwrightReportPath: 'src/typescript-test/playwright/test-results/'
- repository: 'mrtnzlml-meta'
source: 'src/mrtnzlml-meta/**'
playwrightReportName: 'playwright-report-mrtnzlml-meta'
playwrightReportPath: 'src/mrtnzlml-meta/playwright/test-results/'
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- uses: actions/checkout@v4.1.5
# https://github.com/dorny/paths-filter
- uses: dorny/paths-filter@v3.0.2
id: paths-filter
with:
filters: |
src: ${{ matrix.source }}
# https://github.com/actions/setup-node
- name: Use Node.js 20.x
if: steps.paths-filter.outputs.src == 'true'
uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
cache: 'yarn'
- name: Install Yarn dependencies
if: steps.paths-filter.outputs.src == 'true'
run: yarn install --immutable
- name: Install Playwright
if: steps.paths-filter.outputs.src == 'true'
run: yarn workspace ${{ matrix.repository }} playwright install --with-deps
- name: Run Playwright tests
if: steps.paths-filter.outputs.src == 'true'
run: yarn workspace ${{ matrix.repository }} playwright test
env:
# See: https://github.com/storybookjs/storybook/issues/16555
# TODO: remove when no longer needed
NODE_OPTIONS: --openssl-legacy-provider
# https://github.com/actions/upload-artifact
- name: Upload Playwright test results
if: always()
uses: actions/upload-artifact@v4.3.3
with:
name: ${{ matrix.playwrightReportName }}
path: ${{ matrix.playwrightReportPath }}
# The purpose of this job is to wait for the completion of the `playwright-test` jobs (matrix)
# and evaluate whether the run was successful or not. This is useful when configuring the
# required jobs in GitHub UI (we can require just this one job instead of all the jobs in
# the test matrix).
playwright-test-results:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [playwright-test]
steps:
- run: |
result="${{ needs.playwright-test.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi