Skip to content

Commit

Permalink
Make Buildkite annotation work
Browse files Browse the repository at this point in the history
Instead of relying on env variable used by previously used Fastlane Firebase action, we'll parse report generated by fladle/flank
  • Loading branch information
wzieba committed Aug 1, 2024
1 parent 14ba431 commit f4e7f6f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions fastlane/lanes/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@

gradle(tasks: ["WordPress:assemble#{app.to_s.capitalize}VanillaDebug", "WordPress:assemble#{app.to_s.capitalize}VanillaDebugAndroidTest"])

test_succeeded = gradle(task: "runFlank#{app.to_s.capitalize}")

annotation_ctx = "firebase-test-#{app}-vanilla-debug"
if test_succeeded
sh("buildkite-agent annotation remove --context '#{annotation_ctx}' || true") if is_ci?
else
details_url = lane_context[SharedValues::FIREBASE_TEST_MORE_DETAILS_URL]
message = "Firebase Tests failed. Failure details can be seen [here in Firebase Console](#{details_url})"
sh('buildkite-agent', 'annotate', message, '--style', 'error', '--context', annotation_ctx) if is_ci?
UI.test_failure!(message)
begin
gradle(task: "runnFlank#{app.to_s.capitalize}")
sh("buildkite-agent annotation remove --context '#{annotation_ctx}' || true") if is_ci?
rescue
details_url = sh('jq ".[].webLink" ~/WordPress-Android/build/instrumented-tests/matrix_ids.json -r')
message = "Firebase Tests failed. Failure details can be seen [here in Firebase Console](#{details_url})"
sh('buildkite-agent', 'annotate', message, '--style', 'error', '--context', annotation_ctx) if is_ci?
UI.test_failure!(message)
end
end
end

0 comments on commit f4e7f6f

Please sign in to comment.