11name : Test
22
33on :
4- - push
5- - pull_request
6- - workflow_dispatch
7-
8- env :
9- CI : true
4+ push :
5+ pull_request :
6+ workflow_dispatch :
7+ schedule :
8+ - cron : 30 1/6 * * *
109
1110jobs :
1211 prepare :
1817 - name : Set up Node
1918 uses : actions/setup-node@v2
2019 with :
21- node-version : 14
22- - id : random
23- name : Generate UUID
24- run : echo "::set-output name=value::$(openssl rand -hex 10)"
20+ node-version : 16
2521 - id : cache
2622 name : Yarn Cache Dir
2723 run : echo "::set-output name=value::$(yarn cache dir)"
@@ -31,15 +27,14 @@ jobs:
3127 uses : actions/cache@v2
3228 with :
3329 path : yarn.lock
34- key : yarn-lock-${{ runner.os }}-${{ steps.random.outputs.value }}
30+ key : yarn-lock-${{ runner.os }}-${{ github.sha }}
3531 - name : Prepare Cache
3632 uses : actions/cache@v2
3733 with :
3834 path : ${{ steps.cache.outputs.value }}
39- key : yarn-cache-${{ runner.os }}-${{ steps.random.outputs.value }}-node-14
35+ key : yarn-cache-${{ runner.os }}-${{ github.sha }}-node-16
4036
4137 outputs :
42- random-uuid : ${{ steps.random.outputs.value }}
4338 cache-dir : ${{ steps.cache.outputs.value }}
4439
4540 build :
@@ -53,17 +48,17 @@ jobs:
5348 - name : Set up Node
5449 uses : actions/setup-node@v2
5550 with :
56- node-version : 14
51+ node-version : 16
5752 - name : Restore Lockfile
5853 uses : actions/cache@v2
5954 with :
6055 path : yarn.lock
61- key : yarn-lock-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}
56+ key : yarn-lock-${{ runner.os }}-${{ github.sha }}
6257 - name : Restore Cache
6358 uses : actions/cache@v2
6459 with :
6560 path : ${{ needs.prepare.outputs.cache-dir }}
66- key : yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}-node-14
61+ key : yarn-cache-${{ runner.os }}-${{ github.sha }}-node-16
6762 - name : Install
6863 run : yarn
6964 - name : Build JS
8176 plugins
8277
8378 lint :
79+ if : ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
8480 runs-on : ubuntu-latest
8581 needs :
8682 - prepare
@@ -91,23 +87,24 @@ jobs:
9187 - name : Set up Node
9288 uses : actions/setup-node@v2
9389 with :
94- node-version : 14
90+ node-version : 16
9591 - name : Restore Lockfile
9692 uses : actions/cache@v2
9793 with :
9894 path : yarn.lock
99- key : yarn-lock-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}
95+ key : yarn-lock-${{ runner.os }}-${{ github.sha }}
10096 - name : Restore Cache
10197 uses : actions/cache@v2
10298 with :
10399 path : ${{ needs.prepare.outputs.cache-dir }}
104- key : yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}-node-14
100+ key : yarn-cache-${{ runner.os }}-${{ github.sha }}-node-16
105101 - name : Install
106102 run : yarn
107103 - name : Lint
108104 run : yarn lint
109105
110106 unit-test :
107+ if : ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
111108 runs-on : ubuntu-latest
112109 needs :
113110 - prepare
@@ -128,20 +125,20 @@ jobs:
128125 uses : actions/cache@v2
129126 with :
130127 path : yarn.lock
131- key : yarn-lock-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}
128+ key : yarn-lock-${{ runner.os }}-${{ github.sha }}
132129 - name : Restore Cache
133130 uses : actions/cache@v2
134131 with :
135132 path : ${{ needs.prepare.outputs.cache-dir }}
136- key : yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}-node-${{ matrix.node-version }}
133+ key : yarn-cache-${{ runner.os }}-${{ github.sha }}-node-${{ matrix.node-version }}
137134 restore-keys : |
138- yarn-lock-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}-node
135+ yarn-lock-${{ runner.os }}-${{ github.sha }}-node
139136 - name : Install
140137 run : yarn
141138 - name : Build JS
142139 run : yarn compile
143140 - name : Unit Test
144- run : yarn test:json --mongo-ports=27017 --mysql-ports=3306,3307,3308
141+ run : yarn test:json
145142 - name : Report Coverage
146143 if : ${{ matrix.node-version == 14 }}
147144 uses : codecov/codecov-action@v1
@@ -150,45 +147,6 @@ jobs:
150147 file : ./coverage/coverage-final.json
151148 name : codecov
152149
153- publish :
154- if : ${{ github.ref == 'refs/heads/master' }}
155- runs-on : ubuntu-latest
156- needs :
157- - prepare
158- - build
159- - unit-test
160-
161- env :
162- GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
163-
164- steps :
165- - name : Check out
166- uses : actions/checkout@v3
167- - name : Create .npmrc
168- run : ' echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc'
169- - name : Set up Node
170- uses : actions/setup-node@v2
171- with :
172- node-version : 14
173- - name : Restore Lockfile
174- uses : actions/cache@v2
175- with :
176- path : yarn.lock
177- key : yarn-lock-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}
178- - name : Restore Cache
179- uses : actions/cache@v2
180- with :
181- path : ${{ needs.prepare.outputs.cache-dir }}
182- key : yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}-node-14
183- - name : Install
184- run : yarn
185- - name : Download
186- uses : actions/download-artifact@v3
187- with :
188- name : packages
189- - name : Publish
190- run : yarn pub
191-
192150 docs :
193151 if : ${{ github.ref == 'refs/heads/master' }}
194152 runs-on : ubuntu-latest
@@ -202,17 +160,17 @@ jobs:
202160 - name : Set up Node
203161 uses : actions/setup-node@v2
204162 with :
205- node-version : 14
163+ node-version : 16
206164 - name : Restore Lockfile
207165 uses : actions/cache@v2
208166 with :
209167 path : yarn.lock
210- key : yarn-lock-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}
168+ key : yarn-lock-${{ runner.os }}-${{ github.sha }}
211169 - name : Restore Cache
212170 uses : actions/cache@v2
213171 with :
214172 path : ${{ needs.prepare.outputs.cache-dir }}
215- key : yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}-node-14
173+ key : yarn-cache-${{ runner.os }}-${{ github.sha }}-node-16
216174 - name : Install
217175 run : yarn
218176 - name : Download
@@ -263,17 +221,17 @@ jobs:
263221 - name : Set up Node
264222 uses : actions/setup-node@v2
265223 with :
266- node-version : 14
224+ node-version : 16
267225 - name : Restore Lockfile
268226 uses : actions/cache@v2
269227 with :
270228 path : yarn.lock
271- key : yarn-lock-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}
229+ key : yarn-lock-${{ runner.os }}-${{ github.sha }}
272230 - name : Restore Cache
273231 uses : actions/cache@v2
274232 with :
275233 path : ${{ needs.prepare.outputs.cache-dir }}
276- key : yarn-cache-${{ runner.os }}-${{ needs.prepare.outputs.random-uuid }}-node-14
234+ key : yarn-cache-${{ runner.os }}-${{ github.sha }}-node-16
277235 - name : Install
278236 run : yarn
279237 - name : Download
0 commit comments