-
Notifications
You must be signed in to change notification settings - Fork 3
137 lines (122 loc) · 3.67 KB
/
ui-test.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: UI Test
on:
pull_request:
branches:
- main
- 'develop'
paths:
- 'ui/**'
- '!ui/**/**.md'
workflow_dispatch:
jobs:
unit-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
ui
fetch-depth: 1
- name: Read .nvmrc
working-directory: ./ui
run: |
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm
- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- name: Install dependencies
working-directory: ./ui
run: |
npm ci
- name: Run UI unit tests
working-directory: ./ui
run: |
npm run test
storybook-preview:
runs-on: ubuntu-22.04
outputs:
url: ${{ steps.deploy-preview.outputs.deploy-url }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
ui
fetch-depth: 1
- name: Read .nvmrc
working-directory: ./ui
run: |
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm
- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- name: Install dependencies
working-directory: ./ui
run: |
npm ci
- name: Build Storybook
working-directory: ./ui
run: |
npm run build-storybook --quiet
- name: Deploy preview to Netlify
id: deploy-preview
uses: nwtgck/[email protected]
with:
publish-dir: './ui/storybook-static'
production-branch: develop
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'Deploy Storybook Preview'
enable-github-deployment: false
enable-pull-request-comment: false
enable-commit-comment: false
overwrites-pull-request-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
- name: Comment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🚀 Storybook preview: [${{ steps.deploy-preview.outputs.deploy-url }}](${{ steps.deploy-preview.outputs.deploy-url }})'
})
interaction-test:
runs-on: ubuntu-22.04
needs: storybook-preview
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
ui
fetch-depth: 1
- name: Read .nvmrc
working-directory: ./ui
run: |
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm
- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- name: Install dependencies
working-directory: ./ui
run: npm ci
- name: Install Playwright
working-directory: ./ui
run: npx playwright install --with-deps
- name: Run Storybook tests
working-directory: ./ui
run: npm run test-storybook
env:
TARGET_URL: '${{ needs.storybook-preview.outputs.url }}'