-
Notifications
You must be signed in to change notification settings - Fork 186
225 lines (188 loc) · 6.36 KB
/
pull_request_packages.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: 'Pull Request / Packages'
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- '.husky/**'
- '.codesandbox/**'
- '.github/**'
- '!.github/actions/**'
- '.github/actions/**/*.yml'
- '**/*.md'
- '!packages/vkui/src/**/*.md'
- '!styleguide/pages/**/*.md'
- '**/__image_snapshots__/*.png'
concurrency:
group: pr-packages-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
changed_files:
runs-on: ubuntu-latest
name: Detect what files changed
outputs:
package_vkui: ${{ steps.changes.outputs.package_vkui }}
docs_styleguide: ${{ steps.changes.outputs.docs_styleguide }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Find changes
uses: dorny/paths-filter@v2
id: changes
with:
token: ${{ secrets.GITHUB_TOKEN }}
filters: .github/file-filters.yml
linters:
runs-on: ubuntu-latest
name: Run linters
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable
- name: Run Stylelint
run: yarn run lint:style
- name: Run types checking
run: yarn run lint:types
- name: Run ESLint
run: yarn run lint:es:ci
- name: Check if the generated files have been updated
run: yarn run lint:generated-files
- name: Report lint results
if: ${{ !cancelled() }}
uses: VKCOM/gh-actions/VKUI/reporter@main
test:
name: Call reusable workflow
uses: ./.github/workflows/reusable_workflow_test.yml
test_report:
if: ${{ !cancelled() && (success() || failure()) }}
needs: test
runs-on: ubuntu-latest
name: Report unit test results
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: test-output
- name: Report
uses: VKCOM/gh-actions/VKUI/reporter@main
test_e2e:
if: ${{ needs.changed_files.outputs.package_vkui == 'true' }}
needs: changed_files
name: Call reusable workflow
uses: ./.github/workflows/reusable_workflow_test_e2e.yml
test_e2e_prepare_and_upload_report:
if: ${{ !cancelled() && (success() || failure()) }}
needs: test_e2e
name: Prepare and upload e2e's HTML report artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable
- name: Download Playwright blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v3
with:
name: all-blob-reports
path: all-blob-reports
- name: Merge Playwright blob reports into HTML Report
run: yarn run playwright:cmd:merge-reports --reporter html ./all-blob-reports
- name: Upload Playwright HTML report to GitHub Actions Artifacts
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: playwright-report
retention-days: 30
analyze_bundle_size:
if: ${{ needs.changed_files.outputs.package_vkui == 'true' }}
needs: changed_files
runs-on: ubuntu-latest
name: Analyze bundle size
env:
CI_JOB_NUMBER: 1
# Для Dependabot
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable
- uses: andresz1/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# only affects current branch
skip_step: install
# В 1.7.0 пока нет этого свойства. См. packages/vkui/yarn.lock
# package_manager: yarn
build_script: 'size:ci'
script: /bin/bash -c "cd packages/vkui && npx size-limit --json"
docs_styleguide_upload:
if: ${{ needs.changed_files.outputs.docs_styleguide == 'true' }}
needs: changed_files
runs-on: ubuntu-latest
name: Upload docs dist artifact (styleguide)
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable
- name: Build
run: yarn run docs:styleguide:build
- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: styleguide-dist
path: styleguide/dist
docs_storybook_upload:
if: ${{ needs.changed_files.outputs.docs_styleguide == 'true' }}
needs: changed_files
runs-on: ubuntu-latest
name: Upload docs dist artifact (storybook)
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable
- name: Build
run: yarn docs:storybook:build
- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: storybook-dist
path: packages/vkui/storybook-static
upload_pr_workflow_payload:
# Дожидаемся выгрузки артефактов, на случай если вокрфлоу будет отменён или перезапушен
needs: [test, test_e2e_prepare_and_upload_report, docs_styleguide_upload, docs_storybook_upload]
# Не используем always(), т.к. он не учитывает отмену воркфлоу
# см. https://github.com/orgs/community/discussions/26303
if: ${{ !cancelled() }}
name: Call reusable workflow
uses: ./.github/workflows/reusable_workflow_pr_worfklow_payload.yml
with:
action: upload