4141
4242import datetime
4343import pytz
44- import shutil
4544
4645from absl import app
4746from absl import flags
48- from absl import logging
4947
50- import github
48+ import firebase_github
5149import summarize_test_results as summarize
5250
5351_REPORT_LABEL = "nightly-testing"
112110
113111def test_start (token , issue_number , actor , commit , run_id ):
114112 """In PR, when start testing, add comment and label \" tests: in-progress\" """
115- github .add_label (token , issue_number , _LABEL_PROGRESS )
113+ firebase_github .add_label (token , issue_number , _LABEL_PROGRESS )
116114 for label in [_LABEL_TRIGGER_FULL , _LABEL_TRIGGER_QUICK , _LABEL_FAILED , _LABEL_SUCCEED ]:
117- github .delete_label (token , issue_number , label )
115+ firebase_github .delete_label (token , issue_number , label )
118116
119117 comment = (_COMMENT_TITLE_PROGESS +
120118 _get_description (actor , commit , run_id ) +
@@ -136,7 +134,7 @@ def test_progress(token, issue_number, actor, commit, run_id):
136134 else :
137135 # failures/errors still exist after retry
138136 title = _COMMENT_TITLE_PROGESS_FAIL
139- github .add_label (token , issue_number , _LABEL_FAILED )
137+ firebase_github .add_label (token , issue_number , _LABEL_FAILED )
140138 comment = (title +
141139 _get_description (actor , commit , run_id ) +
142140 log_summary +
@@ -151,7 +149,7 @@ def test_end(token, issue_number, actor, commit, run_id, new_token):
151149 success_or_only_flakiness , log_summary = _get_summary_table (token , run_id )
152150 if success_or_only_flakiness and not log_summary :
153151 # succeeded (without flakiness)
154- github .add_label (token , issue_number , _LABEL_SUCCEED )
152+ firebase_github .add_label (token , issue_number , _LABEL_SUCCEED )
155153 comment = (_COMMENT_TITLE_SUCCEED +
156154 _get_description (actor , commit , run_id ) +
157155 _COMMENT_SUFFIX )
@@ -160,18 +158,18 @@ def test_end(token, issue_number, actor, commit, run_id, new_token):
160158 if success_or_only_flakiness :
161159 # all failures/errors are due to flakiness (succeeded after retry)
162160 title = _COMMENT_TITLE_FLAKY
163- github .add_label (token , issue_number , _LABEL_SUCCEED )
161+ firebase_github .add_label (token , issue_number , _LABEL_SUCCEED )
164162 else :
165163 # failures/errors still exist after retry
166164 title = _COMMENT_TITLE_FAIL
167- github .add_label (token , issue_number , _LABEL_FAILED )
165+ firebase_github .add_label (token , issue_number , _LABEL_FAILED )
168166 comment = (title +
169167 _get_description (actor , commit , run_id ) +
170168 log_summary +
171169 _COMMENT_SUFFIX )
172170 _update_comment (token , issue_number , comment )
173171
174- github .delete_label (new_token , issue_number , _LABEL_PROGRESS )
172+ firebase_github .delete_label (new_token , issue_number , _LABEL_PROGRESS )
175173
176174
177175def test_report (token , actor , commit , run_id ):
@@ -194,32 +192,32 @@ def test_report(token, actor, commit, run_id):
194192 comment = title + _get_description (actor , commit , run_id ) + log_summary
195193
196194 if title == _COMMENT_TITLE_SUCCEED :
197- github .close_issue (token , issue_number )
195+ firebase_github .close_issue (token , issue_number )
198196 else :
199- github .open_issue (token , issue_number )
197+ firebase_github .open_issue (token , issue_number )
200198
201- github .update_issue_comment (token , issue_number , comment )
199+ firebase_github .update_issue_comment (token , issue_number , comment )
202200
203201
204202def _get_issue_number (token , title , label ):
205- issues = github .search_issues_by_label (label )
203+ issues = firebase_github .search_issues_by_label (label )
206204 for issue in issues :
207205 if issue ["title" ] == title :
208206 return issue ["number" ]
209207
210- return github .create_issue (token , title , label , _COMMENT_SUFFIX )["number" ]
208+ return firebase_github .create_issue (token , title , label , _COMMENT_SUFFIX )["number" ]
211209
212210
213211def _update_comment (token , issue_number , comment ):
214212 comment_id = _get_comment_id (token , issue_number , _COMMENT_SUFFIX )
215213 if not comment_id :
216- github .add_comment (token , issue_number , comment )
214+ firebase_github .add_comment (token , issue_number , comment )
217215 else :
218- github .update_comment (token , comment_id , comment )
216+ firebase_github .update_comment (token , comment_id , comment )
219217
220218
221219def _get_comment_id (token , issue_number , comment_identifier ):
222- comments = github .list_comments (token , issue_number )
220+ comments = firebase_github .list_comments (token , issue_number )
223221 for comment in comments :
224222 if comment_identifier in comment ['body' ]:
225223 return comment ['id' ]
@@ -245,7 +243,7 @@ def _get_summary_table(token, run_id):
245243
246244
247245def _get_artifact_id (token , run_id , name ):
248- artifacts = github .list_artifacts (token , run_id )
246+ artifacts = firebase_github .list_artifacts (token , run_id )
249247 for artifact in artifacts :
250248 if artifact ["name" ] == name :
251249 return artifact ["id" ]
0 commit comments