Skip to content

Commit 003bb3b

Browse files
[#493] Create New files for Danger integration in template android
[#498] Added JDK setup in github action [#493] Update code according to PR comment for template_review_pull_request.yml
1 parent ecbd6e1 commit 003bb3b

File tree

5 files changed

+234
-10
lines changed

5 files changed

+234
-10
lines changed

.github/workflows/review_pull_request.yml

+1-10
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
uses: ruby/setup-ruby@v1
5454
with:
5555
ruby-version: '2.7'
56+
bundler-cache: true
5657

5758
- name: Cache gems
5859
uses: actions/cache@v2
@@ -62,16 +63,6 @@ jobs:
6263
restore-keys: |
6364
${{ runner.os }}-gems-
6465
65-
- name: Install Bundle and check environment versions
66-
run: |
67-
echo 'Install Bundle'
68-
bundle config path vendor/bundle
69-
bundle install
70-
echo 'Check environment setup versions'
71-
ruby --version
72-
gem --version
73-
bundler --version
74-
7566
- name: Run Danger
7667
env:
7768
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Review pull request
2+
3+
on:
4+
pull_request:
5+
types: [ opened, reopened, ready_for_review, synchronize ]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
review_pull_request:
13+
if: github.event.pull_request.draft == false
14+
name: Review pull request
15+
runs-on: ubuntu-latest
16+
environment: staging
17+
timeout-minutes: 30
18+
steps:
19+
- name: Checkout source code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 100
23+
24+
- name: Cache Gradle
25+
uses: actions/cache@v2
26+
with:
27+
path: |
28+
~/.gradle/caches/modules-*
29+
~/.gradle/caches/jars-*
30+
~/.gradle/caches/build-cache-*
31+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
32+
restore-keys: |
33+
${{ runner.os }}-gradle-
34+
35+
- name: Set up JDK 17
36+
uses: actions/setup-java@v3
37+
with:
38+
distribution: 'temurin'
39+
java-version: '17'
40+
41+
- name: Set up Ruby
42+
uses: ruby/setup-ruby@v1
43+
with:
44+
ruby-version: '2.7'
45+
46+
- name: Cache gems
47+
uses: actions/cache@v2
48+
with:
49+
path: vendor/bundle
50+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
51+
restore-keys: |
52+
${{ runner.os }}-gems-
53+
54+
- name: Install Bundle and check environment versions
55+
run: |
56+
echo 'Install Bundle'
57+
bundle config path vendor/bundle
58+
bundle install
59+
echo 'Check environment setup versions'
60+
ruby --version
61+
gem --version
62+
bundler --version
63+
64+
- name: Run Danger
65+
env:
66+
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
run: bundle exec danger

template-compose/Dangerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
2+
warn("PR is classed as Work in Progress") if github.pr_title.include? "WIP"
3+
4+
# Warn when there is a big PR
5+
warn("Big PR") if git.lines_of_code > 500
6+
7+
# Warn to encourage a PR description
8+
warn("Please provide a summary in the PR description to make it easier to review") if github.pr_body.length == 0
9+
10+
# Warn to encourage that labels should have been used on the PR
11+
warn("Please add labels to this PR") if github.pr_labels.empty?
12+
13+
# Check commits lint and warn on all checks (instead of failing)
14+
commit_lint.check warn: :all, disable: [:subject_length]
15+
16+
# Detekt output check
17+
detekt_dir = "**/build/reports/detekt/detekt-result.xml"
18+
Dir[detekt_dir].each do |file_name|
19+
kotlin_detekt.skip_gradle_task = true
20+
kotlin_detekt.report_file = file_name
21+
kotlin_detekt.detekt(inline_mode: true)
22+
end
23+
24+
# Android Lint output check
25+
lint_dir = "**/**/build/reports/lint/lint-result.xml"
26+
Dir[lint_dir].each do |file_name|
27+
android_lint.skip_gradle_task = true
28+
android_lint.report_file = file_name
29+
android_lint.lint(inline_mode: true)
30+
end
31+
32+
# Show Danger test coverage report from Kover for templates
33+
# Report coverage of modified files, warn if total project coverage is under 80%
34+
# or if any modified file's coverage is under 95%
35+
36+
kover_file_template = "app/build/reports/kover/report.xml"
37+
markdown "## Kover report for $project:"
38+
shroud.reportKover "$project: Unit Tests", kover_file_template, 80, 95, false

template-compose/Gemfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6+
7+
gem 'danger'
8+
gem 'danger-android_lint'
9+
gem 'danger-commit_lint'
10+
gem 'danger-kotlin_detekt'
11+
gem 'danger-shroud'

template-compose/Gemfile.lock

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
addressable (2.8.1)
5+
public_suffix (>= 2.0.2, < 6.0)
6+
ansi (1.5.0)
7+
ast (2.4.2)
8+
claide (1.1.0)
9+
claide-plugins (0.9.2)
10+
cork
11+
nap
12+
open4 (~> 1.3)
13+
colored2 (3.1.2)
14+
cork (0.3.0)
15+
colored2 (~> 3.1)
16+
danger (8.6.1)
17+
claide (~> 1.0)
18+
claide-plugins (>= 0.9.2)
19+
colored2 (~> 3.1)
20+
cork (~> 0.1)
21+
faraday (>= 0.9.0, < 2.0)
22+
faraday-http-cache (~> 2.0)
23+
git (~> 1.7)
24+
kramdown (~> 2.3)
25+
kramdown-parser-gfm (~> 1.0)
26+
no_proxy_fix
27+
octokit (~> 4.7)
28+
terminal-table (>= 1, < 4)
29+
danger-android_lint (0.0.11)
30+
danger-plugin-api (~> 1.0)
31+
oga
32+
danger-commit_lint (0.0.7)
33+
danger-plugin-api (~> 1.0)
34+
danger-kotlin_detekt (0.0.3)
35+
danger-plugin-api (~> 1.0)
36+
danger-plugin-api (1.0.0)
37+
danger (> 2.0)
38+
danger-shroud (0.0.5)
39+
danger-plugin-api (~> 1.0)
40+
nokogiri
41+
faraday (1.10.2)
42+
faraday-em_http (~> 1.0)
43+
faraday-em_synchrony (~> 1.0)
44+
faraday-excon (~> 1.1)
45+
faraday-httpclient (~> 1.0)
46+
faraday-multipart (~> 1.0)
47+
faraday-net_http (~> 1.0)
48+
faraday-net_http_persistent (~> 1.0)
49+
faraday-patron (~> 1.0)
50+
faraday-rack (~> 1.0)
51+
faraday-retry (~> 1.0)
52+
ruby2_keywords (>= 0.0.4)
53+
faraday-em_http (1.0.0)
54+
faraday-em_synchrony (1.0.0)
55+
faraday-excon (1.1.0)
56+
faraday-http-cache (2.4.1)
57+
faraday (>= 0.8)
58+
faraday-httpclient (1.0.1)
59+
faraday-multipart (1.0.4)
60+
multipart-post (~> 2)
61+
faraday-net_http (1.0.1)
62+
faraday-net_http_persistent (1.2.0)
63+
faraday-patron (1.0.0)
64+
faraday-rack (1.0.0)
65+
faraday-retry (1.0.3)
66+
git (1.13.2)
67+
addressable (~> 2.8)
68+
rchardet (~> 1.8)
69+
kramdown (2.4.0)
70+
rexml
71+
kramdown-parser-gfm (1.1.0)
72+
kramdown (~> 2.0)
73+
multipart-post (2.2.3)
74+
nap (1.1.0)
75+
no_proxy_fix (0.1.2)
76+
nokogiri (1.14.3-arm64-darwin)
77+
racc (~> 1.4)
78+
nokogiri (1.14.3-x86_64-darwin)
79+
racc (~> 1.4)
80+
nokogiri (1.14.3-x86_64-linux)
81+
racc (~> 1.4)
82+
octokit (4.25.1)
83+
faraday (>= 1, < 3)
84+
sawyer (~> 0.9)
85+
oga (3.4)
86+
ast
87+
ruby-ll (~> 2.1)
88+
open4 (1.3.4)
89+
public_suffix (5.0.1)
90+
racc (1.6.2)
91+
rchardet (1.8.0)
92+
rexml (3.2.5)
93+
ruby-ll (2.1.2)
94+
ansi
95+
ast
96+
ruby2_keywords (0.0.5)
97+
sawyer (0.9.2)
98+
addressable (>= 2.3.5)
99+
faraday (>= 0.17.3, < 3)
100+
terminal-table (3.0.2)
101+
unicode-display_width (>= 1.1.1, < 3)
102+
unicode-display_width (2.3.0)
103+
104+
PLATFORMS
105+
universal-darwin-21
106+
x86_64-darwin-20
107+
x86_64-linux
108+
109+
DEPENDENCIES
110+
danger
111+
danger-android_lint
112+
danger-commit_lint
113+
danger-kotlin_detekt
114+
danger-shroud
115+
116+
BUNDLED WITH
117+
2.3.1

0 commit comments

Comments
 (0)