Skip to content

Commit

Permalink
Add initial Danger setup with Dangermattic
Browse files Browse the repository at this point in the history
  • Loading branch information
iangmaia committed Oct 13, 2023
1 parent 5422592 commit 8dcf74d
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 13 deletions.
9 changes: 9 additions & 0 deletions .buildkite/commands/danger-pr-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -eu

export DANGER_GITHUB_API_TOKEN=${GITHUB_TOKEN}

echo "--- :rubygems: Setting up Gems"
bundle install

echo "--- Running Danger: PR Check"
bundle exec danger --fail-on-errors=true --dangerfile=.buildkite/danger/Dangerfile --remove-previous-comments --danger_id=pr-check
18 changes: 18 additions & 0 deletions .buildkite/danger/Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

return if github.pr_labels.include?('Releases')

manifest_pr_checker.check_gemfile_lock_updated
labels_checker.check(
required_labels: [//],
required_labels_error: 'PR is missing at least one label.'
)
view_changes_need_screenshots.view_changes_need_screenshots
pr_size_checker.check_diff_size
android_unit_test_checker.check_missing_tests
milestone_checker.check_milestone_due_date(days_before_due: 2)

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

warn "No reviewers have been set for this PR yet. Please request a review from **@\u2028Automattic/pocket-casts-android**." unless github.pr_json['assignee']
33 changes: 25 additions & 8 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,31 @@ steps:
# Wait for Gradle Wrapper to be validated before running any other jobs
- wait

- group: "Linters"
steps:
- label: "☢️ Danger - PR Check"
command: .buildkite/commands/danger-pr-check.sh
plugins:
- docker#v5.8.0:
image: "public.ecr.aws/docker/library/ruby:3.2.2"
propagate-environment: true
environment:
- "GITHUB_TOKEN"
if: "build.pull_request.id != null"
agents:
queue: "default"
retry:
manual:
permit_on_passed: true

- label: 'Lint'
command: |
echo "--- 🧹 Linting"
./gradlew lintDebug
plugins: *common_plugins
artifact_paths:
- "**/build/reports/lint-results*.*"

- label: 'Unit tests'
command: |
echo "--- 🧪 Testing"
Expand All @@ -28,14 +53,6 @@ steps:
./gradlew spotlessCheck
plugins: *common_plugins

- label: 'Lint'
command: |
echo "--- 🧹 Linting"
./gradlew lintDebug
plugins: *common_plugins
artifact_paths:
- "**/build/reports/lint-results*.*"

- label: "Instrumented tests"
command: |
echo "--- :rubygems: Setting up Gems"
Expand Down
31 changes: 31 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
inherit_mode:
merge:
- Include

AllCops:
Exclude:
- vendor/**/*
Include:
- .buildkite/danger/**/*
NewCops: enable

Layout/LineLength:
Max: 180
Exclude:
- fastlane/Fastfile
- scripts/themes/generate_themes.rb

Metrics/BlockLength:
Exclude:
- fastlane/Fastfile
- scripts/themes/generate_themes.rb

Metrics/MethodLength:
Max: 30
Exclude:
- fastlane/Fastfile
- scripts/themes/generate_themes.rb

Naming/FileName:
Exclude:
- .buildkite/danger/Dangerfile
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.4
3.2.2
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

source "https://rubygems.org"
source 'https://rubygems.org'

gem 'danger-dangermattic', git: 'https://github.com/Automattic/dangermattic'
gem 'fastlane', '~> 2'
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 9.0'

Expand Down
89 changes: 86 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
GIT
remote: https://github.com/Automattic/dangermattic
revision: 0635de8b07954c70a4ed908fc1619774cb8fd10d
specs:
danger-dangermattic (0.0.1)
danger (~> 9.3)
danger-junit (~> 1.0)
danger-plugin-api (~> 1.0)
danger-rubocop (~> 0.11)
danger-swiftlint (~> 0.29)
danger-xcode_summary (~> 1.0)
rubocop (~> 1.56)

GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.6)
rexml
activesupport (7.1.0)
activesupport (7.1.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand All @@ -16,9 +29,10 @@ GEM
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
artifactory (3.0.15)
ast (2.4.2)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.834.0)
aws-partitions (1.835.0)
aws-sdk-core (3.185.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
Expand All @@ -40,12 +54,46 @@ GEM
sawyer (>= 0.6)
chroma (0.2.0)
claide (1.1.0)
claide-plugins (0.9.2)
cork
nap
open4 (~> 1.3)
colored (1.2)
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
cork (0.3.0)
colored2 (~> 3.1)
danger (9.3.2)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
cork (~> 0.1)
faraday (>= 0.9.0, < 3.0)
faraday-http-cache (~> 2.0)
git (~> 1.13)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
no_proxy_fix
octokit (~> 6.0)
terminal-table (>= 1, < 4)
danger-junit (1.0.2)
danger (> 2.0)
ox (~> 2.0)
danger-plugin-api (1.0.0)
danger (> 2.0)
danger-rubocop (0.12.0)
danger
rubocop (~> 1.0)
danger-swiftlint (0.33.0)
danger
rake (> 10)
thor (~> 0.19)
danger-xcode_summary (1.2.0)
danger-plugin-api (~> 1.0)
xcresult (~> 0.2)
declarative (0.0.20)
diffy (3.4.2)
digest-crc (0.6.5)
Expand Down Expand Up @@ -75,6 +123,8 @@ GEM
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-http-cache (2.5.0)
faraday (>= 0.8)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
Expand Down Expand Up @@ -194,42 +244,71 @@ GEM
jmespath (1.6.2)
json (2.6.3)
jwt (2.7.1)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_server-protocol (3.17.0.3)
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.20.0)
multi_json (1.15.0)
multipart-post (2.3.0)
mutex_m (0.1.2)
nanaimo (0.3.0)
nap (1.1.0)
naturally (2.2.1)
no_proxy_fix (0.1.2)
nokogiri (1.15.4-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-darwin)
racc (~> 1.4)
octokit (6.1.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
open4 (1.3.4)
options (2.3.2)
optparse (0.1.1)
os (1.1.4)
ox (2.14.17)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
plist (3.7.0)
progress_bar (1.3.3)
highline (>= 1.6, < 3)
options (~> 2.3.0)
public_suffix (5.0.3)
racc (1.7.1)
rainbow (3.1.1)
rake (13.0.6)
rake-compiler (1.2.5)
rake
rchardet (1.8.0)
regexp_parser (2.8.2)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.6)
rouge (2.0.7)
rubocop (1.57.1)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
sawyer (0.9.2)
Expand All @@ -247,6 +326,7 @@ GEM
terminal-notifier (2.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (0.20.3)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
Expand All @@ -272,15 +352,18 @@ GEM
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
xcresult (0.2.1)

PLATFORMS
arm64-darwin-21
arm64-darwin-22
x86_64-darwin-20
x86_64-darwin-21

DEPENDENCIES
danger-dangermattic!
fastlane (~> 2)
fastlane-plugin-wpmreleasetoolkit (~> 9.0)

BUNDLED WITH
2.3.22
2.4.19

0 comments on commit 8dcf74d

Please sign in to comment.