18
18
required : false
19
19
type : string
20
20
21
+ get-coverage :
22
+ description : " check e2e coverage for fx-core"
23
+ required : false
24
+ type : boolean
25
+ default : false
26
+
21
27
schedule :
22
28
- cron : " 0 22 * * *"
23
29
24
30
pull_request_target :
25
31
26
32
jobs :
27
33
setup :
28
- if : ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name == 'teamsfx-bot/TeamsFx') }}
34
+ if : ${{ github.event_name == 'schedule' || ( github.event_name == 'workflow_dispatch' && !github.event.inputs.get-coverage) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name == 'teamsfx-bot/TeamsFx') }}
29
35
runs-on : ubuntu-latest
30
36
outputs :
31
37
cases : ${{ steps.schedule-cases.outputs.cases || steps.dispatch-cases.outputs.cases || steps.pr-cases.outputs.cases }}
@@ -451,3 +457,79 @@ jobs:
451
457
MAIL_CLIENT_ID : ${{ secrets.TEST_CLEAN_CLIENT_ID }}
452
458
MAIL_CLIENT_SECRET : ${{ secrets.TEST_CLEAN_CLIENT_SECRET }}
453
459
MAIL_TENANT_ID : ${{ secrets.TEST_CLEAN_TENANT_ID }}
460
+
461
+ e2e-coverage :
462
+ if : ${{github.event_name == 'workflow_dispatch' && github.event.inputs.get-coverage }}
463
+ runs-on : ubuntu-latest
464
+ steps :
465
+ - uses : actions/checkout@v3
466
+ - uses : actions/setup-node@v3
467
+ with :
468
+ node-version : 18
469
+ - uses : pnpm/action-setup@v2
470
+ with :
471
+ version : 8
472
+
473
+ - name : mv files
474
+ working-directory : packages/tests
475
+ run : |
476
+ rm src/e2e/commonUtils.ts src/utils/commonUtils.ts
477
+ mv src/e2e/commonUtils.ts.back src/e2e/commonUtils.ts
478
+ mv src/utils/commonUtils.ts.back src/utils/commonUtils.ts
479
+
480
+ - uses : jossef/action-set-json-field@v1
481
+ with :
482
+ file : ./packages/fx-core/.nycrc
483
+ field : excludeAfterRemap
484
+ value : false
485
+
486
+ - name : Update config.json
487
+ working-directory : packages/fx-core
488
+ run : echo "`jq '.include=["build"]' .nycrc`" > .nycrc
489
+
490
+ - name : less nycrc
491
+ working-directory : packages/fx-core
492
+ run : |
493
+ less .nycrc
494
+
495
+ - name : setup
496
+ run : |
497
+ npm run setup
498
+
499
+ - name : run test for coverage
500
+ working-directory : packages/fx-core
501
+ env :
502
+ AZURE_ACCOUNT_NAME : ${{ secrets.TEST_USER_NAME }}
503
+ AZURE_ACCOUNT_OBJECT_ID : ${{ secrets.TEST_USER_OBJECT_ID }}
504
+ AZURE_ACCOUNT_PASSWORD : ${{ secrets.TEST_USER_PASSWORD }}
505
+ AZURE_SUBSCRIPTION_ID : ${{ secrets.TEST_SUBSCRIPTION_ID }}
506
+ AZURE_TENANT_ID : ${{ secrets.TEST_TENANT_ID }}
507
+ M365_ACCOUNT_NAME : ${{ secrets.TEST_USER_NAME }}
508
+ M365_ACCOUNT_PASSWORD : ${{ secrets.TEST_USER_PASSWORD }}
509
+ M365_TENANT_ID : ${{ secrets.TEST_TENANT_ID_2 }}
510
+ CI_ENABLED : " true"
511
+ M365_ACCOUNT_COLLABORATOR : ${{ secrets.TEST_COLLABORATOR_USER_NAME }}
512
+ AZURE_DEVOPS_EXT_PAT : ${{ secrets.ADO_PAT }}
513
+ TEAMSFX_DEBUG_TEMPLATE : " true"
514
+ NODE_ENV : " development"
515
+ TEAMSFX_AAD_DEPLOY_ONLY : " true"
516
+ SIDELOADING_SERVICE_ENDPOINT : ${{ secrets.SIDELOADING_SERVICE_ENDPOINT }}
517
+ SIDELOADING_SERVICE_SCOPE : ${{ secrets.SIDELOADING_SERVICE_SCOPE }}
518
+ ADO_TOKEN : ${{ secrets.ADO_PAT }}
519
+ run : |
520
+ npx nyc mocha --parallel ../tests/src/e2e/**/*.tests.ts
521
+
522
+ - name : pack zip
523
+ if : ${{always()}}
524
+ working-directory : packages/fx-core
525
+ run : |
526
+ zip -r out1.zip .nyc_output/
527
+ zip -r out2.zip coverage/
528
+
529
+ - uses : actions/upload-artifact@v3
530
+ if : ${{ always() }}
531
+ with :
532
+ name : coverage
533
+ path : |
534
+ packages/fx-core/out1.zip
535
+ packages/fx-core/out2.zip
0 commit comments