Skip to content

Commit 03bdccb

Browse files
authored
ci: make more efficient (#848)
1 parent 82e219c commit 03bdccb

File tree

1 file changed

+45
-13
lines changed

1 file changed

+45
-13
lines changed

.github/workflows/nodejs.yml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,50 @@ jobs:
4040
YARN_ENABLE_SCRIPTS: false
4141
run: yarn --immutable
4242

43+
prettier:
44+
needs: prepare-yarn-cache
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
- name: Get yarn cache
49+
id: yarn-cache
50+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
51+
- uses: actions/cache@v2
52+
with:
53+
path: ${{ steps.yarn-cache.outputs.dir }}
54+
key: yarn2-${{ hashFiles('yarn.lock') }}
55+
restore-keys: |
56+
yarn2-
57+
- uses: actions/[email protected]
58+
with:
59+
node-version: 14.x
60+
- name: install
61+
run: yarn
62+
- name: run prettier
63+
run: yarn prettier:check
64+
65+
typecheck:
66+
needs: prepare-yarn-cache
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v2
70+
- name: Get yarn cache
71+
id: yarn-cache
72+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
73+
- uses: actions/cache@v2
74+
with:
75+
path: ${{ steps.yarn-cache.outputs.dir }}
76+
key: yarn2-${{ hashFiles('yarn.lock') }}
77+
restore-keys: |
78+
yarn2-
79+
- uses: actions/[email protected]
80+
with:
81+
node-version: 14.x
82+
- name: install
83+
run: yarn
84+
- name: run typecheck
85+
run: yarn typecheck
86+
4387
test-node:
4488
name:
4589
# prettier-ignore
@@ -54,8 +98,6 @@ jobs:
5498

5599
steps:
56100
- uses: actions/checkout@v2
57-
with:
58-
fetch-depth: 0
59101
- name: Get yarn cache
60102
id: yarn-cache
61103
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
@@ -73,10 +115,6 @@ jobs:
73115
run: |
74116
yarn
75117
yarn add --dev eslint@${{matrix.eslint-version }}
76-
- name: run prettier
77-
run: yarn prettier:check
78-
- name: run typecheck
79-
run: yarn typecheck
80118
- name: run tests
81119
# only collect coverage on eslint versions that support the suggestions api
82120
run: yarn test --coverage ${{ matrix.eslint-version >= 6 }}
@@ -109,10 +147,6 @@ jobs:
109147
node-version: 14.x
110148
- name: install
111149
run: yarn
112-
- name: run prettier
113-
run: yarn prettier:check
114-
- name: run typecheck
115-
run: yarn typecheck
116150
- name: run tests
117151
run: yarn test --coverage
118152
env:
@@ -124,8 +158,6 @@ jobs:
124158
runs-on: ubuntu-latest
125159
steps:
126160
- uses: actions/checkout@v2
127-
with:
128-
fetch-depth: 0
129161
- name: Get yarn cache
130162
id: yarn-cache
131163
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
@@ -153,7 +185,7 @@ jobs:
153185
# prettier-ignore
154186
${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
155187
name: Release new version
156-
needs: [test-node, test-os]
188+
needs: [prettier, typecheck, test-node, test-os]
157189
runs-on: ubuntu-latest
158190
steps:
159191
- uses: actions/checkout@v2

0 commit comments

Comments
 (0)