Skip to content

Commit 398dfe2

Browse files
authored
Merge pull request #94 from odaridavid/build-env-configs
Config build env
2 parents dfdf616 + f3fcac5 commit 398dfe2

File tree

6 files changed

+87
-80
lines changed

6 files changed

+87
-80
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
/captures
88
.externalNativeBuild
99
.cxx
10+
*.jks
11+
*.tar
12+
keystore.properties

.travis.yml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,31 @@ language: android
22
dist: trusty
33
env:
44
global:
5-
- ANDROID_TARGET=android-22
6-
- ANDROID_ABI=armeabi-v7a
5+
- ANDROID_TARGET=android-22
6+
- ANDROID_ABI=armeabi-v7a
77
android:
88
components:
9-
- tools
10-
- platform-tools
11-
- build-tools-29.0.2
12-
- android-29
13-
- extra
14-
- $ANDROID_TARGET
15-
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
9+
- tools
10+
- platform-tools
11+
- build-tools-29.0.2
12+
- android-29
13+
- extra
14+
- "$ANDROID_TARGET"
15+
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
1616
licenses:
17-
- 'android-sdk-preview-license-52d11cd2'
18-
- 'android-sdk-license-.+'
19-
- 'google-gdk-license-.+'
17+
- android-sdk-preview-license-52d11cd2
18+
- android-sdk-license-.+
19+
- google-gdk-license-.+
20+
before_install:
21+
- openssl aes-256-cbc -K $encrypted_50477c21cd2c_key -iv $encrypted_50477c21cd2c_iv
22+
-in secrets.tar.enc -out secrets.tar -d
23+
- tar xvf secrets.tar
2024
script:
21-
- ./gradlew build jacocoTestReport assembleAndroidTest
22-
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
23-
- emulator -avd test -no-audio -no-window &
24-
- android-wait-for-emulator
25-
- adb shell setprop dalvik.vm.dexopt-flags v=n,o=v
26-
- ./gradlew connectedCheck
25+
- "./gradlew build jacocoTestReport assembleAndroidTest"
26+
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
27+
- emulator -avd test -no-audio -no-window &
28+
- android-wait-for-emulator
29+
- adb shell setprop dalvik.vm.dexopt-flags v=n,o=v
30+
- "./gradlew connectedCheck"
2731
after_success:
28-
- bash <(curl -s https://codecov.io/bash) -t aaf7e8f7-d198-4ac1-9370-e8d4e5840497
32+
- bash <(curl -s https://codecov.io/bash) -t aaf7e8f7-d198-4ac1-9370-e8d4e5840497

README.md

Lines changed: 40 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<a href="https://codecov.io/gh/Davidodari/The-Force-Clean-MVVM-ArchComponents-">
77
<img src="https://codecov.io/gh/Davidodari/The-Force-Clean-MVVM-ArchComponents-/branch/develop/graph/badge.svg?token=8kkIQYTrfQ" />
88
</a>&nbsp;
9-
<a href="https://www.codacy.com/manual/Davidodari/Clean-MVVM-ArchComponents?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=odaridavid/Clean-MVVM-ArchComponents&amp;utm_campaign=Badge_Grade"><img src="https://app.codacy.com/project/badge/Grade/aff63473b3e7420f9c23ffb4a64b19ed"/></a>
9+
<a href="https://codebeat.co/projects/github-com-odaridavid-clean-mvvm-archcomponents-develop"><img alt="codebeat badge" src="https://codebeat.co/badges/3032633f-5bec-413e-a5fa-b385fe7cc298" /></a>
1010
</p>
1111

1212
# The-Force
@@ -19,24 +19,54 @@ Min Api Level : 21 [Supports Over 87% Devices ](https://developer.android.com/ab
1919

2020
Build System : [Gradle](https://gradle.org/)
2121

22+
## Table of Contents
23+
24+
- [Prerequisite](#prerequisite)
25+
- [Architecture](#architecture)
26+
- [Testing](#testing)
27+
- [Libraries](#libraries)
28+
- [Contributors](#contributors)
29+
- [Related Posts](#related-posts)
30+
- [Demo](#demo)
31+
2232
## Prerequisite
2333

2434
Before running the project create a [firebase project](https://firebase.google.com/)
2535
and replace the **google-services.json** with yours in the `app` directory for a successful build and
26-
enable crashylitics.
36+
enable crashlytics.
2737
```
2838
package-name: com.k0d4black.theforce
2939
```
3040

31-
## Table of Contents
41+
To run the release build successfully in travis you will need to replace the default values in
42+
```keystore.properties.sample```file with your own in a ```keystore.properties``` file.
3243

33-
- [Architecture](#architecture)
34-
- [Testing](#testing)
35-
- [Libraries](#libraries)
36-
- [Contributors](#contributors)
37-
- [Extras](#extras)
38-
- [Related Posts](#related-posts)
39-
- [Demo](#demo)
44+
Next archive your keystore file and the properties file with the following command
45+
```shell script
46+
tar cvf secrets.tar keystore.properties theforce.jks
47+
```
48+
49+
Next encrypt the archive and add config to travis with the following command
50+
```shell script
51+
travis encrypt-file --pro secrets.tar --add
52+
```
53+
54+
Verify that in your travis.yml in the ```before_install``` it looks something like
55+
```yaml
56+
before_install:
57+
- openssl aes-256-cbc -K $encrypted_5880cf525281_key -iv $encrypted_5880cf525281_iv -in secrets.tar.enc -out secrets.tar -d
58+
- tar xvf secrets.tar
59+
```
60+
61+
Make sure to add only the `*.enc` file to git,leave out the keystore.properties and `*.jks` file.
62+
Add the following to the root `.gitignore` just to be sure
63+
```gitignore
64+
*.jks
65+
*.tar
66+
keystore.properties
67+
```
68+
69+
If you encounter any error check [this site](https://docs.travis-ci.com/user/encrypting-files/) out.
4070

4171
## Architecture
4272

@@ -177,57 +207,6 @@ and default parameters
177207

178208
Feel free to contribute in any way to the project.
179209

180-
## Extras
181-
182-
#### Gradle Dependencies
183-
184-
Centralized versioning of gradle dependencies in a global file,
185-
```dependencies.gradle```, visible to all available modules.This helps
186-
maintain dependency versioning for different modules as well as improve
187-
dependency organisation and readability by providing a clear separation
188-
of which dependencies go where.
189-
190-
#### CI-Pipeline
191-
192-
[Travis CI](https://travis-ci.com/) is used for development pipeline to
193-
automatically build and test the project every time you push updates to
194-
version control.
195-
196-
#### Code Analysis
197-
198-
With static code analysis you can enforce a consistent style guide on
199-
the project.This is possible by defining constraints with Detekt.
200-
201-
This Project is integrated with [Codacy](https://www.codacy.com/) that
202-
makes use of Detekt for static code analysis on Kotlin files.You can
203-
either configure rules from their dashboard or enforce a Detekt
204-
configuration locally and port it to codacy.
205-
206-
The rules can be configured to be checked for each pull request,commit
207-
or merge made.
208-
209-
#### Resource Values
210-
211-
**Fonts**
212-
213-
The app makes use of downloadable fonts which reduces APK size compared to
214-
having the font files within the app.
215-
216-
**Dimension & String Values**
217-
218-
String values are stored in the strings value file this will make it
219-
easier for app localization and internationalization as well as string
220-
templating currently utilised by data binding.
221-
222-
Dimensions have also been stored in a dimensions value file making it
223-
easy to reuse dimension values across the app.
224-
225-
**Themes & Styles**
226-
227-
Theming is guided by the material design specifications with a ```DayNight```
228-
theme which can later be used to provide Night variant for the app and
229-
enhance user experience.
230-
231210
## Demo
232211

233212
<img src="art/force_gif.gif" width=200/>

app/build.gradle

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,24 @@ jacocoAndroidUnitTestReport {
2424
xml.enabled true
2525
}
2626

27+
def keystorePropertiesFile = rootProject.file("keystore.properties")
28+
def keystoreProperties = new Properties()
29+
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
30+
2731
android {
2832

2933
compileSdkVersion rootProject.ext.compileSdkVersion
3034
buildToolsVersion rootProject.ext.buildToolsVersion
3135

36+
signingConfigs {
37+
release {
38+
keyAlias keystoreProperties['keyAlias']
39+
keyPassword keystoreProperties['keyPassword']
40+
storeFile file(keystoreProperties['storeFile'])
41+
storePassword keystoreProperties['storePassword']
42+
}
43+
}
44+
3245
defaultConfig {
3346
applicationId "com.k0d4black.theforce"
3447
minSdkVersion rootProject.ext.minSdkVersion
@@ -38,6 +51,7 @@ android {
3851
testInstrumentationRunner "com.k0d4black.theforce.runner.MockTestRunner"
3952
}
4053
buildTypes {
54+
4155
release {
4256
minifyEnabled false
4357
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
@@ -46,7 +60,9 @@ android {
4660
appIcon : "@mipmap/ic_launcher",
4761
appIconRound : "@mipmap/ic_launcher_round"
4862
]
63+
signingConfig signingConfigs.release
4964
}
65+
5066
debug {
5167
applicationIdSuffix ".debug"
5268
versionNameSuffix "-debug"

keystore.properties.sample

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//Replace values with your own
2+
storePassword=storePassword
3+
keyPassword=keyPassword
4+
keyAlias=keyAlias
5+
storeFile=storeFileLocation

secrets.tar.enc

10 KB
Binary file not shown.

0 commit comments

Comments
 (0)