@@ -17,24 +17,55 @@ jobs:
17
17
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
18
18
if : " !startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
19
19
20
- lint-and-typecheck :
21
- name : Running TypeScript compiler & ESLint
20
+ prepare-yarn-cache :
21
+ name : Prepare yarn cache
22
22
runs-on : ubuntu-latest
23
23
24
24
steps :
25
25
- uses : actions/checkout@v2
26
+
27
+
28
+ with :
29
+ node-version : 14.x
30
+
26
31
- name : Get yarn cache
27
32
id : yarn-cache
28
33
run : echo "::set-output name=dir::$(yarn config get cacheFolder)"
34
+
29
35
- uses : actions/cache@v2
30
36
with :
31
37
path : ${{ steps.yarn-cache.outputs.dir }}
32
- key : ubuntu-latest-node-12.x-yarn- ${{ hashFiles('**/ yarn.lock') }}
38
+ key : yarn2- ${{ hashFiles('yarn.lock') }}
33
39
restore-keys : |
34
- ubuntu-latest-node-12.x-yarn-
40
+ yarn2-
41
+
42
+ - name : Validate cache
43
+ env :
44
+ # Use PnP and disable postinstall scripts as this just needs to
45
+ # populate the cache for the other jobs
46
+ YARN_NODE_LINKER : pnp
47
+ YARN_ENABLE_SCRIPTS : false
48
+ run : yarn --immutable
49
+
50
+ lint-and-typecheck :
51
+ name : Running TypeScript compiler & ESLint
52
+ runs-on : ubuntu-latest
53
+ needs : prepare-yarn-cache
54
+
55
+ steps :
56
+ - uses : actions/checkout@v2
35
57
36
58
with :
37
59
node-version : 12.x
60
+ - name : Get yarn cache
61
+ id : yarn-cache
62
+ run : echo "::set-output name=dir::$(yarn config get cacheFolder)"
63
+ - uses : actions/cache@v2
64
+ with :
65
+ path : ${{ steps.yarn-cache.outputs.dir }}
66
+ key : yarn2-${{ hashFiles('yarn.lock') }}
67
+ restore-keys : |
68
+ yarn2-
38
69
- name : install
39
70
run : yarn --immutable
40
71
- name : build
57
88
node-version : [10.x, 12.x, 14.x, 15.x]
58
89
os : [ubuntu-latest, macOS-latest, windows-latest]
59
90
runs-on : ${{ matrix.os }}
91
+ needs : prepare-yarn-cache
60
92
61
93
steps :
62
94
- name : Set git config
@@ -66,19 +98,19 @@ jobs:
66
98
git config --global core.symlinks true
67
99
if : runner.os == 'Windows'
68
100
- uses : actions/checkout@v2
101
+ - name : Use Node.js ${{ matrix.node-version }}
102
+
103
+ with :
104
+ node-version : ${{ matrix.node-version }}
69
105
- name : Get yarn cache
70
106
id : yarn-cache
71
107
run : echo "::set-output name=dir::$(yarn config get cacheFolder)"
72
108
- uses : actions/cache@v2
73
109
with :
74
110
path : ${{ steps.yarn-cache.outputs.dir }}
75
- key : ${{ runner.os }}-node- ${{ matrix.node-version }}-yarn-${{ hashFiles('**/ yarn.lock') }}
111
+ key : yarn2- ${{ hashFiles('yarn.lock') }}
76
112
restore-keys : |
77
- ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-
78
- - name : Use Node.js ${{ matrix.node-version }}
79
-
80
- with :
81
- node-version : ${{ matrix.node-version }}
113
+ yarn2-
82
114
- name : install
83
115
run : yarn --immutable
84
116
- name : build
88
120
uses : SimenB/github-actions-cpu-cores@v1
89
121
- name : run tests
90
122
run : yarn test-ci-partial:parallel --max-workers ${{ steps.cpu-cores.outputs.count }}
91
- env :
92
- CI : true
93
123
94
124
test-jasmine :
95
125
name : Node LTS on ${{ matrix.os }} using jest-jasmine2
98
128
matrix :
99
129
os : [ubuntu-latest, macOS-latest, windows-latest]
100
130
runs-on : ${{ matrix.os }}
131
+ needs : prepare-yarn-cache
101
132
102
133
steps :
103
134
- name : Set git config
@@ -107,19 +138,19 @@ jobs:
107
138
git config --global core.symlinks true
108
139
if : runner.os == 'Windows'
109
140
- uses : actions/checkout@v2
141
+ - name : Use Node.js 14.x
142
+
143
+ with :
144
+ node-version : 14.x
110
145
- name : Get yarn cache
111
146
id : yarn-cache
112
147
run : echo "::set-output name=dir::$(yarn config get cacheFolder)"
113
148
- uses : actions/cache@v2
114
149
with :
115
150
path : ${{ steps.yarn-cache.outputs.dir }}
116
- key : ${{ runner.os }}-node-14.x-yarn- ${{ hashFiles('**/ yarn.lock') }}
151
+ key : yarn2- ${{ hashFiles('yarn.lock') }}
117
152
restore-keys : |
118
- ${{ runner.os }}-node-14.x-yarn-
119
- - name : Use Node.js 14.x
120
-
121
- with :
122
- node-version : 14.x
153
+ yarn2-
123
154
- name : install
124
155
run : yarn --immutable
125
156
- name : build
@@ -129,5 +160,3 @@ jobs:
129
160
uses : SimenB/github-actions-cpu-cores@v1
130
161
- name : run tests using jest-jasmine
131
162
run : yarn jest-jasmine-ci --max-workers ${{ steps.cpu-cores.outputs.count }}
132
- env :
133
- CI : true
0 commit comments