-
Notifications
You must be signed in to change notification settings - Fork 196
597 lines (514 loc) · 22.7 KB
/
e2e-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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
name: E2E test
on:
workflow_dispatch:
inputs:
cases:
description: 'specific cases to be excuted. Sample: ["./aad/a.tests.ts", "./bot/b.tests.ts"]. Set empty to run all cases'
required: false
sample-branch:
description: "default is 'dev', options: 'main'"
required: true
type: string
default: 'dev'
target-testplan-id:
description: "target testplan id: 24569079. If not set, will not archive ado testplan"
required: false
type: string
default: '24569079'
target-testplan-name:
description: "For example: CY230919. Sync test result to this test plan."
required: false
type: string
get-coverage:
description: "check e2e coverage for fx-core"
required: false
type: boolean
default: false
schedule:
- cron: "0 22 * * *"
pull_request_target:
permissions:
actions: read
jobs:
setup:
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.get-coverage == 'false' ) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name == 'teamsfx-bot/TeamsFx') }}
runs-on: ubuntu-latest
environment: engineering
permissions:
id-token: write
contents: read
outputs:
cases: ${{ steps.schedule-cases.outputs.cases || steps.dispatch-cases.outputs.cases || steps.pr-cases.outputs.cases }}
env:
AZURE_ACCOUNT_NAME: ${{ secrets.TEST_USER_NAME }}
AZURE_ACCOUNT_OBJECT_ID: ${{ secrets.TEST_USER_OBJECT_ID }}
AZURE_ACCOUNT_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.TEST_SUBSCRIPTION_ID }}
AZURE_TENANT_ID: ${{ secrets.TEST_TENANT_ID }}
M365_ACCOUNT_NAME: ${{ secrets.TEST_M365_NAME }}
M365_ACCOUNT_PASSWORD: ${{ secrets.TEST_M365_PASSWORD }}
M365_TENANT_ID: ${{ secrets.TEST_M365_TENANT_ID }}
CI_ENABLED: "true"
M365_ACCOUNT_COLLABORATOR: ${{ secrets.TEST_COLLABORATOR_USER_NAME_2 }}
AUTO_TEST_PLAN_ID: ${{ github.event.inputs.target-testplan-name }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: azure/login@v1
with:
client-id: ${{secrets.DEVOPS_CLIENT_ID}}
tenant-id: ${{secrets.DEVOPS_TENANT_ID}}
subscription-id: ${{secrets.DEVOPS_SUB_ID}}
- name: setup project
uses: ./.github/actions/setup-project
- name: List cases for schedule
id: schedule-cases
if: ${{ github.event_name == 'schedule' }}
working-directory: packages/tests/src/e2e
run: |
cases=`find . -wholename "*.tests.ts" | jq -Rsc '[split("\n") | .[]| select(.!="")]'`
echo "cases=$cases" >> $GITHUB_OUTPUT
- name: List cases for dispatch
id: dispatch-cases
if: ${{ github.event_name == 'workflow_dispatch' }}
working-directory: packages/tests/src/e2e
run: |
inputCases='${{ github.event.inputs.cases }}'
if [ -z "$inputCases" ]; then
allCases=`find . -wholename "*.tests.ts" | jq -Rsc '[split("\n") | .[]| select(.!="")]'`
echo "cases=$allCases" >> $GITHUB_OUTPUT
else
echo "cases=$inputCases" >> $GITHUB_OUTPUT
fi
- name: List cases for pull request
id: pr-cases
if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name == 'teamsfx-bot/TeamsFx' }}
working-directory: packages/tests/src/e2e
run: |
cases=`find ./bot ./frontend -path "*.tests.ts" -and \
-not '(' -path '*/*.dotnet.tests.ts' -or -path '*/Blazor*' ')' \
| jq -Rsc '[split("\n") | .[]| select(.!="")]'`
echo "cases=$cases" >> $GITHUB_OUTPUT
- name: E2E Test clean
working-directory: packages/tests
run: |
npm run test:e2e:clean
- name: Archive Test Plan
if: ${{ github.event.inputs.target-testplan-name != '' }}
working-directory: ./packages/tests
run: |
pnpm install
testplanid=`npx ts-node src/scripts/testPlan.ts obtain vscode ${{ github.event.inputs.target-testplan-name }}`
npx ts-node src/scripts/testPlan.ts archive $testplanid
- name: Upload testplan to artifact
if: ${{ github.event.inputs.target-testplan-name != '' }}
uses: actions/upload-artifact@v3
with:
name: testplan
path: |
./packages/tests/testplan.json
execute-case:
if: ${{ needs.setup.outputs.cases }}
env:
AZURE_ACCOUNT_NAME: ${{ secrets.TEST_USER_NAME }}
AZURE_ACCOUNT_OBJECT_ID: ${{ secrets.TEST_USER_OBJECT_ID }}
AZURE_ACCOUNT_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.TEST_SUBSCRIPTION_ID }}
AZURE_TENANT_ID: ${{ secrets.TEST_TENANT_ID }}
M365_ACCOUNT_NAME: ${{ secrets.TEST_M365_NAME }}
M365_ACCOUNT_PASSWORD: ${{ secrets.TEST_M365_PASSWORD }}
M365_TENANT_ID: ${{ secrets.TEST_M365_TENANT_ID }}
CI_ENABLED: "true"
M365_ACCOUNT_COLLABORATOR: ${{ secrets.TEST_COLLABORATOR_USER_NAME_2 }}
TEAMSFX_DEBUG_TEMPLATE: "true"
NODE_ENV: "development"
TEAMSFX_AAD_DEPLOY_ONLY: "true"
SIDELOADING_SERVICE_ENDPOINT: ${{ secrets.SIDELOADING_SERVICE_ENDPOINT }}
SIDELOADING_SERVICE_SCOPE: ${{ secrets.SIDELOADING_SERVICE_SCOPE }}
needs: setup
runs-on: ubuntu-latest
environment: engineering
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
cases: ${{ fromJson(needs.setup.outputs.cases) }}
name: ${{ matrix.cases }}
outputs:
cases: ${{ matrix.cases }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: azure/login@v1
with:
client-id: ${{secrets.DEVOPS_CLIENT_ID}}
tenant-id: ${{secrets.DEVOPS_TENANT_ID}}
subscription-id: ${{secrets.DEVOPS_SUB_ID}}
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup node for SPFx project
if: contains(matrix.cases, 'SPFx')
uses: actions/setup-node@v3
with:
node-version: 16
- name: Setup Azure Functions Core Tools For Linux
run: |
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
sudo apt-get install azure-functions-core-tools-4
which func
func --version
- name: Setup .net
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
- name: Setup Python
run: |
sudo apt-get install python3.11
sudo apt-get install python3-pip
sudo apt-get install python3.11-venv
python3 --version
pip3 --version
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup project
run: |
npm run setup
- name: Link CLI
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
pnpm link --global
- name: Update CLI and legacy-peer-deps for PR cases
if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name == 'teamsfx-bot/TeamsFx' }}
run: |
npm install -g @microsoft/teamsapp-cli@alpha
npm config set legacy-peer-deps false
- name: print system info
run: |
lscpu
- name: Download samples(daily)
if: github.event_name == 'schedule' && startsWith(matrix.cases, './samples/') && contains(matrix.cases, 'ProactiveMessage') == false
uses: actions/checkout@v3
with:
repository: OfficeDev/TeamsFx-Samples
ref: dev
path: packages/tests/src/e2e/resource
- name: Download samples(rc)
if: github.event_name == 'workflow_dispatch' && startsWith(matrix.cases, './samples/') && contains(matrix.cases, 'ProactiveMessage') == false && contains(matrix.cases, 'SignatureOutlook') == false && contains(matrix.cases, 'ChefBot') == false
uses: actions/checkout@v3
with:
repository: OfficeDev/TeamsFx-Samples
ref: ${{ github.event.inputs.sample-branch }}
path: packages/tests/src/e2e/resource
- name: Download samples from another repo
if: startsWith(matrix.cases, './samples/') && contains(matrix.cases, 'ProactiveMessage')
uses: actions/checkout@v3
with:
repository: OfficeDev/Microsoft-Teams-Samples
ref: main
path: packages/tests/src/e2e/resource
- name: Download samples from office repo
if: startsWith(matrix.cases, './samples/') && contains(matrix.cases, 'SignatureOutlook')
uses: actions/checkout@v3
with:
repository: OfficeDev/Office-Add-in-samples
ref: main
path: packages/tests/src/e2e/resource
- name: Download samples from ai repo
if: startsWith(matrix.cases, './samples/') && contains(matrix.cases, 'ChefBot')
uses: actions/checkout@v3
with:
repository: microsoft/teams-ai
ref: main
path: packages/tests/src/e2e/resource
- name: run test
working-directory: packages/tests/src/e2e
run: |
file=`find . -wholename "${{ matrix.cases }}"`
if [ -z "$file" ]; then
echo "can't find target case in $file"
exit 1
else
npx mocha --reporter mochawesome --timeout 1200000 $file
fi
- name: get report name
id: get-report-name
if: ${{ always() }}
run: |
name="${{ matrix.cases }}"
name="${name//'.tests.ts'/}"
name="${name//.\//}"
name="${name//\//_}"
echo "name=$name" >> $GITHUB_OUTPUT
- name: Upload test report
uses: actions/upload-artifact@v3
if: ${{ github.event_name != 'schedule' || success() || (failure() && github.run_attempt >= 5) }}
with:
name: test-result-${{ steps.get-report-name.outputs.name }}
path: |
./packages/tests/src/e2e/mochawesome-report/mochawesome.json
- name: Download TestPlan
if: ${{ always() && github.event.inputs.target-testplan-name != '' }}
uses: actions/download-artifact@v3
with:
name: testplan
path: ./packages/tests
- name: Sync to Azure DevOps Test Plan
if: ${{ always() && github.event.inputs.target-testplan-name != '' }}
working-directory: packages/tests
run: |
npx ts-node src/scripts/testPlan.ts report ./testplan.json src/e2e/mochawesome-report/mochawesome.json
tear-down:
needs: [execute-case, e2e-coverage]
if: ${{always() && (toJSON(needs.execute-case.outputs.cases) != 'null' || needs.e2e-coverage.result != 'skipped' )}}
runs-on: ubuntu-latest
env:
AZURE_ACCOUNT_NAME: ${{ secrets.TEST_USER_NAME }}
AZURE_ACCOUNT_OBJECT_ID: ${{ secrets.TEST_USER_OBJECT_ID }}
AZURE_ACCOUNT_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.TEST_SUBSCRIPTION_ID }}
AZURE_TENANT_ID: ${{ secrets.TEST_TENANT_ID }}
M365_ACCOUNT_NAME: ${{ secrets.TEST_M365_NAME }}
M365_ACCOUNT_PASSWORD: ${{ secrets.TEST_M365_PASSWORD }}
M365_TENANT_ID: ${{ secrets.TEST_M365_TENANT_ID }}
CI_ENABLED: "true"
M365_ACCOUNT_COLLABORATOR: ${{ secrets.TEST_COLLABORATOR_USER_NAME_2 }}
steps:
- name: Checkout (dev)
uses: actions/checkout@v3
- name: setup project
uses: ./.github/actions/setup-project
- name: E2E Test clean
working-directory: packages/tests
run: |
npm run test:e2e:clean
rerun:
permissions:
actions: write
needs: tear-down
if: ${{ (github.event_name == 'schedule' || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name == 'teamsfx-bot/TeamsFx')) && failure() && github.run_attempt < 5 }}
runs-on: ubuntu-latest
steps:
- name: rerun
run: |
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/rerun.yml/dispatches \
-d '{"ref":"${{ github.ref_name }}","inputs":{"run_id":"${{ github.run_id }}", "max_attempts":"5"}}'
report:
needs: execute-case
if: ${{ github.event_name == 'schedule' && (success() || (failure() && github.run_attempt >= 5)) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Dateutils
run: |
sudo apt install dateutils
- uses: actions/download-artifact@v3
with:
path: ~/artifacts
- name: List jobs
id: list-jobs
working-directory: packages/tests
run: |
page=1
jobs="[]"
while :
do
url=https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs\?per_page\=100\&page\=$page
resp=`curl -H "Accept: application/vnd.github.v3+json" -u:${{ secrets.GITHUB_TOKEN }} $url`
new_jobs=`echo $resp | jq -cr '.jobs'`
jobs=`jq -cr --slurp 'add' <(echo "$jobs") <(echo "$new_jobs")`
has_next=`curl -I -H "Accept: application/vnd.github.v3+json" -u:${{ secrets.GITHUB_TOKEN }} $url | grep -Fi "link:" | grep "rel=\"last\"" || true`
if [ -z "$has_next" ]; then
break
fi
page=$((page+1))
done
cases=`echo $jobs| jq -r '.[] | select(.name | contains("tests.ts")) | .name'`
passed=0
failed=0
skipped=0
passed_lists=""
failed_lists=""
skipped_lists=""
emails="[email protected];"
while IFS= read -r case;
do
if [ -z "$case" ]; then
continue
fi
file="src/e2e/$case"
elegant_path="${file//.\//}"
started_at=`echo $jobs | jq --arg case $case -r '.[] | select(.name == $case ) | .steps[] | select(.name == "run test") | .started_at'`
completed_at=`echo $jobs | jq --arg case $case -r '.[] | select(.name == $case ) | .steps[] | select(.name == "run test") | .completed_at'`
duration=`dateutils.ddiff $started_at $completed_at -f "%Mm %Ss"`
email=""
if grep -q "@author" $file; then
email=`grep '@author' $file | grep -i -o '[A-Z0-9._%+-]\+@[A-Z0-9.-]\+\.[A-Z]\{2,4\}'`
fi
author=""
if [ -z "$email" ]; then
author="N/A"
else
author="<a href=\\\"mailto:$email\\\"><span>$email</span></a>"
fi
url=`echo $jobs | jq --arg case $case -r '.[] | select(.name == $case ) | .html_url'`
url="<a href=\\\"$url\\\">$elegant_path</a>"
target_type="TS/JS"
if [[ $case == *".dotnet."* ]]; then
target_type=".NET"
fi
name="${case//'.tests.ts'/}"
name="${name//.\//}"
name="${name//\//_}"
job_id=`echo $jobs | jq --arg case $case -r '.[] | select(.name == $case ) | .id'`
report_file=`find ~/artifacts -wholename "*${name}*/mochawesome.json"`
if [ ! -z "$report_file" ]; then
echo "Found the $report_file with $job_id and $name"
tests=`cat $report_file | jq -cr '[ .. | objects | with_entries(select(.key=="tests")) | select(. != {}) | select(.tests | type=="array") ] | map(.tests | .[]) | .[]'`
lable=""
while IFS= read -r test;
do
name=`echo $test | jq -cr .fullTitle`
duration=`echo $test | jq -cr .duration`
if [[ ! -z `echo $test | jq 'select(.pass==true)'` ]]; then
passed=$((passed+1))
label="<span style=\\\"background-color:#2aa198;color:white;font-weight:bold;\\\">PASSED</span>"
elif [[ ! -z `echo $test | jq 'select(.fail==true)'` ]]; then
failed=$((failed+1))
label="<span style=\\\"background-color: #dc322f;color:white;font-weight:bold;\\\">FAILED</span>"
if [[ ! -z "$email" && ! "$emails" == *"$email"* ]]; then
emails="$emails;$email;[email protected];[email protected]"
fi
elif [[ ! -z `echo $test | jq 'select(.skipped==true)'` || ! -z `echo $test | jq 'select(.pending==true)'` ]]; then
skipped=$((skipped+1))
label="<span style=\\\"background-color: #b58900;color:white;font-weight:bold;\\\">SKIPPED</span>"
fi
row="<tr> <td style=\\\"text-align: left;\\\">$url</td> <td style=\\\"text-align: left;\\\">$name</td> <td style=\\\"text-align: center;\\\">$target_type</td> <td style=\\\"text-align: center;\\\">$label</td> <td style=\\\"text-align: center;\\\">$author</td> <td>$((duration/1000)) sec</td> </tr>"
if [[ ! -z `echo $test | jq 'select(.pass==true)'` ]]; then
passed_lists="$passed_lists $row"
elif [[ ! -z `echo $test | jq 'select(.fail==true)'` ]]; then
failed_lists="$failed_lists $row"
elif [[ ! -z `echo $test | jq 'select(.skipped==true)'` || ! -z `echo $test | jq 'select(.pending==true)'` ]]; then
skipped_lists="$skipped_lists $row"
fi
done <<< $tests
else
echo "Failed to find the $report_file with $job_id and $name"
fi
done <<< $cases
body="Dashboard App: <a href=\\\"https:\/\/teams.microsoft.com\/l\/entity\/34d3400d-aa60-4ad5-9746-9d1b525da16e\/_djb2_msteams_prefix_3816426998?context=%7B%22channelId%22%3A%2219%3A79488ced607f4fbf8d8433e931cad176%40thread.tacv2%22%7D&tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47\\\">Click Here to Open Dashboard App</a> <table class=\\\"w3-table w3-striped w3-bordered\\\"> <tr> <th>PATH</th> <th>CASE</th> <th>TARGET TYPE</th> <th>STATUS</th> <th>AUTHOR</th> <th>DURATION</th> </tr> $failed_lists $skipped_lists $passed_lists </table> <br />"
total=$((passed+failed+skipped))
subject="TeamsFx E2E V3 Test Report ($passed/$total Passed, $failed/$total Failed, $skipped/$total Skipped)"
if [ $failed -gt 0 ]; then
subject="[FAILED] $subject"
else
subject="[PASSED] $subject"
fi
echo "body=$body" >> $GITHUB_OUTPUT
echo "to=$emails" >> $GITHUB_OUTPUT
echo "subject=$subject" >> $GITHUB_OUTPUT
- name: Send E-mail to the whole team
uses: ./.github/actions/send-email-report
env:
TO: ${{ steps.list-jobs.outputs.to }}
BODY: '"${{ steps.list-jobs.outputs.body }}"'
SUBJECT: ${{ steps.list-jobs.outputs.subject }}
MAIL_CLIENT_ID: ${{ secrets.TEST_CLEAN_CLIENT_ID }}
MAIL_CLIENT_SECRET: ${{ secrets.TEST_CLEAN_CLIENT_SECRET }}
MAIL_TENANT_ID: ${{ secrets.TEST_CLEAN_TENANT_ID }}
e2e-coverage:
if: ${{github.event_name == 'workflow_dispatch' && github.event.inputs.get-coverage == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
with:
version: 8
- name: mv files
working-directory: packages/tests
run: |
rm src/e2e/commonUtils.ts src/utils/commonUtils.ts
mv src/e2e/commonUtils.ts.back src/e2e/commonUtils.ts
mv src/utils/commonUtils.ts.back src/utils/commonUtils.ts
- uses: jossef/action-set-json-field@v1
with:
file: ./packages/fx-core/.nycrc
field: excludeAfterRemap
value: false
- name: Update config.json
working-directory: packages/fx-core
run: echo "`jq '.include=["build"]' .nycrc`" > .nycrc
- name: less nycrc
working-directory: packages/fx-core
run: |
less .nycrc
- name: setup
run: |
npm run setup
- name: Download samples(daily)
working-directory: packages/tests/src/e2e
run: |
mkdir resource && cd resource
wget https://github.com/OfficeDev/TeamsFx-Samples/archive/refs/heads/dev.zip
unzip dev.zip -d .
mv TeamsFx-Samples-dev/* .
rm -rf dev.zip TeamsFx-Samples-dev
- name: run test for coverage
working-directory: packages/fx-core
env:
AZURE_ACCOUNT_NAME: ${{ secrets.TEST_USER_NAME }}
AZURE_ACCOUNT_OBJECT_ID: ${{ secrets.TEST_USER_OBJECT_ID }}
AZURE_ACCOUNT_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.TEST_SUBSCRIPTION_ID }}
AZURE_TENANT_ID: ${{ secrets.TEST_TENANT_ID }}
M365_ACCOUNT_NAME: ${{ secrets.TEST_USER_NAME }}
M365_ACCOUNT_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
M365_TENANT_ID: ${{ secrets.TEST_TENANT_ID_2 }}
CI_ENABLED: "true"
M365_ACCOUNT_COLLABORATOR: ${{ secrets.TEST_COLLABORATOR_USER_NAME }}
TEAMSFX_DEBUG_TEMPLATE: "true"
NODE_ENV: "development"
TEAMSFX_AAD_DEPLOY_ONLY: "true"
SIDELOADING_SERVICE_ENDPOINT: ${{ secrets.SIDELOADING_SERVICE_ENDPOINT }}
SIDELOADING_SERVICE_SCOPE: ${{ secrets.SIDELOADING_SERVICE_SCOPE }}
run: |
npx nyc mocha --parallel ../tests/src/e2e/*/*.tests.ts
- name: pack zip
if: ${{always()}}
working-directory: packages/fx-core
run: |
zip -r out1.zip .nyc_output/
zip -r out2.zip coverage/
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: coverage
path: |
packages/fx-core/out1.zip
packages/fx-core/out2.zip
- name: CodeCov report attempt
if: ${{always()}}
continue-on-error: true
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true