-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (56 loc) · 2.07 KB
/
storybook-tests-on-push.yml
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
name: "Tests Storybook"
on: push
concurrency:
group: ${{ github.ref }} # This ensures that only one workflow runs per branch
cancel-in-progress: true # This cancels any previous runs in the same group
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Cache Build
id: cache-build
uses: actions/cache@v4
with:
path: dist
key: ${{ runner.os }}-build-${{ hashFiles('**/*.ts', '**/*.tsx', '**/*.mdx', '**/pnpm-lock.yaml') }} # Cache key based on OS and file hashes
restore-keys: |
${{ runner.os }}-build-
- name: Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: pnpm build
- name: Cache Storybook build
uses: actions/cache@v4
with:
path: storybook-static
key: ${{ runner.os }}-storybook-${{ hashFiles('**/*.ts', '**/*.tsx', '**/*.mdx', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-storybook-
- name: Build Storybook
run: pnpm build-storybook --quiet
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/*.ts', '**/*.tsx', '**/*.mdx', '**/pnpm-lock.yaml') }} # Cache key based on OS and file hashes
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright
run: npx playwright install --with-deps
- 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:127.0.0.1:6006 && pnpm test-storybook"