47
47
from absl import flags
48
48
from absl import logging
49
49
50
- import github
50
+ import firebase_github
51
51
import summarize_test_results as summarize
52
52
53
53
_REPORT_LABEL = "nightly-testing"
144
144
145
145
def test_start (token , issue_number , actor , commit , run_id ):
146
146
"""In PR, when start testing, add comment and label \" tests: in-progress\" """
147
- github .add_label (token , issue_number , _LABEL_PROGRESS )
147
+ firebase_github .add_label (token , issue_number , _LABEL_PROGRESS )
148
148
for label in [_LABEL_TRIGGER_FULL , _LABEL_TRIGGER_QUICK , _LABEL_FAILED , _LABEL_SUCCEED ]:
149
- github .delete_label (token , issue_number , label )
149
+ firebase_github .delete_label (token , issue_number , label )
150
150
151
151
comment = (_COMMENT_TITLE_PROGESS +
152
152
_get_description (actor , commit , run_id ) +
@@ -168,7 +168,7 @@ def test_progress(token, issue_number, actor, commit, run_id):
168
168
else :
169
169
# failures/errors still exist after retry
170
170
title = _COMMENT_TITLE_PROGESS_FAIL
171
- github .add_label (token , issue_number , _LABEL_FAILED )
171
+ firebase_github .add_label (token , issue_number , _LABEL_FAILED )
172
172
comment = (title +
173
173
_get_description (actor , commit , run_id ) +
174
174
log_summary +
@@ -184,7 +184,7 @@ def test_end(token, issue_number, actor, commit, run_id, new_token):
184
184
success_or_only_flakiness , log_summary = _get_summary_table (token , run_id )
185
185
if success_or_only_flakiness and not log_summary :
186
186
# succeeded (without flakiness)
187
- github .add_label (token , issue_number , _LABEL_SUCCEED )
187
+ firebase_github .add_label (token , issue_number , _LABEL_SUCCEED )
188
188
comment = (_COMMENT_TITLE_SUCCEED +
189
189
_get_description (actor , commit , run_id ) +
190
190
_COMMENT_HIDDEN_DIVIDER )
@@ -193,19 +193,19 @@ def test_end(token, issue_number, actor, commit, run_id, new_token):
193
193
if success_or_only_flakiness :
194
194
# all failures/errors are due to flakiness (succeeded after retry)
195
195
title = _COMMENT_TITLE_FLAKY
196
- github .add_label (token , issue_number , _LABEL_SUCCEED )
196
+ firebase_github .add_label (token , issue_number , _LABEL_SUCCEED )
197
197
else :
198
198
# failures/errors still exist after retry
199
199
title = _COMMENT_TITLE_FAIL
200
- github .add_label (token , issue_number , _LABEL_FAILED )
200
+ firebase_github .add_label (token , issue_number , _LABEL_FAILED )
201
201
comment = (title +
202
202
_get_description (actor , commit , run_id ) +
203
203
log_summary +
204
204
_COMMENT_FLAKY_TRACKER +
205
205
_COMMENT_HIDDEN_DIVIDER )
206
206
_update_comment (token , issue_number , comment )
207
207
208
- github .delete_label (new_token , issue_number , _LABEL_PROGRESS )
208
+ firebase_github .delete_label (new_token , issue_number , _LABEL_PROGRESS )
209
209
210
210
211
211
def test_report (token , actor , commit , run_id , build_against , build_apis ):
@@ -232,7 +232,7 @@ def test_report(token, actor, commit, run_id, build_against, build_apis):
232
232
prefix = "Note: This report excludes Firestore. Please also check **[the report for Firestore](%s).**\n ***\n " % firestore_issue_url
233
233
234
234
issue_number = _get_issue_number (token , report_title , _REPORT_LABEL )
235
- previous_comment = github .get_issue_body (token , issue_number )
235
+ previous_comment = firebase_github .get_issue_body (token , issue_number )
236
236
[previous_prefix , previous_comment_repo , previous_comment_sdk ,
237
237
previous_comment_tip ] = previous_comment .split (_COMMENT_HIDDEN_DIVIDER )
238
238
logging .info ("Previous prefix: %s" , previous_prefix )
@@ -284,15 +284,15 @@ def test_report(token, actor, commit, run_id, build_against, build_apis):
284
284
comment = prefix + _COMMENT_HIDDEN_DIVIDER + previous_comment_repo + _COMMENT_HIDDEN_DIVIDER + previous_comment_sdk + _COMMENT_HIDDEN_DIVIDER + comment
285
285
286
286
if (_COMMENT_TITLE_SUCCEED_REPO in comment ) and (_COMMENT_TITLE_SUCCEED_SDK in comment ) and (build_apis != _BUILD_API_FIRESTORE or _COMMENT_TITLE_SUCCEED_TIP in comment ):
287
- github .close_issue (token , issue_number )
287
+ firebase_github .close_issue (token , issue_number )
288
288
else :
289
- github .open_issue (token , issue_number )
289
+ firebase_github .open_issue (token , issue_number )
290
290
291
- github .update_issue_comment (token , issue_number , comment )
291
+ firebase_github .update_issue_comment (token , issue_number , comment )
292
292
293
293
294
294
def _get_issue_number (token , title , label ):
295
- issues = github .search_issues_by_label (label )
295
+ issues = firebase_github .search_issues_by_label (label )
296
296
for issue in issues :
297
297
if issue ["title" ] == title :
298
298
return issue ["number" ]
@@ -303,19 +303,19 @@ def _get_issue_number(token, title, label):
303
303
_COMMENT_HIDDEN_DIVIDER + " " +
304
304
_COMMENT_HIDDEN_DIVIDER + " "
305
305
)
306
- return github .create_issue (token , title , label , empty_comment )["number" ]
306
+ return firebase_github .create_issue (token , title , label , empty_comment )["number" ]
307
307
308
308
309
309
def _update_comment (token , issue_number , comment ):
310
310
comment_id = _get_comment_id (token , issue_number , _COMMENT_HIDDEN_DIVIDER )
311
311
if not comment_id :
312
- github .add_comment (token , issue_number , comment )
312
+ firebase_github .add_comment (token , issue_number , comment )
313
313
else :
314
- github .update_comment (token , comment_id , comment )
314
+ firebase_github .update_comment (token , comment_id , comment )
315
315
316
316
317
317
def _get_comment_id (token , issue_number , comment_identifier ):
318
- comments = github .list_comments (token , issue_number )
318
+ comments = firebase_github .list_comments (token , issue_number )
319
319
for comment in comments :
320
320
if comment_identifier in comment ['body' ]:
321
321
return comment ['id' ]
@@ -342,7 +342,7 @@ def _get_summary_table(token, run_id):
342
342
343
343
344
344
def _get_artifact_id (token , run_id , name ):
345
- artifacts = github .list_artifacts (token , run_id )
345
+ artifacts = firebase_github .list_artifacts (token , run_id )
346
346
for artifact in artifacts :
347
347
if artifact ["name" ] == name :
348
348
return artifact ["id" ]
0 commit comments