Skip to content

Commit

Permalink
Use danger to report test results in PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
crazytonyli committed Oct 12, 2022
1 parent 20ec574 commit 687c08a
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .buildkite/commands/danger.sh
@@ -0,0 +1,12 @@
#!/bin/bash -eu

echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :junit: Downloading junit reports"
buildkite-agent artifact download --step unit-tests "build/results/report.junit" ./unit-tests.junit
buildkite-agent artifact download --step ui-tests-iphone "build/results/report.junit" ./ui-tests-iphone.junit
buildkite-agent artifact download --step ui-tests-ipad "build/results/report.junit" ./ui-tests-ipad.junit

echo "--- :no_entry_sign: Run Danger"
bundle exec danger --fail-on-errors=true
7 changes: 0 additions & 7 deletions .buildkite/commands/rubocop-via-danger.sh

This file was deleted.

7 changes: 7 additions & 0 deletions .buildkite/pipeline.yml
Expand Up @@ -52,6 +52,7 @@ steps:
# Run Unit Tests
#################
- label: "🔬 Unit Tests"
key: "unit-tests"
command: ".buildkite/commands/run-unit-tests.sh"
depends_on: "build"
env: *common_env
Expand All @@ -72,6 +73,7 @@ steps:
- group: "🔬 UI Tests"
steps:
- label: "🔬 UI Tests (iPhone)"
key: "ui-tests-iphone"
command: .buildkite/commands/run-ui-tests.sh 'iPhone SE (3rd generation)'
depends_on: "build"
env: *common_env
Expand All @@ -87,6 +89,7 @@ steps:
if: build.state == "failed" && build.branch == "trunk"

- label: "🔬 UI Tests (iPad)"
key: "ui-tests-ipad"
command: .buildkite/commands/run-ui-tests.sh "iPad Air (5th generation)"
depends_on: "build"
env: *common_env
Expand Down Expand Up @@ -124,5 +127,9 @@ steps:
# That is, it outwardly only mentions RuboCop, not Danger
- label: ":rubocop: Lint Ruby Tooling"
command: .buildkite/commands/rubocop-via-danger.sh
depends_on:
- unit-tests
- ui-tests-iphone
- ui-tests-ipad
env: *common_env
plugins: *common_plugins
5 changes: 5 additions & 0 deletions Dangerfile
Expand Up @@ -2,3 +2,8 @@

github.dismiss_out_of_range_messages
rubocop.lint inline_comment: true, fail_on_inline_comment: true

%w[unit-tests ui-tests-iphone ui-tests-ipad].each do |file|
junit.parse "#{file}.junit"
junit.report
end
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -6,6 +6,7 @@ gem 'cocoapods', '~> 1.11'
gem 'commonmarker'
gem 'danger', '~> 8.6'
gem 'danger-rubocop', '~> 0.10'
gem 'danger-junit', '~> 1.0'
gem 'dotenv'
gem 'fastlane', '~> 2.174'
gem 'fastlane-plugin-appcenter', '~> 1.8'
Expand Down
7 changes: 6 additions & 1 deletion Gemfile.lock
Expand Up @@ -101,6 +101,9 @@ GEM
no_proxy_fix
octokit (~> 4.7)
terminal-table (>= 1, < 4)
danger-junit (1.0.2)
danger (> 2.0)
ox (~> 2.0)
danger-rubocop (0.10.0)
danger
rubocop (~> 1.0)
Expand Down Expand Up @@ -290,6 +293,7 @@ GEM
options (2.3.2)
optparse (0.1.1)
os (1.1.4)
ox (2.14.11)
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
Expand Down Expand Up @@ -382,6 +386,7 @@ DEPENDENCIES
cocoapods (~> 1.11)
commonmarker
danger (~> 8.6)
danger-junit (~> 1.0)
danger-rubocop (~> 0.10)
dotenv
fastlane (~> 2.174)
Expand All @@ -396,4 +401,4 @@ DEPENDENCIES
xcpretty-travis-formatter

BUNDLED WITH
2.3.23
2.3.22

0 comments on commit 687c08a

Please sign in to comment.