-
Notifications
You must be signed in to change notification settings - Fork 2
183 lines (182 loc) · 6.54 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Test
on: [push, pull_request]
jobs:
build_suite:
runs-on: ${{ matrix.os }}
name: Build - ${{ matrix.os }} - Node ${{ matrix.node }}
timeout-minutes: 30
strategy:
max-parallel: 4
matrix:
node: [18, 20]
os: [ubuntu-latest] #, windows-latest]
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 200
- name: Setup Node
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- name: Setup Cache
uses: actions/[email protected]
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-node${{ matrix.node }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Install Deps
run: |
npm install -g npm@8
npm ci
- name: Run Build
run: npx lerna run build
- name: Archive production artifacts
uses: actions/[email protected]
with:
name: build-${{matrix.os}}-${{matrix.node}}
path: |
packages/*/dist
test_suite:
needs: build_suite
runs-on: ${{ matrix.os }}
name: Test - ${{ matrix.os }} - Node ${{ matrix.node }}
timeout-minutes: 30
strategy:
max-parallel: 4
matrix:
node: [18, 20]
os: [ubuntu-latest] #, windows-latest]
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 200
- name: Setup Node
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- name: Setup Cache
uses: actions/[email protected]
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-node${{ matrix.node }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Install Deps
run: |
npm install -g npm@8
npm ci
- name: Download Build artifacts
uses: actions/[email protected]
with:
name: build-${{matrix.os}}-${{matrix.node}}
path: ./packages
- name: Run Test
run: npx lerna run test:coverage
- name: Retrieve Codecov Flag Name
id: 'flagname'
run: |
FLAGNAME=$(echo "${{ matrix.package.name }}" | sed -n -e 's/^.*\///p')
echo "::set-output name=flagname::${FLAGNAME}"
- name: Upload coverage to Codecov Monorepo
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit #${{ steps.flagname.outputs.flagname }}
directory: ${{ matrix.package.location }}
name: Test
fail_ci_if_error: false
verbose: false
lint_suite:
needs: build_suite
runs-on: ${{ matrix.os }}
name: Lint - ${{ matrix.os }} - Node ${{ matrix.node }}
timeout-minutes: 30
strategy:
max-parallel: 4
matrix:
node: [20]
os: [ubuntu-latest] #, windows-latest]
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 200
- name: Setup Node
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- name: Setup Cache
uses: actions/[email protected]
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-node${{ matrix.node }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Install Deps
run: |
npm install -g npm@8
npm ci
- name: Download Build artifacts
uses: actions/[email protected]
with:
name: build-${{matrix.os}}-${{matrix.node}}
path: ./packages
- name: Lint ALL Packages
run: npx lerna run lint
- name: Lint ALL Packages
run: npx lerna run eslint
- name: Lint ALL Packages
run: npx lerna run prettier
docs_suite:
needs: build_suite
runs-on: ${{ matrix.os }}
name: Docs - ${{ matrix.os }} - Node ${{ matrix.node }}
# only run docs on pull_requests and non feature branches
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' }}
timeout-minutes: 30
strategy:
max-parallel: 4
matrix:
node: [20]
os: [ubuntu-latest] #, windows-latest]
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 200
- name: Setup Node
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- name: Setup Cache
uses: actions/[email protected]
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-node${{ matrix.node }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Install Deps
run: |
npm install -g npm@8
npm ci
- name: Download Build artifacts
uses: actions/[email protected]
with:
name: build-${{matrix.os}}-${{matrix.node}}
path: ./packages
- name: Run Docs
run: npx lerna run docs
# run: npm run docs
- name: Build READMEs
run: npm run build:readme
finish:
needs: [test_suite, lint_suite, docs_suite]
name: Finish Test
runs-on: ubuntu-latest
if: ${{ !failure() && !cancelled() }}
steps:
- name: Coveralls Finished
run: echo "Test Finished"