61
61
_COMMENT_TITLE_PROGESS_FAIL = "### ❌ Integration test FAILED (but still ⏳ in progress)\n "
62
62
_COMMENT_TITLE_FAIL = "### ❌ Integration test FAILED\n "
63
63
_COMMENT_TITLE_SUCCEED = "### ✅ Integration test succeeded!\n "
64
+ _COMMENT_TITLE_FAIL_SDK = "\n ***\n ### ❌ Integration test FAILED (build against SDK)\n "
65
+ _COMMENT_TITLE_SUCCEED_SDK = "\n ***\n ### ✅ Integration test succeeded! (build against SDK)\n "
66
+ _COMMENT_TITLE_FAIL_REPO = "### ❌ Integration test FAILED (build against repo)\n "
67
+ _COMMENT_TITLE_SUCCEED_REPO = "### ✅ Integration test succeeded! (build against repo)\n "
64
68
65
69
_COMMENT_FLAKY_TRACKER = "\n \n Add flaky tests to **[go/fpl-cpp-flake-tracker](http://go/fpl-cpp-flake-tracker)**\n "
66
70
67
71
_COMMENT_IDENTIFIER = "integration-test-status-comment"
68
- _COMMENT_SUFFIX = f'\n \n \n <hidden value="{ _COMMENT_IDENTIFIER } "></hidden>'
72
+ _COMMENT_SUFFIX = f'\n <hidden value="{ _COMMENT_IDENTIFIER } "></hidden>'
69
73
70
74
_LOG_ARTIFACT_NAME = "log-artifact"
71
75
_LOG_OUTPUT_DIR = "test_results"
76
80
_BUILD_STAGES_REPORT = "report"
77
81
_BUILD_STAGES = [_BUILD_STAGES_START , _BUILD_STAGES_PROGRESS , _BUILD_STAGES_END , _BUILD_STAGES_REPORT ]
78
82
83
+ _BUILD_AGAINST_SDK = "sdk"
84
+ _BUILD_AGAINST_REPO = "repo"
85
+
79
86
FLAGS = flags .FLAGS
80
87
81
88
flags .DEFINE_string (
105
112
"new_token" , None ,
106
113
"Only used with --stage end"
107
114
"Use a different token to remove the \" in-progress\" label,"
108
- "to allow the removal to trigger the \" Check Labels\" workflow." )
115
+ "to allow the removal to trigger the \" Check Labels\" workflow." )
116
+
117
+ flags .DEFINE_string (
118
+ "build_against" , None ,
119
+ "Integration testapps could either build against packaged SDK or repo" )
120
+
109
121
110
122
def test_start (token , issue_number , actor , commit , run_id ):
111
123
"""In PR, when start testing, add comment and label \" tests: in-progress\" """
@@ -158,33 +170,33 @@ def test_end(token, issue_number, actor, commit, run_id, new_token):
158
170
github .delete_label (new_token , issue_number , _LABEL_PROGRESS )
159
171
160
172
161
- def test_report (token , actor , commit , run_id ):
173
+ def test_report (token , actor , commit , run_id , build_against ):
162
174
"""Update (create if not exist) a Daily Report in Issue.
163
- If test failed, add label \" tests: failed\" and open the Issue,
164
- If test succeed, add label \" tests: succeeded\" and close the Issue.
165
175
The Issue with title _REPORT_TITLE and label _REPORT_LABEL:
166
- https://github.com/firebase/firebase-cpp-sdk/issues?q=is%3Aissue+is%3Aclosed+ label%3Anightly-testing
176
+ https://github.com/firebase/firebase-cpp-sdk/issues?q=is%3Aissue+label%3Anightly-testing
167
177
"""
168
178
issue_number = _get_issue_number (token , _REPORT_TITLE , _REPORT_LABEL )
179
+ previous_comment = github .get_issue_body (token , issue_number )
180
+ [previous_comment_repo , previous_comment_sdk ] = previous_comment .split (_COMMENT_SUFFIX )
169
181
log_summary = _get_summary_talbe (token , run_id )
170
182
if log_summary == 0 :
171
- # github.delete_label(token, issue_number, _LABEL_FAILED)
172
- # github.add_label(token, issue_number, _LABEL_SUCCEED)
183
+ title = _COMMENT_TITLE_SUCCEED_REPO if build_against == _BUILD_AGAINST_REPO else _COMMENT_TITLE_SUCCEED_SDK
184
+ comment = title + _get_description (actor , commit , run_id )
185
+ else :
186
+ title = _COMMENT_TITLE_FAIL_REPO if build_against == _BUILD_AGAINST_REPO else _COMMENT_TITLE_FAIL_SDK
187
+ comment = title + _get_description (actor , commit , run_id ) + log_summary + _COMMENT_FLAKY_TRACKER
188
+
189
+ if build_against == _BUILD_AGAINST_REPO :
190
+ comment = comment + _COMMENT_SUFFIX + previous_comment_sdk
191
+ else :
192
+ comment = previous_comment_repo + _COMMENT_SUFFIX + comment
193
+
194
+ if (_COMMENT_TITLE_SUCCEED_REPO in comment ) and (_COMMENT_TITLE_SUCCEED_SDK in comment ):
173
195
github .close_issue (token , issue_number )
174
- comment = (_COMMENT_TITLE_SUCCEED +
175
- _get_description (actor , commit , run_id ) +
176
- _COMMENT_SUFFIX )
177
- github .update_issue_comment (token , issue_number , comment )
178
196
else :
179
- # github.delete_label(token, issue_number, _LABEL_SUCCEED)
180
- # github.add_label(token, issue_number, _LABEL_FAILED)
181
197
github .open_issue (token , issue_number )
182
- comment = (_COMMENT_TITLE_FAIL +
183
- _get_description (actor , commit , run_id ) +
184
- log_summary +
185
- _COMMENT_FLAKY_TRACKER +
186
- _COMMENT_SUFFIX )
187
- github .update_issue_comment (token , issue_number , comment )
198
+
199
+ github .update_issue_comment (token , issue_number , comment )
188
200
189
201
190
202
def _get_issue_number (token , title , label ):
@@ -193,7 +205,7 @@ def _get_issue_number(token, title, label):
193
205
if issue ["title" ] == title :
194
206
return issue ["number" ]
195
207
196
- return github .create_issue (token , title , label )["number" ]
208
+ return github .create_issue (token , title , label , _COMMENT_SUFFIX )["number" ]
197
209
198
210
199
211
def _update_comment (token , issue_number , comment ):
@@ -255,7 +267,7 @@ def main(argv):
255
267
elif FLAGS .stage == _BUILD_STAGES_END :
256
268
test_end (FLAGS .token , FLAGS .issue_number , FLAGS .actor , FLAGS .commit , FLAGS .run_id , FLAGS .new_token )
257
269
elif FLAGS .stage == _BUILD_STAGES_REPORT :
258
- test_report (FLAGS .token , FLAGS .actor , FLAGS .commit , FLAGS .run_id )
270
+ test_report (FLAGS .token , FLAGS .actor , FLAGS .commit , FLAGS .run_id , FLAGS . build_against )
259
271
else :
260
272
print ("Invalid stage value. Valid value: " + "," .join (_BUILD_STAGES ))
261
273
0 commit comments