52
52
53
53
_REPORT_LABEL = "nightly-testing"
54
54
_REPORT_TITLE = "Nightly Integration Testing Report"
55
+ _REPORT_TITLE_FIRESTORE = "Nightly Integration Testing Report for Firestore"
55
56
56
57
_LABEL_TRIGGER_FULL = "tests-requested: full"
57
58
_LABEL_TRIGGER_QUICK = "tests-requested: quick"
75
76
_COMMENT_FLAKY_TRACKER = "\n \n Add flaky tests to **[go/fpl-cpp-flake-tracker](http://go/fpl-cpp-flake-tracker)**\n "
76
77
77
78
_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 '
79
80
80
81
_LOG_ARTIFACT_NAME = "log-artifact"
81
82
_LOG_OUTPUT_DIR = "test_results"
89
90
_BUILD_AGAINST_SDK = "sdk"
90
91
_BUILD_AGAINST_REPO = "repo"
91
92
93
+ _BUILD_API_ALL = "all"
94
+ _BUILD_API_FIRESTORE = "firestore"
95
+ _BUILD_API_ALL_EXCEPT_FIRESTORE = "all_except_firestore"
96
+
92
97
FLAGS = flags .FLAGS
93
98
94
99
flags .DEFINE_string (
124
129
"build_against" , None ,
125
130
"Integration testapps could either build against packaged SDK or repo" )
126
131
132
+ flags .DEFINE_string (
133
+ "build_apis" , None ,
134
+ "Generate spearate report for different apis." )
135
+
127
136
128
137
def test_start (token , issue_number , actor , commit , run_id ):
129
138
"""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):
133
142
134
143
comment = (_COMMENT_TITLE_PROGESS +
135
144
_get_description (actor , commit , run_id ) +
136
- _COMMENT_SUFFIX )
145
+ _COMMENT_HIDDEN_DIVIDER )
137
146
_update_comment (token , issue_number , comment )
138
147
139
148
@@ -156,7 +165,7 @@ def test_progress(token, issue_number, actor, commit, run_id):
156
165
_get_description (actor , commit , run_id ) +
157
166
log_summary +
158
167
_COMMENT_FLAKY_TRACKER +
159
- _COMMENT_SUFFIX )
168
+ _COMMENT_HIDDEN_DIVIDER )
160
169
_update_comment (token , issue_number , comment )
161
170
162
171
@@ -170,7 +179,7 @@ def test_end(token, issue_number, actor, commit, run_id, new_token):
170
179
github .add_label (token , issue_number , _LABEL_SUCCEED )
171
180
comment = (_COMMENT_TITLE_SUCCEED +
172
181
_get_description (actor , commit , run_id ) +
173
- _COMMENT_SUFFIX )
182
+ _COMMENT_HIDDEN_DIVIDER )
174
183
_update_comment (token , issue_number , comment )
175
184
else :
176
185
if success_or_only_flakiness :
@@ -185,20 +194,35 @@ def test_end(token, issue_number, actor, commit, run_id, new_token):
185
194
_get_description (actor , commit , run_id ) +
186
195
log_summary +
187
196
_COMMENT_FLAKY_TRACKER +
188
- _COMMENT_SUFFIX )
197
+ _COMMENT_HIDDEN_DIVIDER )
189
198
_update_comment (token , issue_number , comment )
190
199
191
200
github .delete_label (new_token , issue_number , _LABEL_PROGRESS )
192
201
193
202
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.
196
205
The Issue with title _REPORT_TITLE and label _REPORT_LABEL:
197
206
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)
198
213
"""
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 )
200
224
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 )
202
226
success_or_only_flakiness , log_summary = _get_summary_table (token , run_id )
203
227
if success_or_only_flakiness and not log_summary :
204
228
# succeeded (without flakiness)
@@ -214,9 +238,9 @@ def test_report(token, actor, commit, run_id, build_against):
214
238
comment = title + _get_description (actor , commit , run_id ) + log_summary + _COMMENT_FLAKY_TRACKER
215
239
216
240
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
220
244
221
245
if (_COMMENT_TITLE_SUCCEED_REPO in comment ) and (_COMMENT_TITLE_SUCCEED_SDK in comment ):
222
246
github .close_issue (token , issue_number )
@@ -231,12 +255,12 @@ def _get_issue_number(token, title, label):
231
255
for issue in issues :
232
256
if issue ["title" ] == title :
233
257
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" ]
236
260
237
261
238
262
def _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 )
240
264
if not comment_id :
241
265
github .add_comment (token , issue_number , comment )
242
266
else :
@@ -288,7 +312,7 @@ def main(argv):
288
312
elif FLAGS .stage == _BUILD_STAGES_END :
289
313
test_end (FLAGS .token , FLAGS .issue_number , FLAGS .actor , FLAGS .commit , FLAGS .run_id , FLAGS .new_token )
290
314
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 )
292
316
else :
293
317
print ("Invalid stage value. Valid value: " + "," .join (_BUILD_STAGES ))
294
318
0 commit comments