Skip to content

adapt

adapt #1498

Workflow file for this run

name: Tests
on: [push]
defaults:
run:
working-directory: ./components
jobs:
linter:
name: Run checks and build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('components/**/package-lock.json') }}
- name: Install npm packages
run: npm ci && npm run generate-manifest
- name: Check format
run: npm run check-format
- name: Check types
run: npm run check-types
- name: Check dependencies
run: npm run check-dependencies
- name: Run linter
run: npm run lint
- name: Build
run: npm run build
unit_tests:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('components/**/package-lock.json') }}
- name: Install npm packages
run: npm ci
- name: Run unit test
run: npm run test
storybook_tests:
name: Run storybook tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('components/**/package-lock.json') }}
- name: Install npm packages
run: |
npm ci
npm run generate-manifest
- name: Get Installed Playwright Version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').packages['node_modules/playwright'].version)")" >> $GITHUB_ENV
- name: Cache Playwright Browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- name: Install Playwright Browsers and System Dependencies
run: npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Install only System Dependencies
run: npx playwright install-deps
if: steps.playwright-cache.outputs.cache-hit == 'true'
- name: build Storybook
run: npm run build-storybook -- --quiet
- name: build Preact Storybook
run: npm run build-storybook-preact -- --quiet
- name: Start Storybook server
run:
npx http-server storybook-static --port 6006 --silent &
npx http-server storybook-static-preact --port 6007 --silent &
- name: Wait for Preact Storybook server to be ready
run: npx wait-on tcp:6007
- name: Run Preact Storybook tests
run: npm run test:storybook:preact
- name: Wait for Storybook server to be ready
run: npx wait-on tcp:6006
- name: Run Storybook tests
run: npm run test:storybook
- name: Run Playwright tests
run: npm run test:playwright
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: components/playwright-report/
retention-days: 7