-
Notifications
You must be signed in to change notification settings - Fork 186
230 lines (193 loc) · 6.54 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
226
227
228
229
230
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 }}
docs_storybook: ${{ steps.changes.outputs.docs_storybook }}
dependencies: ${{ steps.changes.outputs.dependencies }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Find changes
uses: dorny/paths-filter@v3
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@v4
- name: Node setup
uses: ./.github/actions/node-setup
- 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@v4
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@v4
- name: Node setup
uses: ./.github/actions/node-setup
- name: Download Playwright blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: packages/vkui/artifacts
- name: Prepare downloaded Playwright blob reports for merging
run: |
mkdir all-blob-reports
if [ -d packages/vkui/artifacts ]; then
for i in {1..10}
do
mv packages/vkui/artifacts/all-blob-reports-$i-10/* all-blob-reports/
done
fi
rm -r packages/vkui/artifacts
shell: bash
- 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@v4
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@v4
- name: Node setup
uses: ./.github/actions/node-setup
- uses: andresz1/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: packages/vkui/
package_manager: yarn
# only affects current branch
skip_step: install
build_script: 'size:ci'
script: yarn run -T 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@v4
- name: Node setup
uses: ./.github/actions/node-setup
- name: Build
run: yarn run docs:styleguide:build
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: styleguide-dist
path: styleguide/dist
docs_storybook_upload:
if: ${{ needs.changed_files.outputs.docs_storybook == 'true' }}
needs: changed_files
runs-on: ubuntu-latest
name: Upload docs dist artifact (storybook)
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node setup
uses: ./.github/actions/node-setup
- name: Build
run: yarn docs:storybook:build
- name: Upload dist
uses: actions/upload-artifact@v4
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
check_dependencies:
if: ${{ needs.changed_files.outputs.dependencies == 'true' }}
needs: changed_files
runs-on: ubuntu-latest
name: Check dependencies
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
shell: bash
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable --check-cache --check-resolutions