Skip to content

Commit 55aa3e6

Browse files
authored
Merge branch 'develop' into OP-2615
2 parents faeb738 + 46a03cc commit 55aa3e6

27 files changed

Lines changed: 1632 additions & 199 deletions

.github/workflows/main.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ on:
66
- '*'
77
# tags:
88
# - '!v*'
9+
pull_request:
10+
branches:
11+
- '*'
12+
types: [opened, synchronize, reopened]
913

1014
jobs:
1115
build:
1216
runs-on: ubuntu-latest
1317

1418
steps:
15-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
1620

1721
- name: Setup JDK 17
18-
uses: actions/setup-java@v2
22+
uses: actions/setup-java@v5
1923
with:
2024
distribution: 'temurin'
2125
java-version: '17'
@@ -31,7 +35,10 @@ jobs:
3135
3236
- name: build
3337
run: |
34-
./gradlew assembleDebug --stacktrace
38+
./gradlew assembleDemoProdDebug --stacktrace
39+
40+
- name: Run gradle tests
41+
run: ./gradlew testDemoProdDebugUnitTest
3542

3643
- name: Environment info
3744
run: |
@@ -44,7 +51,7 @@ jobs:
4451

4552
- name: build
4653
run: |
47-
./gradlew bundleDebug --stacktrace
54+
./gradlew bundleDemoProdDebug --stacktrace
4855
4956
- name: Environment info
5057
run: |

.github/workflows/manual.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
description: Display name of the application
1212
required: false
1313
default: Policies Manual
14+
app_version:
15+
description: Version of the application
16+
required: true
17+
default: v1.0.0
1418
app_dir:
1519
description: Name of the folder in Documents, default IMIS-CLI
1620
required: false
@@ -34,23 +38,23 @@ jobs:
3438
runs-on: ubuntu-latest
3539

3640
steps:
37-
- uses: actions/checkout@v2
41+
- uses: actions/checkout@v4
3842

3943
- name: Setup JDK 17
40-
uses: actions/setup-java@v2
44+
uses: actions/setup-java@v5
4145
with:
4246
distribution: 'temurin'
4347
java-version: '17'
4448
cache: 'gradle'
4549

46-
- uses: actions/cache@v2
50+
- uses: actions/cache@v4
4751
with:
4852
path: |
4953
~/.gradle/caches
5054
~/.gradle/wrapper
5155
key: ${{ runner.os }}-${{ github.event.inputs.application_id }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
5256

53-
- uses: actions/cache@v2
57+
- uses: actions/cache@v4
5458
with:
5559
path: |
5660
~/.android
@@ -88,11 +92,27 @@ jobs:
8892
run: |
8993
gradle --version
9094
95+
# Run Tests Build
96+
- name: Run gradle tests
97+
run: ./gradlew testCliDebugUnitTest
98+
9199
- uses: actions/upload-artifact@v4
92100
with:
93101
name: openimis-policies-apk-${{github.run_number}}-${{github.sha}}
94102
path: ./app/build/outputs/**/*.apk
95103

104+
#publish in release
105+
- name: Edit release ${{ github.event.inputs.app_version }}
106+
uses: softprops/action-gh-release@v1
107+
with:
108+
tag_name: ${{ github.event.inputs.app_version }} # Sets the release tag to the pushed tag name (e.g., v1.0.0)
109+
name: ${{ github.event.inputs.app_version }} # Sets the release name to the pushed tag name (e.g., Release v1.0.0)
110+
files: ./app/build/outputs/**/*.apk
111+
draft: false
112+
prerelease: false
113+
env:
114+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115+
96116
# - name: build
97117
# run: |
98118
# ./gradlew bundleDebug --stacktrace

.gitignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ fastlane/test_output
6060
fastlane/readme.md
6161

6262
app/release/output.json
63-
.DS_Store
64-
*.DS_Store
65-
./.DS_Store
66-
./.git/.DS_Store
6763

6864
# Custom product flavours
6965

7066
*custom-flavours.gradle
7167
*.aab
68+
69+
#DS_Store files
70+
*.DS_Store
71+
.DS_Store
72+
./.DS_Store
73+
./.git/.DS_Store

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Parameters:
4949
* ```RAR_PASSWORD``` represents the password to be used for the offline extract.
5050
* ```SHOW_CONTROL_NUMBER_MENU``` allow to show or hide the Control Number menu item in case the implementation does not implement the ePayment module.
5151
* ```app_name_policies``` is a resource string allowing to change the name of the application.
52+
* ```sentry_dsn``` allow to define the sentry dsn of your project where error and exception events from your application will be sent
5253

5354
Escape procedures can be configured and language resource files can be changed. Please follow the ```sourceSets``` record. Look in ```app\src\demo``` folder for an example.
5455

app/build.gradle

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@ static def getDate() {
2121
}
2222

2323
android {
24-
compileSdk 34
24+
compileSdk = 34
2525
namespace = "org.openimis.imispolicies"
2626
if (keystorePropertiesFile.exists()) {
2727
signingConfigs {
2828
releaseConfig {
29-
storeFile file(keystoreProperties['storeFile'])
30-
storePassword keystoreProperties['storePassword']
31-
keyAlias keystoreProperties['keyAlias']
32-
keyPassword keystoreProperties['keyPassword']
29+
storeFile = file(keystoreProperties['storeFile'])
30+
storePassword = keystoreProperties['storePassword']
31+
keyAlias = keystoreProperties['keyAlias']
32+
keyPassword = keystoreProperties['keyPassword']
3333
}
3434
}
3535
}
3636
defaultConfig {
37-
applicationId "org.openimis.imispolicies"
38-
minSdkVersion 21
39-
targetSdkVersion 33
40-
versionCode gitVersionCode
41-
versionName gitVersionName
42-
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
37+
applicationId = "org.openimis.imispolicies"
38+
minSdkVersion = 21
39+
targetSdkVersion = 33
40+
versionCode = gitVersionCode
41+
versionName = gitVersionName
42+
testInstrumentationRunner = 'androidx.test.runner.AndroidJUnitRunner'
4343
vectorDrawables {
4444
useSupportLibrary = true
4545
}
@@ -52,11 +52,12 @@ android {
5252
buildConfigField "boolean", "IS_PAYMENT_ENABLED", 'false'
5353
resValue "string", "app_name_policies", "Policies"
5454
resValue "string", "ReleaseDateValue", getDate()
55+
resValue "string", "sentry_dsn", ""
5556
}
5657
buildTypes {
5758
release {
58-
minifyEnabled false
59-
shrinkResources false
59+
minifyEnabled = false
60+
shrinkResources = false
6061
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
6162
debuggable = false
6263
if (keystorePropertiesFile.exists()) {
@@ -81,19 +82,19 @@ android {
8182
flavorDimensions = ['std']
8283
productFlavors {
8384
demoProd {
84-
applicationId "org.openimis.imispolicies.demoProd"
85+
applicationId = "org.openimis.imispolicies.demoProd"
8586
buildConfigField "String", "API_BASE_URL", '"https://demo.openimis.org/"'
8687
resValue "string", "app_name_policies", "Policies Demo"
8788
dimension = 'std'
8889
}
8990
demoRelease {
90-
applicationId "org.openimis.imispolicies.demoRelease"
91+
applicationId = "org.openimis.imispolicies.demoRelease"
9192
buildConfigField "String", "API_BASE_URL", '"https://release.openimis.org/"'
9293
resValue "string", "app_name_policies", "Policies Release"
9394
dimension = 'std'
9495
}
9596
chfDev {
96-
applicationId "org.openimis.imispolicies.chfdev"
97+
applicationId = "org.openimis.imispolicies.chfdev"
9798
buildConfigField "String", "API_BASE_URL", '"http://chf-dev.swisstph-mis.ch/"'
9899
buildConfigField "boolean", "SHOW_PAYMENT_MENU", 'true'
99100
buildConfigField "boolean", "SHOW_BULK_CN_MENU", 'true'
@@ -102,36 +103,36 @@ android {
102103
dimension = 'std'
103104
}
104105
mvDev {
105-
applicationId "org.openimis.imispolicies.mv"
106+
applicationId = "org.openimis.imispolicies.mv"
106107
buildConfigField "String", "API_BASE_URL", '"http://imis-mv.swisstph-mis.ch/"'
107108
buildConfigField "boolean", "SHOW_PAYMENT_MENU", 'true'
108109
buildConfigField "String", "API_VERSION", '"3"'
109110
resValue "string", "app_name_policies", "Policies MV DEV"
110111
dimension = 'std'
111112
}
112113
bephaDev {
113-
applicationId "org.openimis.imispolicies.bepha"
114+
applicationId = "org.openimis.imispolicies.bepha"
114115
buildConfigField "String", "API_BASE_URL", '"http://149.210.235.40/devupgrade/"'
115116
buildConfigField "String", "DEFAULT_LANGUAGE_CODE", '"en-cm"'
116117
resValue "string", "app_name_policies", "Policies BEPHA DEV"
117118
dimension = 'std'
118119
}
119120
tchadDev {
120-
applicationId "org.openimis.imispolicies.tchadDev"
121+
applicationId = "org.openimis.imispolicies.tchadDev"
121122
buildConfigField "String", "API_BASE_URL", '"http://imis-tchad-dev.swisstph-mis.ch/"'
122123
resValue "string", "app_name_policies", "Policies TCHAD DEV"
123124
dimension = 'std'
124125
}
125126
local {
126-
applicationId "org.openimis.imispolicies.local"
127+
applicationId = "org.openimis.imispolicies.local"
127128
buildConfigField "String", "API_BASE_URL", '"http://10.0.2.2:35787/"'
128129
buildConfigField "boolean", "SHOW_PAYMENT_MENU", 'true'
129130
resValue "string", "app_name_policies", "Policies Local"
130131
dimension = 'std'
131132
versionCode = gitVersionCodeTime
132133
}
133134
niger {
134-
applicationId "org.openimis.imispolicies.niger"
135+
applicationId = "org.openimis.imispolicies.niger"
135136
buildConfigField "String", "API_BASE_URL", '"' + (System.getenv("API_BASE_URL") ?: 'http://192.168.0.100/') + '"'
136137
resValue "string", "app_name_policies", System.getenv("CLI_APP_NAME") ?: "Polices Niger"
137138
dimension = 'std'
@@ -140,10 +141,10 @@ android {
140141
applicationIdSuffix System.getenv("APPLICATION_ID") ?: "org.openimis.imispolicies.cli"
141142
buildConfigField "String", "API_BASE_URL", '"' + (System.getenv("API_BASE_URL") ?: 'http://10.0.2.2:35787/') + '"'
142143
resValue "string", "app_name_policies", System.getenv("CLI_APP_NAME") ?: "Policies CLI"
143-
dimension 'std'
144+
dimension = 'std'
144145
}
145146
mauritaniaTrain {
146-
applicationId "org.openimis.policies.mauritaniaTrain"
147+
applicationId = "org.openimis.policies.mauritaniaTrain"
147148
buildConfigField "String", "API_BASE_URL", '"https://formation.cnass-mauritanie.swisstph-mis.ch/"'
148149
buildConfigField "boolean", "SHOW_PAYMENT_MENU", 'false'
149150
buildConfigField "boolean", "SHOW_BULK_CN_MENU", 'false'
@@ -192,8 +193,8 @@ android {
192193
}
193194

194195
compileOptions {
195-
sourceCompatibility JavaVersion.VERSION_11
196-
targetCompatibility JavaVersion.VERSION_11
196+
sourceCompatibility = JavaVersion.VERSION_11
197+
targetCompatibility = JavaVersion.VERSION_11
197198
}
198199

199200
packagingOptions {
@@ -203,7 +204,14 @@ android {
203204
}
204205

205206
buildFeatures {
206-
buildConfig true
207+
buildConfig = true
208+
}
209+
210+
testOptions {
211+
unitTests {
212+
includeAndroidResources = true
213+
returnDefaultValues = true
214+
}
207215
}
208216
}
209217

@@ -218,6 +226,14 @@ apollo {
218226
]
219227
}
220228

229+
tasks.withType(Test).configureEach {
230+
testLogging {
231+
events "passed", "skipped", "failed"
232+
exceptionFormat = "full"
233+
showStandardStreams = false
234+
}
235+
}
236+
221237
dependencies {
222238
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
223239
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
@@ -240,9 +256,16 @@ dependencies {
240256
implementation 'androidx.recyclerview:recyclerview:1.3.2'
241257
implementation 'org.apache.commons:commons-lang3:3.12.0'
242258
implementation 'cz.msebera.android:httpclient:4.5.8'
259+
implementation 'androidx.test:core:1.7.0'
243260

244261
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
245262
exclude group: 'com.android.support', module: 'support-annotations'
246263
})
264+
265+
// unit tests
247266
testImplementation 'junit:junit:4.13.2'
267+
implementation 'io.sentry:sentry-android:8.25.0'
268+
testImplementation 'org.mockito:mockito-core:5.5.0'
269+
testImplementation 'org.robolectric:robolectric:4.11.1'
248270
}
271+

app/custom-flavours.gradle.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
android {
33
productFlavors {
44
example {
5-
applicationId [APPLICATION_ID]
5+
applicationId = [APPLICATION_ID]
66
buildConfigField "String", "API_BASE_URL", [API_BASE_URL]
77
buildConfigField "boolean", "SHOW_PAYMENT_MENU", [SHOW_PAYMENT_MENU]
88
buildConfigField "boolean", "SHOW_BULK_CN_MENU", [SHOW_BULK_CN_MENU]

app/robolectric.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# app/src/test/resources/robolectric.properties
2+
3+
# this line force Robolectric to use the legacy SQLite implementation
4+
# which is more stable and does not depend on native binaries.
5+
sqliteMode=LEGACY

app/src/localeMv/res/values-fr/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,4 +482,5 @@
482482
<string name="pay_type_cash">Cash</string>
483483
<string name="pay_type_mobile_phone">Téléphone portable</string>
484484
<string name="pay_type_bank_transfer">Virement banquaire</string>
485+
<string name="Close">Fermer</string>
485486
</resources>

app/src/localeMv/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,4 +477,5 @@
477477
<string name="CurrentResourceLanguage">Current resource language: %1$s</string>
478478
<string name="SystemLanguageNotSupported">Current system language is not supported. The app will use the default language.</string>
479479
<string name="SupportedLanguages">Supported languages:\n%1$s</string>
480+
<string name="Close">Close</string>
480481
</resources>

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
android:resource="@xml/paths" />
6464
</provider>
6565

66+
<meta-data android:name="io.sentry.dsn" android:value="@string/sentry_dsn" />
67+
6668
<activity
6769
android:name=".MainActivity"
6870
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|locale"

0 commit comments

Comments
 (0)