@@ -3,16 +3,44 @@ name: "UI Tests"
3
3
on : push
4
4
5
5
jobs :
6
+ # Install and cache npm dependencies
7
+ install-cache :
8
+ runs-on : ubuntu-latest
9
+ steps :
10
+ - name : Checkout Commit
11
+ uses : actions/checkout@v2
12
+ - name : Cache yarn dependencies and cypress
13
+ uses : actions/cache@v2
14
+ id : yarn-cache
15
+ with :
16
+ path : |
17
+ ~/.cache/Cypress
18
+ node_modules
19
+ key : ${{ runner.os }}-yarn-v1-${{ hashFiles('**/yarn.lock') }}
20
+ restore-keys : |
21
+ ${{ runner.os }}-yarn-v1
22
+ - name : Install dependencies if cache invalid
23
+ if : steps.yarn-cache.outputs.cache-hit != 'true'
24
+ run : yarn
6
25
# Run interaction and accessibility tests
7
26
interaction-and-accessibility :
8
27
runs-on : ubuntu-latest
28
+ needs : install-cache
9
29
steps :
10
30
- uses : actions/checkout@v2
11
31
- uses : actions/setup-node@v2
12
32
with :
13
33
node-version : " 16.x"
14
- - name : Install dependencies
15
- run : yarn
34
+ - name : Restore yarn dependencies
35
+ uses : actions/cache@v2
36
+ id : yarn-cache
37
+ with :
38
+ path : |
39
+ ~/.cache/Cypress
40
+ node_modules
41
+ key : ${{ runner.os }}-yarn-v1-${{ hashFiles('**/yarn.lock') }}
42
+ restore-keys : |
43
+ ${{ runner.os }}-yarn-v1
16
44
- name : Install Playwright
17
45
run : npx playwright install --with-deps
18
46
- name : Build Storybook
@@ -25,12 +53,21 @@ jobs:
25
53
# Run visual and composition tests with Chromatic
26
54
visual-and-composition :
27
55
runs-on : ubuntu-latest
56
+ needs : install-cache
28
57
steps :
29
58
- uses : actions/checkout@v2
30
59
with :
31
60
fetch-depth : 0 # Required to retrieve git history
32
- - name : Install dependencies
33
- run : yarn
61
+ - name : Restore yarn dependencies
62
+ uses : actions/cache@v2
63
+ id : yarn-cache
64
+ with :
65
+ path : |
66
+ ~/.cache/Cypress
67
+ node_modules
68
+ key : ${{ runner.os }}-yarn-v1-${{ hashFiles('**/yarn.lock') }}
69
+ restore-keys : |
70
+ ${{ runner.os }}-yarn-v1
34
71
- name : Publish to Chromatic
35
72
uses : chromaui/action@v1
36
73
with :
@@ -39,10 +76,19 @@ jobs:
39
76
# Run user flow tests with Cypress
40
77
user-flow :
41
78
runs-on : ubuntu-latest
79
+ needs : install-cache
42
80
steps :
43
81
- uses : actions/checkout@v2
44
- - name : Install dependencies
45
- run : yarn
82
+ - name : Restore yarn dependencies
83
+ uses : actions/cache@v2
84
+ id : yarn-cache
85
+ with :
86
+ path : |
87
+ ~/.cache/Cypress
88
+ node_modules
89
+ key : ${{ runner.os }}-yarn-v1-${{ hashFiles('**/yarn.lock') }}
90
+ restore-keys : |
91
+ ${{ runner.os }}-yarn-v1
46
92
- name : Cypress run
47
93
uses : cypress-io/github-action@v4
48
94
with :
0 commit comments