-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (57 loc) · 1.79 KB
/
test.yml
File metadata and controls
72 lines (57 loc) · 1.79 KB
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
name: Test
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main
- dev
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
# Only run on push to main OR pull_request events (not both)
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.17.1"
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run unit tests
run: yarn test
- name: Run unit tests with coverage
run: yarn test:coverage
storybook-tests:
name: Storybook Tests
runs-on: ubuntu-latest
# Only run on push to main OR pull_request events (not both)
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.17.1"
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install Playwright browsers
run: yarn playwright install --with-deps
- name: Start Storybook
run: |
yarn storybook &
# Give it some initial time to start
sleep 5
- name: Wait for Storybook to be ready
run: |
timeout 120 bash -c 'until curl -s http://localhost:6006 > /dev/null; do sleep 2; done'
- name: Run Storybook tests
run: yarn test:storybook
env:
STORYBOOK_URL: http://localhost:6006