Skip to content

Commit aab52b3

Browse files
authored
Merge pull request #25 from superus8r/ci-configure-sonar-cloud
Ci configure sonar cloud
2 parents 7a464e7 + 68ad67d commit aab52b3

File tree

13 files changed

+289
-168
lines changed

13 files changed

+289
-168
lines changed

.circleci/config.yml

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
version: 2.1
22
orbs:
33
codecov: codecov/[email protected]
4+
ruby: circleci/[email protected]
45

56
commands:
67
restore_gradle_cache:
@@ -21,34 +22,57 @@ commands:
2122
- ~/.gradle/caches
2223
key: v1-gradle-cache-{{ arch }}-{{ checksum "build.gradle" }}
2324

24-
jobs:
25-
android-test:
25+
executors:
26+
android-machine:
2627
machine:
2728
image: android:2022.12.1
29+
android-docker:
30+
docker:
31+
- image: cimg/android:2023.02
32+
33+
jobs:
34+
android-test:
35+
executor: android-machine
2836
resource_class: large
2937
steps:
30-
- run: lsb_release -a
3138
- checkout
32-
- run: python3 scripts/generateKsPropFile.py
33-
- run: python3 scripts/generateGoogleServicesJson.py
3439
- restore_gradle_cache
35-
- run: ./gradlew tasks
40+
- ruby/install-deps:
41+
with-cache: true
42+
- run:
43+
name: Fastlane - run all tests with coverage report
44+
command: |
45+
bundle exec fastlane testDev
3646
- save_gradle_cache
37-
- run: sdkmanager --list
38-
- run: (yes || true) | sdkmanager "tools" "platform-tools" "build-tools;33.0.2" "platforms;android-33" "system-images;android-30;google_atd;x86"
39-
- run: (yes || true) | sdkmanager --licenses
40-
- run: ./gradlew assembleDebug --stacktrace
41-
- run: ./gradlew pixel2api30DebugAndroidTest --stacktrace
42-
- run: ./gradlew testDebugUnitTest --stacktrace
43-
- run: ./gradlew jacocoTestReport --stacktrace
47+
- run:
48+
name: Analyze on SonarCloud
49+
command: ./gradlew lintDebug sonar
4450
- codecov/upload:
4551
file: app/build/mergedReportDir/jacocoTestReport/jacocoTestReport.xml
4652
- store_test_results:
4753
path: app/build/test-results/testDebugUnitTest
4854
- store_artifacts:
4955
path: app/build/mergedReportDir
5056

57+
distribute-dev:
58+
executor: android-docker
59+
resource_class: large
60+
steps:
61+
- checkout
62+
- restore_gradle_cache
63+
- run:
64+
name: Prepare Fastlane
65+
command: sudo bundle update
66+
- run:
67+
name: Distribute to Firebase AppTester
68+
command: bundle exec fastlane distDev
69+
- store_artifacts:
70+
path: /home/circleci/project/app/build/outputs/apk/debug/app-debug.apk
71+
destination: fastlane-output-debug
72+
5173
workflows:
5274
workflow:
5375
jobs:
54-
- android-test
76+
- android-test:
77+
context: SonarCloud
78+
- distribute-dev

.github/workflows/android.yml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,31 @@ jobs:
1212
with:
1313
ruby-version: '3.0'
1414
bundler-cache: true
15-
1615
- name: set up JDK 11
1716
uses: actions/setup-java@v1
1817
with:
1918
distribution: 'zulu'
2019
java-version: '11'
21-
- name: set up Python
22-
uses: actions/setup-python@v4
20+
- name: Cache Gradle wrapper
21+
uses: actions/cache@v3
22+
with:
23+
path: ~/.gradle/wrapper
24+
key: ${{ runner.OS }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
25+
restore-keys: |
26+
${{ runner.OS }}-gradle-wrapper-cache-
27+
- name: Cache Gradle caches
28+
uses: actions/cache@v3
2329
with:
24-
python-version: '3.10'
30+
path: ~/.gradle/caches
31+
key: ${{ runner.OS }}-gradle-caches-cache-${{ hashFiles('build.gradle') }}
32+
restore-keys: |
33+
${{ runner.OS }}-gradle-caches-cache-
2534
- name: generate ksProp file
26-
run: python scripts/generateKsPropFile.py
27-
- name: create google-services.json file
28-
run: cat app/google-services.json | base64
29-
- name: update google-services.json file
35+
run: ./gradlew generateKsPropFile
36+
- name: generate google-services.json file
37+
run: ./gradlew generateGoogleServicesJson
3038
env:
31-
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
32-
run: echo $DATA > app/google-services.json
39+
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
3340
- name: setup fastlane
3441
run: bundle install
3542
- name: run unit tests
@@ -49,18 +56,12 @@ jobs:
4956
with:
5057
distribution: 'zulu'
5158
java-version: '11'
52-
- name: set up Python
53-
uses: actions/setup-python@v4
54-
with:
55-
python-version: '3.10'
5659
- name: generate ksProp file
57-
run: python scripts/generateKsPropFile.py
58-
- name: create google-services.json file
59-
run: cat app/google-services.json | base64
60-
- name: update google-services.json file
60+
run: ./gradlew generateKsPropFile
61+
- name: generate google-services.json file
62+
run: ./gradlew generateGoogleServicesJson
6163
env:
62-
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
63-
run: echo $DATA > app/google-services.json
64+
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
6465
- name: Lint
6566
run: bash ./gradlew lintDebug
6667
- name: Lint results
@@ -70,7 +71,7 @@ jobs:
7071
path: app/build/reports/lint-results-debug.html
7172

7273
ui-test:
73-
runs-on: macOS-latest
74+
runs-on: macos-latest
7475
steps:
7576
- name: checkout
7677
uses: actions/checkout@v2
@@ -79,18 +80,12 @@ jobs:
7980
with:
8081
distribution: 'zulu'
8182
java-version: '11'
82-
- name: set up Python
83-
uses: actions/setup-python@v4
84-
with:
85-
python-version: '3.10'
8683
- name: generate ksProp file
87-
run: python scripts/generateKsPropFile.py
88-
- name: create google-services.json file
89-
run: cat app/google-services.json | base64
90-
- name: update google-services.json file
84+
run: ./gradlew generateKsPropFile
85+
- name: generate google-services.json file
86+
run: ./gradlew generateGoogleServicesJson
9187
env:
92-
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
93-
run: echo $DATA > app/google-services.json
88+
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
9489
- name: run tests
9590
uses: reactivecircus/android-emulator-runner@v2
9691
with:

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
source "https://rubygems.org"
22

3-
gem "fastlane"
3+
gem "fastlane"
4+
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
5+
eval_gemfile(plugins_path) if File.exist?(plugins_path)

Gemfile.lock

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
CFPropertyList (3.0.5)
4+
CFPropertyList (3.0.6)
55
rexml
66
addressable (2.8.1)
77
public_suffix (>= 2.0.2, < 6.0)
88
artifactory (3.0.15)
99
atomos (0.1.3)
1010
aws-eventstream (1.2.0)
11-
aws-partitions (1.642.0)
12-
aws-sdk-core (3.158.0)
11+
aws-partitions (1.725.0)
12+
aws-sdk-core (3.170.0)
1313
aws-eventstream (~> 1, >= 1.0.2)
14-
aws-partitions (~> 1, >= 1.525.0)
15-
aws-sigv4 (~> 1.1)
14+
aws-partitions (~> 1, >= 1.651.0)
15+
aws-sigv4 (~> 1.5)
1616
jmespath (~> 1, >= 1.6.1)
17-
aws-sdk-kms (1.58.0)
18-
aws-sdk-core (~> 3, >= 3.127.0)
17+
aws-sdk-kms (1.63.0)
18+
aws-sdk-core (~> 3, >= 3.165.0)
1919
aws-sigv4 (~> 1.1)
20-
aws-sdk-s3 (1.114.0)
21-
aws-sdk-core (~> 3, >= 3.127.0)
20+
aws-sdk-s3 (1.119.1)
21+
aws-sdk-core (~> 3, >= 3.165.0)
2222
aws-sdk-kms (~> 1)
2323
aws-sigv4 (~> 1.4)
2424
aws-sigv4 (1.5.2)
@@ -36,8 +36,8 @@ GEM
3636
unf (>= 0.0.5, < 1.0.0)
3737
dotenv (2.8.1)
3838
emoji_regex (3.2.3)
39-
excon (0.93.0)
40-
faraday (1.10.2)
39+
excon (0.99.0)
40+
faraday (1.10.3)
4141
faraday-em_http (~> 1.0)
4242
faraday-em_synchrony (~> 1.0)
4343
faraday-excon (~> 1.1)
@@ -66,7 +66,7 @@ GEM
6666
faraday_middleware (1.2.0)
6767
faraday (~> 1.0)
6868
fastimage (2.2.6)
69-
fastlane (2.210.1)
69+
fastlane (2.212.1)
7070
CFPropertyList (>= 2.3, < 4.0.0)
7171
addressable (>= 2.8, < 3.0.0)
7272
artifactory (~> 3.0)
@@ -105,10 +105,11 @@ GEM
105105
xcodeproj (>= 1.13.0, < 2.0.0)
106106
xcpretty (~> 0.3.0)
107107
xcpretty-travis-formatter (>= 0.0.3)
108+
fastlane-plugin-firebase_app_distribution (0.5.0)
108109
gh_inspector (1.1.3)
109-
google-apis-androidpublisher_v3 (0.29.0)
110-
google-apis-core (>= 0.9.0, < 2.a)
111-
google-apis-core (0.9.0)
110+
google-apis-androidpublisher_v3 (0.35.0)
111+
google-apis-core (>= 0.11.0, < 2.a)
112+
google-apis-core (0.11.0)
112113
addressable (~> 2.5, >= 2.5.1)
113114
googleauth (>= 0.16.2, < 2.a)
114115
httpclient (>= 2.8.1, < 3.a)
@@ -117,27 +118,27 @@ GEM
117118
retriable (>= 2.0, < 4.a)
118119
rexml
119120
webrick
120-
google-apis-iamcredentials_v1 (0.15.0)
121-
google-apis-core (>= 0.9.0, < 2.a)
122-
google-apis-playcustomapp_v1 (0.11.0)
123-
google-apis-core (>= 0.9.0, < 2.a)
121+
google-apis-iamcredentials_v1 (0.17.0)
122+
google-apis-core (>= 0.11.0, < 2.a)
123+
google-apis-playcustomapp_v1 (0.13.0)
124+
google-apis-core (>= 0.11.0, < 2.a)
124125
google-apis-storage_v1 (0.19.0)
125126
google-apis-core (>= 0.9.0, < 2.a)
126127
google-cloud-core (1.6.0)
127128
google-cloud-env (~> 1.0)
128129
google-cloud-errors (~> 1.0)
129130
google-cloud-env (1.6.0)
130131
faraday (>= 0.17.3, < 3.0)
131-
google-cloud-errors (1.3.0)
132-
google-cloud-storage (1.43.0)
132+
google-cloud-errors (1.3.1)
133+
google-cloud-storage (1.44.0)
133134
addressable (~> 2.8)
134135
digest-crc (~> 0.4)
135136
google-apis-iamcredentials_v1 (~> 0.1)
136137
google-apis-storage_v1 (~> 0.19.0)
137138
google-cloud-core (~> 1.6)
138139
googleauth (>= 0.16.2, < 2.a)
139140
mini_mime (~> 1.0)
140-
googleauth (1.2.0)
141+
googleauth (1.3.0)
141142
faraday (>= 0.17.3, < 3.a)
142143
jwt (>= 1.4, < 3.0)
143144
memoist (~> 0.16)
@@ -148,20 +149,20 @@ GEM
148149
http-cookie (1.0.5)
149150
domain_name (~> 0.5)
150151
httpclient (2.8.3)
151-
jmespath (1.6.1)
152-
json (2.6.2)
153-
jwt (2.5.0)
152+
jmespath (1.6.2)
153+
json (2.6.3)
154+
jwt (2.7.0)
154155
memoist (0.16.2)
155-
mini_magick (4.11.0)
156+
mini_magick (4.12.0)
156157
mini_mime (1.1.2)
157158
multi_json (1.15.0)
158159
multipart-post (2.0.0)
159160
nanaimo (0.3.0)
160161
naturally (2.2.1)
161162
optparse (0.1.1)
162163
os (1.1.4)
163-
plist (3.6.0)
164-
public_suffix (5.0.0)
164+
plist (3.7.0)
165+
public_suffix (5.0.1)
165166
rake (13.0.6)
166167
representable (3.2.0)
167168
declarative (< 0.1.0)
@@ -178,7 +179,7 @@ GEM
178179
faraday (>= 0.17.5, < 3.a)
179180
jwt (>= 1.5, < 3.0)
180181
multi_json (~> 1.10)
181-
simctl (1.6.8)
182+
simctl (1.6.10)
182183
CFPropertyList
183184
naturally
184185
terminal-notifier (2.0.0)
@@ -195,7 +196,7 @@ GEM
195196
unf_ext (0.0.8.2)
196197
unf_ext (0.0.8.2-x64-mingw32)
197198
unicode-display_width (1.8.0)
198-
webrick (1.7.0)
199+
webrick (1.8.1)
199200
word_wrap (1.0.0)
200201
xcodeproj (1.22.0)
201202
CFPropertyList (>= 2.3.3, < 4.0)
@@ -217,6 +218,7 @@ PLATFORMS
217218

218219
DEPENDENCIES
219220
fastlane
221+
fastlane-plugin-firebase_app_distribution
220222

221223
BUNDLED WITH
222-
2.3.7
224+
2.4.7

0 commit comments

Comments
 (0)