-
Notifications
You must be signed in to change notification settings - Fork 40
86 lines (68 loc) · 2.5 KB
/
test_react_component_library.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Test React components library
on:
pull_request:
paths:
- packages/react-components/**
workflow_dispatch:
# Cancel any currently running builds to save GitHub Actions hours.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
jest-unit-tests:
name: Jest unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Read .nvmrc
run: echo "GITHUB_NVMRC_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV
working-directory: ./packages/react-components
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.GITHUB_NVMRC_VERSION }}
- name: Install dependencies
run: npm install
working-directory: ./packages/react-components
# Errors in lint process will cause this job to fail
- name: Lint
run: npm run lint
working-directory: ./packages/react-components
- name: Run test suite
run: npm run test:ci
working-directory: ./packages/react-components
# Treat failures in the Vite build as test failures.
# We don't need to keep the artifact of this build,
# we just care that it completes successfully.
- name: Run Vite build
run: npm run vite-build
working-directory: ./packages/react-components
playwright-accessibility-tests:
name: Playwright accessibility tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Read .nvmrc
run: echo "GITHUB_NVMRC_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV
working-directory: ./packages/react-components
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.GITHUB_NVMRC_VERSION }}
- name: Install dependencies
run: npm install
working-directory: ./packages/react-components
- name: Install Playwright
run: npx playwright install --with-deps
working-directory: ./packages/react-components
- name: Build Storybook
run: npm run storybook-build
working-directory: ./packages/react-components
- name: Serve Storybook and run tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:6006 && npm run test-storybook:ci"
working-directory: ./packages/react-components