@@ -108,6 +108,7 @@ class TestsPipelineResult(typing.TypedDict, total=False):
108
108
link : str
109
109
result : DEVOPS_BUILD_STATUS
110
110
tests : CheckStatus
111
+ samples : CheckStatus
111
112
112
113
113
114
class CIPipelineResult (typing .TypedDict , total = False ):
@@ -152,6 +153,7 @@ class LibraryStatus(typing.TypedDict, total=False):
152
153
sphinx : Status
153
154
sdk_owned : bool
154
155
tests : Status
156
+ samples : Status
155
157
ci : Status
156
158
157
159
@@ -224,6 +226,18 @@ def skip_package(package_name: str) -> bool:
224
226
)
225
227
226
228
229
+ def samples_enabled (package_path : pathlib .Path ) -> bool :
230
+ tests_yaml = package_path .parent / "tests.yml"
231
+ if not tests_yaml .exists ():
232
+ return False
233
+ with open (tests_yaml , "r" ) as file :
234
+ parameters = file .read ()
235
+
236
+ if "TestSamples=.*/true" in parameters :
237
+ return True
238
+ return False
239
+
240
+
227
241
def get_dataplane (
228
242
include_sdk_owned : bool = True ,
229
243
) -> dict [ServiceDirectory , dict [LibraryName , LibraryStatus ]]:
@@ -336,6 +350,7 @@ def record_all_pipeline(
336
350
{
337
351
"result" : status ,
338
352
"tests" : CheckStatus (status = status ),
353
+ "samples" : CheckStatus (status = status ),
339
354
}
340
355
)
341
356
)
@@ -367,7 +382,7 @@ def record_all_library(details: LibraryStatus, status: CHECK_STATUS) -> None:
367
382
details ["sphinx" ] = Status (status = status , link = None )
368
383
details ["ci" ] = Status (status = status , link = None )
369
384
details ["tests" ] = Status (status = status , link = None )
370
-
385
+ details [ "samples" ] = Status ( status = status , link = None )
371
386
372
387
def get_ci_result (service : str , pipeline_id : int | None , pipelines : dict [ServiceDirectory , PipelineResults ]) -> None :
373
388
if not pipeline_id :
@@ -393,6 +408,9 @@ def get_ci_result(service: str, pipeline_id: int | None, pipelines: dict[Service
393
408
pipelines [service ]["ci" ].update ({"result" : result ["result" ]})
394
409
build_id = result ["id" ]
395
410
timeline_response = httpx .get (get_build_timeline_url (build_id ), headers = AUTH_HEADERS )
411
+ if timeline_response .status_code != 200 :
412
+ record_all_pipeline ("tests" , pipelines [service ], "UNKNOWN" )
413
+ return
396
414
timeline_result = json .loads (timeline_response .text )
397
415
398
416
for task in timeline_result ["records" ]:
@@ -432,11 +450,16 @@ def get_tests_result(service: str, pipeline_id: int | None, pipelines: dict[Serv
432
450
pipelines [service ]["tests" ].update ({"result" : result ["result" ]})
433
451
build_id = result ["id" ]
434
452
timeline_response = httpx .get (get_build_timeline_url (build_id ), headers = AUTH_HEADERS )
453
+ if timeline_response .status_code != 200 :
454
+ record_all_pipeline ("tests" , pipelines [service ], "UNKNOWN" )
455
+ return
435
456
timeline_result = json .loads (timeline_response .text )
436
457
437
458
for task in timeline_result ["records" ]:
438
459
if "Run Tests" in task ["name" ]:
439
460
record_test_result (task , "tests" , pipelines [service ]["tests" ])
461
+ if "Test Samples" in task ["name" ]:
462
+ record_test_result (task , "samples" , pipelines [service ]["tests" ])
440
463
441
464
442
465
def get_tests_weekly_result (service : str , pipeline_id : int | None , pipelines : dict [ServiceDirectory , PipelineResults ]) -> None :
@@ -459,6 +482,9 @@ def get_tests_weekly_result(service: str, pipeline_id: int | None, pipelines: di
459
482
pipelines [service ]["tests_weekly" ].update ({"result" : result ["result" ]})
460
483
build_id = result ["id" ]
461
484
timeline_response = httpx .get (get_build_timeline_url (build_id ), headers = AUTH_HEADERS )
485
+ if timeline_response .status_code != 200 :
486
+ record_all_pipeline ("tests" , pipelines [service ], "UNKNOWN" )
487
+ return
462
488
timeline_result = json .loads (timeline_response .text )
463
489
464
490
for task in timeline_result ["records" ]:
@@ -506,6 +532,25 @@ def report_test_result(
506
532
library_details [test_type ] = Status (status = "UNKNOWN" , link = pipeline [test_type ].get ("link" ))
507
533
508
534
535
+ def report_samples_result (
536
+ check : typing .Literal ["samples" ],
537
+ pipeline : PipelineResults ,
538
+ library_details : LibraryStatus ,
539
+ ) -> None :
540
+ enabled = samples_enabled (library_details ["path" ])
541
+ if not enabled :
542
+ library_details [check ] = Status (status = "DISABLED" , link = None )
543
+ return
544
+
545
+ ci_check = pipeline ["tests" ][check ]["status" ]
546
+ if ci_check == "succeeded" :
547
+ library_details [check ] = Status (status = "PASS" , link = pipeline ["tests" ]["link" ])
548
+ elif ci_check == "failed" :
549
+ library_details [check ] = Status (status = "FAIL" , link = pipeline ["tests" ]["link" ])
550
+ else :
551
+ library_details [check ] = Status (status = "UNKNOWN" , link = pipeline ["tests" ].get ("link" ))
552
+
553
+
509
554
def report_check_result (
510
555
check : CheckTypes ,
511
556
pipeline : PipelineResults ,
@@ -558,6 +603,7 @@ def report_status(
558
603
details ["type_check_samples" ] = (
559
604
"ENABLED" if is_check_enabled (str (details ["path" ]), "type_check_samples" ) else "DISABLED"
560
605
)
606
+ report_samples_result ("samples" , pipelines [service_directory ], details )
561
607
details ["sdk_owned" ] = details ["path" ].name in SDK_TEAM_OWNED
562
608
report_test_result ("tests" , pipelines [service_directory ], details )
563
609
report_test_result ("ci" , pipelines [service_directory ], details )
@@ -687,6 +733,7 @@ def write_to_csv(libraries: dict[ServiceDirectory, dict[LibraryName, LibraryStat
687
733
"Sphinx" ,
688
734
"Tests - CI" ,
689
735
"Tests - Live" ,
736
+ "Tests - Samples" ,
690
737
"SLA - Questions" ,
691
738
"SLA - Bugs" ,
692
739
"Total customer-reported issues" ,
@@ -696,6 +743,7 @@ def write_to_csv(libraries: dict[ServiceDirectory, dict[LibraryName, LibraryStat
696
743
"Sphinx_link" ,
697
744
"Tests - CI_link" ,
698
745
"Tests - Live_link" ,
746
+ "Tests - Samples_link" ,
699
747
"SLA - Questions_link" ,
700
748
"SLA - Bugs_link" ,
701
749
"Total customer-reported issues_link" ,
@@ -718,6 +766,7 @@ def write_to_csv(libraries: dict[ServiceDirectory, dict[LibraryName, LibraryStat
718
766
details ["sphinx" ]["status" ],
719
767
details ["ci" ]["status" ],
720
768
details ["tests" ]["status" ],
769
+ details ["samples" ]["status" ],
721
770
details .get ("sla" , {}).get ("question" , {}).get ("num" , 0 ),
722
771
details .get ("sla" , {}).get ("bug" , {}).get ("num" , 0 ),
723
772
details .get ("customer_issues" , {}).get ("num" , 0 ),
@@ -727,6 +776,7 @@ def write_to_csv(libraries: dict[ServiceDirectory, dict[LibraryName, LibraryStat
727
776
details ["sphinx" ].get ("link" , "" ),
728
777
details ["ci" ].get ("link" , "" ),
729
778
details ["tests" ].get ("link" , "" ),
779
+ details ["samples" ].get ("link" , "" ),
730
780
details .get ("sla" , {}).get ("question" , {}).get ("link" , "" ),
731
781
details .get ("sla" , {}).get ("bug" , {}).get ("link" , "" ),
732
782
details .get ("customer_issues" , {}).get ("link" , "" ),
@@ -751,6 +801,7 @@ def write_to_markdown(libraries: dict[ServiceDirectory, dict[LibraryName, Librar
751
801
"Sphinx" ,
752
802
"Tests - CI" ,
753
803
"Tests - Live" ,
804
+ "Tests - Samples" ,
754
805
"SLA - Questions / Bugs" ,
755
806
"Total customer-reported issues" ,
756
807
]
@@ -795,6 +846,8 @@ def write_to_markdown(libraries: dict[ServiceDirectory, dict[LibraryName, Librar
795
846
+ (f" ([link]({ details ['ci' ]['link' ]} ))" if details ["ci" ]["link" ] is not None else "" ),
796
847
details ["tests" ]["status" ]
797
848
+ (f" ([link]({ details ['tests' ]['link' ]} ))" if details ["tests" ]["link" ] is not None else "" ),
849
+ details ["samples" ]["status" ]
850
+ + (f" ([link]({ details ['samples' ]['link' ]} ))" if details ["samples" ]["link" ] is not None else "" ),
798
851
sla_str ,
799
852
str (details .get ("customer_issues" , {}).get ("num" , 0 ))
800
853
+ (
0 commit comments