88 branches :
99 - main
1010
11- jobs :
12- install-dependencies :
13- runs-on : ubuntu-latest
14- steps :
15- - name : Checkout code
16- uses : actions/checkout@v4
17-
18- - name : Setup Node.js
19- uses : actions/setup-node@v4
20- with :
21- node-version : ' 18.20.5'
22- cache : ' yarn'
23-
24- - name : Cache dependencies
25- uses : actions/cache@v4
26- with :
27- path : |
28- node_modules
29- sample/node_modules
30- key : ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('sample/yarn.lock') }}
31- restore-keys : |
32- ${{ runner.os }}-deps-
33-
34- - name : Install dependencies
35- run : |
36- yarn install --frozen-lockfile
37- yarn install --cwd sample --frozen-lockfile
38-
39- - name : Inject env file
40- run : |
41- echo "export const APP_ID = 'app_id';" >> sample/src/env.ts
42- echo "export const INITIAL_ROUTE = 'route';" >> sample/src/env.ts
43-
44- - name : Upload workspace
45- uses : actions/upload-artifact@v4
46- with :
47- name : workspace
48- path : .
49- retention-days : 1
11+ # Define common setup steps template
12+ .common_steps : &common_steps
13+ - name : Checkout code
14+ uses : actions/checkout@v4
15+ - name : Setup Node.js
16+ uses : actions/setup-node@v4
17+ with :
18+ node-version : ' 18.20.5'
19+ cache : ' yarn'
20+ - name : Install dependencies
21+ run : |
22+ yarn install --frozen-lockfile
23+ yarn install --cwd sample --frozen-lockfile
24+ - name : Inject env file
25+ run : |
26+ echo "export const APP_ID = 'app_id';" >> sample/src/env.ts
27+ echo "export const INITIAL_ROUTE = 'route';" >> sample/src/env.ts
5028
29+ jobs :
5130 lint :
52- needs : install-dependencies
5331 runs-on : ubuntu-latest
5432 steps :
55- - name : Download workspace
56- uses : actions/download-artifact@v4
57- with :
58- name : workspace
59-
60- - name : Setup Node.js
61- uses : actions/setup-node@v4
62- with :
63- node-version : ' 18.20.5'
64-
65- - name : Lint files
33+ << : *common_steps
34+ - name : Run linting
6635 run : yarn lint
6736
6837 typescript :
69- needs : install-dependencies
7038 runs-on : ubuntu-latest
7139 steps :
72- - name : Download workspace
73- uses : actions/download-artifact@v4
74- with :
75- name : workspace
76-
77- - name : Setup Node.js
78- uses : actions/setup-node@v4
79- with :
80- node-version : ' 18.20.5'
81-
82- - name : Typecheck files
40+ << : *common_steps
41+ - name : TypeScript check
8342 run : yarn typescript
8443
8544 sample-typescript :
86- needs : install-dependencies
8745 runs-on : ubuntu-latest
8846 steps :
89- - name : Download workspace
90- uses : actions/download-artifact@v4
91- with :
92- name : workspace
93-
94- - name : Setup Node.js
95- uses : actions/setup-node@v4
96- with :
97- node-version : ' 18.20.5'
98-
99- - name : Typecheck sample files
47+ << : *common_steps
48+ - name : Sample TypeScript check
10049 run : yarn sample:tsc
10150
10251 unit-tests :
103- needs : install-dependencies
10452 runs-on : ubuntu-latest
10553 steps :
106- - name : Download workspace
107- uses : actions/download-artifact@v4
108- with :
109- name : workspace
110-
111- - name : Setup Node.js
112- uses : actions/setup-node@v4
113- with :
114- node-version : ' 18.20.5'
115-
54+ << : *common_steps
11655 - name : Run unit tests
11756 run : yarn test --coverage
118-
11957 - name : Upload coverage reports
12058 uses : actions/upload-artifact@v4
12159 with :
12260 name : coverage
12361 path : coverage
12462
12563 build-package :
126- needs : install-dependencies
12764 runs-on : ubuntu-latest
12865 steps :
129- - name : Download workspace
130- uses : actions/download-artifact@v4
131- with :
132- name : workspace
133-
134- - name : Setup Node.js
135- uses : actions/setup-node@v4
136- with :
137- node-version : ' 18.20.5'
138-
66+ << : *common_steps
13967 - name : Build package
140- run : yarn build
68+ run : yarn build
0 commit comments