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 Sep 20, 2023
1 parent 93013f4 commit 697106a
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 32 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 **@\u2028bloom/toucan**." unless github.pr_json['assignee']
30 changes: 22 additions & 8 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,28 @@ 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"

- 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 +50,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
Loading

0 comments on commit 697106a

Please sign in to comment.