5252
5353_REPORT_LABEL = "nightly-testing"
5454_REPORT_TITLE = "Nightly Integration Testing Report"
55+ _REPORT_TITLE_FIRESTORE = "Nightly Integration Testing Report for Firestore"
5556
5657_LABEL_TRIGGER_FULL = "tests-requested: full"
5758_LABEL_TRIGGER_QUICK = "tests-requested: quick"
7576_COMMENT_FLAKY_TRACKER = "\n \n Add flaky tests to **[go/fpl-cpp-flake-tracker](http://go/fpl-cpp-flake-tracker)**\n "
7677
7778_COMMENT_IDENTIFIER = "integration-test-status-comment"
78- _COMMENT_SUFFIX = f'\n <hidden value="{ _COMMENT_IDENTIFIER } "></hidden>'
79+ _COMMENT_HIDDEN_DIVIDER = f'\n <hidden value="{ _COMMENT_IDENTIFIER } "></hidden>\n '
7980
8081_LOG_ARTIFACT_NAME = "log-artifact"
8182_LOG_OUTPUT_DIR = "test_results"
8990_BUILD_AGAINST_SDK = "sdk"
9091_BUILD_AGAINST_REPO = "repo"
9192
93+ _BUILD_API_ALL = "all"
94+ _BUILD_API_FIRESTORE = "firestore"
95+ _BUILD_API_ALL_EXCEPT_FIRESTORE = "all_except_firestore"
96+
9297FLAGS = flags .FLAGS
9398
9499flags .DEFINE_string (
124129 "build_against" , None ,
125130 "Integration testapps could either build against packaged SDK or repo" )
126131
132+ flags .DEFINE_string (
133+ "build_apis" , None ,
134+ "Generate spearate report for different apis." )
135+
127136
128137def test_start (token , issue_number , actor , commit , run_id ):
129138 """In PR, when start testing, add comment and label \" tests: in-progress\" """
@@ -133,7 +142,7 @@ def test_start(token, issue_number, actor, commit, run_id):
133142
134143 comment = (_COMMENT_TITLE_PROGESS +
135144 _get_description (actor , commit , run_id ) +
136- _COMMENT_SUFFIX )
145+ _COMMENT_HIDDEN_DIVIDER )
137146 _update_comment (token , issue_number , comment )
138147
139148
@@ -156,7 +165,7 @@ def test_progress(token, issue_number, actor, commit, run_id):
156165 _get_description (actor , commit , run_id ) +
157166 log_summary +
158167 _COMMENT_FLAKY_TRACKER +
159- _COMMENT_SUFFIX )
168+ _COMMENT_HIDDEN_DIVIDER )
160169 _update_comment (token , issue_number , comment )
161170
162171
@@ -170,7 +179,7 @@ def test_end(token, issue_number, actor, commit, run_id, new_token):
170179 github .add_label (token , issue_number , _LABEL_SUCCEED )
171180 comment = (_COMMENT_TITLE_SUCCEED +
172181 _get_description (actor , commit , run_id ) +
173- _COMMENT_SUFFIX )
182+ _COMMENT_HIDDEN_DIVIDER )
174183 _update_comment (token , issue_number , comment )
175184 else :
176185 if success_or_only_flakiness :
@@ -185,20 +194,35 @@ def test_end(token, issue_number, actor, commit, run_id, new_token):
185194 _get_description (actor , commit , run_id ) +
186195 log_summary +
187196 _COMMENT_FLAKY_TRACKER +
188- _COMMENT_SUFFIX )
197+ _COMMENT_HIDDEN_DIVIDER )
189198 _update_comment (token , issue_number , comment )
190199
191200 github .delete_label (new_token , issue_number , _LABEL_PROGRESS )
192201
193202
194- def test_report (token , actor , commit , run_id , build_against ):
195- """Update (create if not exist) a Daily Report in Issue.
203+ def test_report (token , actor , commit , run_id , build_against , build_apis ):
204+ """Update (create if not exist) a Daily/Nightly Report in Issue.
196205 The Issue with title _REPORT_TITLE and label _REPORT_LABEL:
197206 https://github.com/firebase/firebase-cpp-sdk/issues?q=is%3Aissue+label%3Anightly-testing
207+ The report is with the format below:
208+ PREFIX
209+ HIDDEN DIVIDER
210+ REPORT (TEST AGAINST REPO)
211+ HIDDEN DIVIDER
212+ REPORT (TEST AGAINST SDK)
198213 """
199- issue_number = _get_issue_number (token , _REPORT_TITLE , _REPORT_LABEL )
214+ if build_apis == _BUILD_API_FIRESTORE :
215+ report_title = _REPORT_TITLE_FIRESTORE
216+ prefix = ""
217+ else :
218+ report_title = _REPORT_TITLE
219+ firestore_issue_number = _get_issue_number (token , _REPORT_TITLE_FIRESTORE , _REPORT_LABEL )
220+ firestore_issue_url = "https://github.com/firebase/firebase-cpp-sdk/issues/%s" % firestore_issue_number
221+ prefix = "Note: This report excludes firestore. Please also check **[the report for firestore](%s)**\n ***\n " % firestore_issue_url
222+
223+ issue_number = _get_issue_number (token , report_title , _REPORT_LABEL )
200224 previous_comment = github .get_issue_body (token , issue_number )
201- [previous_comment_repo , previous_comment_sdk ] = previous_comment .split (_COMMENT_SUFFIX )
225+ [_ , previous_comment_repo , previous_comment_sdk ] = previous_comment .split (_COMMENT_HIDDEN_DIVIDER )
202226 success_or_only_flakiness , log_summary = _get_summary_table (token , run_id )
203227 if success_or_only_flakiness and not log_summary :
204228 # succeeded (without flakiness)
@@ -214,9 +238,9 @@ def test_report(token, actor, commit, run_id, build_against):
214238 comment = title + _get_description (actor , commit , run_id ) + log_summary + _COMMENT_FLAKY_TRACKER
215239
216240 if build_against == _BUILD_AGAINST_REPO :
217- comment = comment + _COMMENT_SUFFIX + previous_comment_sdk
218- else :
219- comment = previous_comment_repo + _COMMENT_SUFFIX + comment
241+ comment = prefix + _COMMENT_HIDDEN_DIVIDER + comment + _COMMENT_HIDDEN_DIVIDER + previous_comment_sdk
242+ elif build_against == _BUILD_AGAINST_SDK :
243+ comment = prefix + _COMMENT_HIDDEN_DIVIDER + previous_comment_repo + _COMMENT_HIDDEN_DIVIDER + comment
220244
221245 if (_COMMENT_TITLE_SUCCEED_REPO in comment ) and (_COMMENT_TITLE_SUCCEED_SDK in comment ):
222246 github .close_issue (token , issue_number )
@@ -231,12 +255,12 @@ def _get_issue_number(token, title, label):
231255 for issue in issues :
232256 if issue ["title" ] == title :
233257 return issue ["number" ]
234-
235- return github .create_issue (token , title , label , _COMMENT_SUFFIX )["number" ]
258+ empty_comment = _COMMENT_HIDDEN_DIVIDER + " " + _COMMENT_HIDDEN_DIVIDER
259+ return github .create_issue (token , title , label , empty_comment )["number" ]
236260
237261
238262def _update_comment (token , issue_number , comment ):
239- comment_id = _get_comment_id (token , issue_number , _COMMENT_SUFFIX )
263+ comment_id = _get_comment_id (token , issue_number , _COMMENT_HIDDEN_DIVIDER )
240264 if not comment_id :
241265 github .add_comment (token , issue_number , comment )
242266 else :
@@ -288,7 +312,7 @@ def main(argv):
288312 elif FLAGS .stage == _BUILD_STAGES_END :
289313 test_end (FLAGS .token , FLAGS .issue_number , FLAGS .actor , FLAGS .commit , FLAGS .run_id , FLAGS .new_token )
290314 elif FLAGS .stage == _BUILD_STAGES_REPORT :
291- test_report (FLAGS .token , FLAGS .actor , FLAGS .commit , FLAGS .run_id , FLAGS .build_against )
315+ test_report (FLAGS .token , FLAGS .actor , FLAGS .commit , FLAGS .run_id , FLAGS .build_against , FLAGS . build_apis )
292316 else :
293317 print ("Invalid stage value. Valid value: " + "," .join (_BUILD_STAGES ))
294318
0 commit comments