File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,19 +64,25 @@ def parse_options() -> argparse.Namespace:
6464
6565if __name__ == "__main__" :
6666
67- args = parse_options ()
67+ try :
68+ args = parse_options ()
6869
69- archive = FlakyTestsArchive (
70- args .junit_archive ,
71- args .window_size ,
72- args .delete_old_files
73- )
70+ archive = FlakyTestsArchive (
71+ args .junit_archive ,
72+ args .window_size ,
73+ args .delete_old_files
74+ )
75+
76+ if args .markdown_file :
77+ FlakyTestsMdPublisher .publish (archive , args .markdown_file )
7478
75- if args .markdown_file :
76- FlakyTestsMdPublisher .publish (archive , args .markdown_file )
79+ if args .json_file :
80+ FlakyTestsJSONPublisher .publish (archive , args .json_file )
7781
78- if args . json_file :
79- FlakyTestsJSONPublisher . publish ( archive , args . json_file )
82+ ret = 0 if archive . flaky_test_count == 0 else 1
83+ exit ( ret )
8084
81- ret = 0 if archive .flaky_test_count == 0 else 1
82- exit (ret )
85+ except Exception as e :
86+ # Exit with 255 error so that the action can fail
87+ print (e )
88+ exit (255 )
Original file line number Diff line number Diff line change 8787
8888 echo "Flakiness report generated"
8989
90- if [[ "${{ inputs.fail_on_flaky_tests }}" != "True" ]]
90+ # A 255 exit code indicates that an exception occurred in the script, we want to fail in that case
91+ if [ "${{ inputs.fail_on_flaky_tests }}" != "True" ] && [ "$EXIT_CODE" != "255" ]
9192 then
9293 echo "Ignoring flaky tests failures"
9394 EXIT_CODE=0
Original file line number Diff line number Diff line change 7474
7575 $EXIT_CODE = $LASTEXITCODE
7676
77- if ("${{ inputs.fail_on_flaky_tests }}" -ne "True") {
77+ # A 255 exit code indicates that an exception occurred in the script, we want to fail in that case
78+ if ("${{ inputs.fail_on_flaky_tests }}" -ne "True" -and $EXIT_CODE -ne 255) {
79+ Write-Output "Ignoring flaky tests failures"
7880 $EXIT_CODE = 0
7981 }
8082
You can’t perform that action at this time.
0 commit comments