forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
236 lines (195 loc) · 8.38 KB
/
pr.yml
File metadata and controls
236 lines (195 loc) · 8.38 KB
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
231
232
233
234
235
236
name: CI
on:
push:
branches:
- master
pull_request:
concurrency:
# see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NX_PARALLEL: 6 # ubuntu-latest = 4-core CPU / 16 GB of RAM | macos-14-xlarge (arm) = 6-core CPU / 14 GB of RAM
NX_PREFER_TS_NODE: true
NX_VERBOSE_LOGGING: true
BROWSERSLIST_IGNORE_OLD_DATA: true
DEPLOY_HOST: fluentuipr.z22.web.core.windows.net
DEPLOY_URL: https://fluentuipr.z22.web.core.windows.net/${{ github.event.pull_request.number || github.ref_name }}
DEPLOY_BASE_PATH: ${{ github.event.pull_request.number != '' && format('pull/{0}', github.event.pull_request.number) || format('heads/{0}', github.ref_name) }}
jobs:
main:
if: ${{ github.repository_owner == 'microsoft' }}
runs-on: macos-14-xlarge
permissions:
contents: 'read'
actions: 'read'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@dbe0650947e5f2c81f59190a38512cf49126fe6b # v4.3.0
with:
main-branch-name: 'master'
- uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version: '20'
- run: echo number of CPUs "$(getconf _NPROCESSORS_ONLN)"
- run: yarn install --frozen-lockfile
- name: Workspace lint
run: |
yarn nx run workspace-plugin:check-graph
yarn nx g @fluentui/workspace-plugin:tsconfig-base-all --verify
yarn nx g @fluentui/workspace-plugin:normalize-package-dependencies --verify
- name: Type-check just.config.ts files
run: |
# following packages need to be build in advance:
# @fluentui/api-docs is used within apps/public-docsite-resources/just.config.ts,
# @fluentui/digest is used within packages/fluentui/perf-test-northstar/just.config.ts, thus it needs to be build in advance
#
# NOTE: we are running this via nx in order to get cache hits later on
yarn nx run-many -t build -p api-docs digest
yarn tsc -p ./tsconfig.just-scripts-configs.json
- name: 'check packages: installed dependencies versions'
run: |
yarn check:installed-dependencies-versions
- name: check formatting
run: |
yarn nx format:check --base origin/master
- name: build, test, lint, test-ssr (affected)
run: |
FLUENT_JEST_WORKER=2 yarn nx affected -t build test lint type-check test-ssr test-integration verify-packaging --exclude react-19-tests-v9 --nxBail
- name: 'Check for unstaged changes'
run: |
git status --porcelain
git diff-index --quiet HEAD -- || exit 1
react_integration_tests:
if: ${{ github.repository_owner == 'microsoft' }}
runs-on: ubuntu-latest
strategy:
matrix:
react: [18, 19]
fluentui: [8, 9]
exclude:
- react: 19
fluentui: 8
fail-fast: false
permissions:
contents: 'read'
actions: 'read'
name: React ${{ matrix.react }} / v${{ matrix.fluentui }} Integration
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@dbe0650947e5f2c81f59190a38512cf49126fe6b # v4.3.0
with:
main-branch-name: 'master'
- uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version: '20'
- run: echo number of CPUs "$(getconf _NPROCESSORS_ONLN)"
- run: yarn install --frozen-lockfile
- name: Verify Cypress install
run: yarn cypress verify
- name: Affected e2e:integration Projects
id: affected_projects_e2e_count
run: |
affected_count=$(yarn --silent nx show projects -t e2e:integration --affected --verbose false | wc -l | tr -d ' ')
echo "value=$affected_count" >> $GITHUB_OUTPUT
- name: Affected type-check:integration Projects
id: affected_projects_type_check_count
run: |
affected_count=$(yarn --silent nx show projects -t type-check:integration --affected --verbose false | wc -l | tr -d ' ')
echo "value=$affected_count" >> $GITHUB_OUTPUT
- name: type-check (affected)
id: type-check
if: steps.affected_projects_type_check_count.outputs.value > 0
run: yarn nx run-many -p react-${{ matrix.react }}-tests-v${{ matrix.fluentui }} -t type-check:integration --nxBail
continue-on-error: true
- name: Prepare TSC logs
if: always() && steps.type-check.outcome == 'failure'
run: |
mkdir -p tsc-logs
yarn tsc -p apps/react-${{ matrix.react }}-tests-v${{ matrix.fluentui }}/tsconfig.react-${{ matrix.react }}.json --listFilesOnly > tsc-logs/tsc-debug-files-map.md
- name: Upload TSC logs
if: always() && steps.type-check.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: typescript-react-${{ matrix.react }}-v${{ matrix.fluentui }}
path: tsc-logs
retention-days: 1
# run targets only on affected changes - need to run this outside nx runner context to avoid https://github.com/nrwl/nx/issues/30562
- name: e2e (affected)
id: e2e
if: steps.affected_projects_e2e_count.outputs.value > 0
run: |
yarn workspace @fluentui/react-${{ matrix.react }}-tests-v${{ matrix.fluentui }} e2e:integration
echo $?
continue-on-error: true
- name: Upload Cypress screenshots if exist
uses: actions/upload-artifact@v4
if: always() && steps.e2e.outcome == 'failure'
with:
name: cypress-screenshots-react-${{ matrix.react }}-v${{ matrix.fluentui }}
path: |
apps/*/cypress/screenshots/**/*.png
packages/**/cypress/screenshots/**/*.png
retention-days: 1
- name: Integration tests summary
if: always()
run: |
echo "### React ${{ matrix.react }} / v${{ matrix.fluentui }} Integration Tests Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- Type-check: ${{ steps.type-check.outcome }}" >> $GITHUB_STEP_SUMMARY
echo "- E2E: ${{ steps.e2e.outcome }}" >> $GITHUB_STEP_SUMMARY
if [[ "${{ steps.type-check.outcome }}" == "success" && "${{ steps.e2e.outcome }}" == "success" ]]; then
echo "✅ React ${{ matrix.react }} / v${{ matrix.fluentui }} integration tests passed"
exit 0
else
echo "❌ React ${{ matrix.react }} / v${{ matrix.fluentui }} integration tests failed"
echo "Type-check: ${{ steps.type-check.outcome }}"
echo "E2E: ${{ steps.e2e.outcome }}"
exit 1
fi
e2e:
if: ${{ github.repository_owner == 'microsoft' }}
# TODO: switch to macos once problematic tests are fixed
# https://github.com/microsoft/fluentui/issues/33173
# https://github.com/microsoft/fluentui/issues/33172
runs-on: ubuntu-latest
permissions:
contents: 'read'
actions: 'read'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@dbe0650947e5f2c81f59190a38512cf49126fe6b # v4.3.0
with:
main-branch-name: 'master'
- uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version: '20'
- run: echo number of CPUs "$(getconf _NPROCESSORS_ONLN)"
- run: yarn install --frozen-lockfile
- name: Install Playwright dependencies
run: yarn playwright install --with-deps
- name: Verify Cypress install
run: yarn cypress verify
- name: Cypress/Playwright E2E tests
run: yarn nx affected -t e2e --exclude react-19-tests-v9 --nxBail --parallel 1
- name: Upload Cypress screenshots if exist
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: |
apps/*/cypress/screenshots/**/*.png
packages/**/cypress/screenshots/**/*.png
retention-days: 1