1616 - ' package.json'
1717 - ' yarn.lock'
1818
19+ env :
20+ NODE_VERSION : 20.x # LTS version
21+
1922jobs :
2023 build :
2124 runs-on : ubuntu-latest
2225 steps :
2326 - uses : actions/checkout@v4
24-
2527 - uses : volta-cli/action@v4
28+ with :
29+ node-version : ${{ env.NODE_VERSION }}
30+ yarn-version : 3.6.4
2631
2732 # Add yarn cache
2833 - name : Get yarn cache directory path
@@ -34,38 +39,19 @@ jobs:
3439 id : yarn-cache
3540 with :
3641 path : ${{ steps.yarn-cache-dir-path.outputs.dir }}
37- key : ${{ runner.os }}-node-${{ matrix.node-version }} -yarn-${{ hashFiles('**/yarn.lock') }}
42+ key : ${{ runner.os }}-node-lts -yarn-${{ hashFiles('**/yarn.lock') }}
3843 restore-keys : |
39- ${{ runner.os }}-node-${{ matrix.node-version }} -yarn-
40- ${{ runner.os }}-node-${{ matrix.node-version }} -
44+ ${{ runner.os }}-node-lts -yarn-
45+ ${{ runner.os }}-node-lts -
4146 ${{ runner.os }}-
42-
43- # Add build cache
44- - name : Cache build output
45- uses : actions/cache@v3
46- with :
47- path : |
48- **/dist
49- **/build
50- **/.cache
51- **/public
52- key : ${{ runner.os }}-node-${{ matrix.node-version }}-build-${{ github.sha }}
53- restore-keys : |
54- ${{ runner.os }}-node-${{ matrix.node-version }}-build-
55- ${{ runner.os }}-node-${{ matrix.node-version }}-
56- ${{ runner.os }}-
57-
58- - run : yarn
5947
48+ - run : yarn
6049 - name : Build
6150 run : yarn build
62-
6351 - name : Lint
6452 run : yarn lint
65-
6653 - name : Test
6754 run : yarn test
68-
6955 - name : Cypress
7056 uses : cypress-io/github-action@v6
7157 with :
@@ -75,22 +61,30 @@ jobs:
7561 browser : chrome
7662 wait-on : ' http://localhost:8000'
7763 wait-on-timeout : 120
78- cache-key : cypress-${{ runner.os }}-node-${{ matrix.node-version }} -${{ hashFiles('**/yarn.lock') }}
64+ cache-key : cypress-${{ runner.os }}-node-lts -${{ hashFiles('**/yarn.lock') }}
7965 env :
8066 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
8167
82- node -compatibility :
68+ ts -compatibility :
8369 needs : build
8470 runs-on : ubuntu-latest
71+ continue-on-error : ${{ matrix.experimental }}
8572 strategy :
8673 fail-fast : false
8774 matrix :
88- node-version : [16.x, 18.x, 20.x]
75+ typescript-version : [beta, next]
76+ include :
77+ - typescript-version : beta
78+ experimental : false
79+ name : ' ts-beta'
80+ - typescript-version : next
81+ experimental : true
82+ name : ' ts-canary'
8983 steps :
9084 - uses : actions/checkout@v4
9185 - uses : volta-cli/action@v4
9286 with :
93- node-version : ${{ matrix.node-version }}
87+ node-version : ${{ env.NODE_VERSION }}
9488 yarn-version : 3.6.4
9589
9690 # Add yarn cache
@@ -103,17 +97,27 @@ jobs:
10397 id : yarn-cache
10498 with :
10599 path : ${{ steps.yarn-cache-dir-path.outputs.dir }}
106- key : ${{ runner.os }}-node-${{ matrix.node -version }}-yarn-${{ hashFiles('**/yarn.lock') }}
100+ key : ${{ runner.os }}-node-lts-ts- ${{ matrix.typescript -version }}-yarn-${{ hashFiles('**/yarn.lock') }}
107101 restore-keys : |
108- ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-
109- ${{ runner.os }}-node-${{ matrix.node-version }}-
102+ ${{ runner.os }}-node-lts-ts-${{ matrix.typescript-version }}-yarn-
103+ ${{ runner.os }}-node-lts-ts-${{ matrix.typescript-version }}-
104+ ${{ runner.os }}-node-lts-
110105 ${{ runner.os }}-
111106
112107 - run : yarn
108+
109+ - name : Installing TypeScript ${{ matrix.typescript-version }}
110+ run : yarn workspaces foreach --exclude hello-ts --exclude '@mike-north/typescript-courses' -vpi add -D typescript@${{ matrix.typescript-version }}
111+
113112 - name : Build
114113 run : yarn build
114+
115+ - name : Type-check website
116+ run : yarn postinstall && yarn typecheck
117+
115118 - name : Test
116119 run : yarn test
120+
117121 - name : Cypress
118122 uses : cypress-io/github-action@v6
119123 with :
@@ -123,93 +127,19 @@ jobs:
123127 browser : chrome
124128 wait-on : ' http://localhost:8000'
125129 wait-on-timeout : 120
126- cache-key : cypress-${{ runner.os }}-node-${{ matrix.node -version }}-${{ hashFiles('**/yarn.lock') }}
130+ cache-key : cypress-${{ runner.os }}-node-lts-ts- ${{ matrix.typescript -version }}-${{ hashFiles('**/yarn.lock') }}
127131 env :
128132 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
129133
130- os-compatibility :
131- needs : build
132- runs-on : ${{ matrix.os }}
133- strategy :
134- fail-fast : false
135- matrix :
136- include :
137- - os : windows-latest
138- node-version : 20
139- - os : ubuntu-latest
140- node-version : 20
141- steps :
142- - uses : actions/checkout@v4
143- - uses : volta-cli/action@v4
144- with :
145- node-version : ${{ matrix.node-version }}
146- yarn-version : 3.6.4
147-
148- # Add yarn cache
149- - name : Get yarn cache directory path
150- id : yarn-cache-dir-path
151- run : echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
152-
153- - name : Restore yarn cache
154- uses : actions/cache@v3
155- id : yarn-cache
156- with :
157- path : ${{ steps.yarn-cache-dir-path.outputs.dir }}
158- key : ${{ matrix.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
159- restore-keys : |
160- ${{ matrix.os }}-node-${{ matrix.node-version }}-yarn-
161- ${{ matrix.os }}-node-${{ matrix.node-version }}-
162- ${{ matrix.os }}-
163-
164- ts-compatibility :
165- needs : build
166- runs-on : ubuntu-latest
167- continue-on-error : ${{ matrix.experimental }}
168- strategy :
169- fail-fast : false
170- matrix :
171- node-version : [20.x]
172- typescript-version : [beta, next]
173- include :
174- - typescript-version : beta
175- experimental : false
176- name : ' ts-beta'
177- - typescript-version : next
178- experimental : true
179- name : ' ts-canary'
180- steps :
181- - uses : actions/checkout@v4
182- - uses : volta-cli/action@v4
183- with :
184- node-version : ${{ matrix.node-version }}
185- yarn-version : 3.6.4
186-
187- # Add yarn cache
188- - name : Get yarn cache directory path
189- id : yarn-cache-dir-path
190- run : echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
191-
192- - name : Restore yarn cache
193- uses : actions/cache@v3
194- id : yarn-cache
195- with :
196- path : ${{ steps.yarn-cache-dir-path.outputs.dir }}
197- key : ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
198- restore-keys : |
199- ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}-yarn-
200- ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}-
201- ${{ runner.os }}-node-${{ matrix.node-version }}-
202- ${{ runner.os }}-
203-
204134 publish :
205- needs : [build, os-compatibility, node-compatibility, ts-compatibility]
135+ needs : [build, ts-compatibility]
206136 runs-on : ubuntu-latest
207137 if : success() && github.ref == 'refs/heads/main'
208138 steps :
209139 - uses : actions/checkout@v4
210140 - uses : volta-cli/action@v4
211141 with :
212- node-version : 20.x
142+ node-version : ${{ env.NODE_VERSION }}
213143 yarn-version : 3.6.4
214144
215145 # Add yarn cache
@@ -222,17 +152,15 @@ jobs:
222152 id : yarn-cache
223153 with :
224154 path : ${{ steps.yarn-cache-dir-path.outputs.dir }}
225- key : ${{ runner.os }}-node-20 -yarn-${{ hashFiles('**/yarn.lock') }}
155+ key : ${{ runner.os }}-node-lts -yarn-${{ hashFiles('**/yarn.lock') }}
226156 restore-keys : |
227- ${{ runner.os }}-node-20 -yarn-
228- ${{ runner.os }}-node-20 -
157+ ${{ runner.os }}-node-lts -yarn-
158+ ${{ runner.os }}-node-lts -
229159 ${{ runner.os }}-
230160
231161 - run : yarn
232-
233162 - name : Build
234163 run : yarn workspace website run build-prod
235-
236164 - uses : peaceiris/actions-gh-pages@v3
237165 with :
238166 github_token : ${{ secrets.ACCESS_TOKEN }}
0 commit comments