Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
kober32 committed Sep 7, 2020
2 parents 5891c87 + 0473cce commit bcf1130
Show file tree
Hide file tree
Showing 22 changed files with 895 additions and 119 deletions.
File renamed without changes.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
@@ -0,0 +1,29 @@
name: Release a new version from master

on:
workflow_dispatch:
inputs:
version:
description: 'Version of the library'
required: true
command:
description: 'Library deploy command'
required: false
default: prepare push deploy -v2 --any-branch

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Make sure we're on master branch
run: |
[[ $GITHUB_REF == "refs/heads/master" ]] || exit 1
- name: "Prepare bintray credentials"
run: echo -e "bintray.user=${{ secrets.PUBLISH_BINTRAY_USER }}\nbintray.apiKey=${{ secrets.PUBLISH_BINTRAY_APIKEY }}\nbintray.userOrg=${{ secrets.PUBLISH_BINTRAY_USERORG }}" > local.properties
- name: Publish the library
uses: kober32/library-deploy@develop
with:
script-parameters: ${{ github.event.inputs.version }} ${{ github.event.inputs.command }}
18 changes: 17 additions & 1 deletion .github/workflows/tests.yml
Expand Up @@ -14,5 +14,21 @@ jobs:
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Test the app
- name: Test the app (unit test)
run: ./gradlew clean test
- name: Prepare configuration for integration tests
env:
APP_ID: ${{ secrets.TESTS_APP_ID }}
APP_KEY: ${{ secrets.TESTS_APP_KEY }}
APP_SECRET: ${{ secrets.TESTS_APP_SECRET }}
MASTER_SERVER_PUBLIC_KEY: ${{ secrets.TESTS_MASTER_SERVER_PUBLIC_KEY }}
PA_URL: ${{ secrets.TESTS_PA_URL }}
ER_URL: ${{ secrets.TESTS_ER_URL }}
OP_URL: ${{ secrets.TESTS_OP_URL }}
NS_URL: ${{ secrets.TESTS_NS_URL }}
run: echo -e tests.sdk.paServerUrl="$PA_URL"\\ntests.sdk.nextStepServerUrl="$NS_URL"\\ntests.sdk.enrollmentServerUrl="$ER_URL"\\ntests.sdk.operationsServerUrl="$OP_URL"\\ntests.sdk.appKey="$APP_KEY"\\ntests.sdk.appSecret="$APP_SECRET"\\ntests.sdk.masterServerPublicKey="$MASTER_SERVER_PUBLIC_KEY"\\ntests.sdk.appId="$APP_ID" > configs/integration-tests.properties
- name: Test the app (integration tests)
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: ./gradlew clean connectedAndroidTest --info
2 changes: 1 addition & 1 deletion .limedeploy
Expand Up @@ -7,4 +7,4 @@ DEPLOY_GRADLE_PATH="."
DEPLOY_GRADLE_PARAMS="clean assembleRelease install bintrayUpload"

# Versioning files
DEPLOY_VERSIONING_FILES=( "Deploy/gradle.properties,library/gradle.properties" )
DEPLOY_VERSIONING_FILES=( ".deploy/gradle.properties,library/gradle.properties" )
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -35,6 +35,7 @@ _Note: We also provide an [iOS version of this library](https://github.com/wultr
- [Using Push Service](docs/Using-Push-Service.md)
- [Error Handling](docs/Error-Handling.md)
- [Language Configuration](docs/Language-Configuration.md)
- [Logging](docs/Logging.md)

## License

Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Expand Up @@ -43,7 +43,7 @@ task clean(type: Delete) {
ext {
compileSdkVersion = 28
targetSdkVersion = 28
minSdkVersion = 16
minSdkVersion = 19

supportVersion = "28.0.0"
powerAuthSdkVersion = "1.4.0"
Expand All @@ -53,4 +53,5 @@ ext {
threetenabpVersion = "1.1.1"

junitVersion = "4.12"
androidXTestVersion = "1.2.0"
}
14 changes: 14 additions & 0 deletions configs/integration-tests.properties
@@ -0,0 +1,14 @@

# Note that following values are just placeholders.
# You need to provide valid configuration or all the tests will fail.

tests.sdk.paServerUrl="http://localhost:8081/powerauth-java-server"
tests.sdk.nextStepServerUrl="http://localhost:13010/powerauth-nextstep"
tests.sdk.enrollmentServerUrl="http://localhost:8080/powerauth-webflow"
tests.sdk.operationsServerUrl="http://localhost:8080/powerauth-webflow"

# Configuration of the PowerAuth server
tests.sdk.appKey=""
tests.sdk.appSecret=""
tests.sdk.masterServerPublicKey=""
tests.sdk.appId="1"
30 changes: 30 additions & 0 deletions docs/Logging.md
@@ -0,0 +1,30 @@
# Logging

For logging purposes, WMT uses `Logger` class inside the `com.wultra.android.mtokensdk.common` package that prints to the console.

_Note that `Logger` is internally using `android.util.Log` class with verbosity ERROR, WARNING, and DEBUG and is subjected to its internal logic._

### Verbosity Level

You can limit the amount of logged information via `verboseLevel` static property.

| Level | Description |
| --- | --- |
| `OFF` | Silences all messages. |
| `ERROR` | Only errors will be printed to the console. |
| `WARNING` _(default)_ | Errors and warnings will be printed to the console. |
| `DEBUG` | All messages will be printed to the console. |

Example configuration:

```kotlin
import com.wultra.android.mtokensdk.common.Logger

Logger.verboseLevel = Logger.VerboseLevel.DEBUG
```

### Networking logs

All requests and responses are logged in `DEBUG` level.

_In case that you provided your own okhttp instance, you need to setup your own logging for monitoring the traffic via the okhttp interceptors._
1 change: 1 addition & 0 deletions docs/README.md
Expand Up @@ -34,6 +34,7 @@ _Note: We also provide an [iOS version of this library](https://github.com/wultr
- [Using Push Service](Using-Push-Service.md)
- [Error Handling](Error-Handling.md)
- [Language Configuration](Language-Configuration.md)
- [Logging](Logging.md)

## License

Expand Down
37 changes: 37 additions & 0 deletions library/build.gradle
Expand Up @@ -25,6 +25,8 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName VERSION_NAME
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
loadInstrumentationTestConfigProperties(project, owner)
}

buildTypes {
Expand Down Expand Up @@ -57,6 +59,41 @@ dependencies {

// TestDependencies
testImplementation "junit:junit:${junitVersion}"

// Android tests
androidTestImplementation "io.getlime.security.powerauth:powerauth-android-sdk:${powerAuthSdkVersion}"
androidTestImplementation "androidx.test:runner:${androidXTestVersion}"
androidTestImplementation "junit:junit:${junitVersion}"
androidTestImplementation "androidx.test:core:${androidXTestVersion}"
}

// Load properties for instrumentation tests.
static def loadInstrumentationTestConfigProperties(project, defaultConfig) {
def configsRoot = new File("${project.rootProject.projectDir}/configs")
def configPropertiesFile = new File(configsRoot, "integration-tests.properties")

def instrumentationArguments = [
"tests.sdk.paServerUrl",
"tests.sdk.nextStepServerUrl",
"tests.sdk.enrollmentServerUrl",
"tests.sdk.operationsServerUrl",
"tests.sdk.appKey",
"tests.sdk.appSecret",
"tests.sdk.masterServerPublicKey",
"tests.sdk.appId"
]

project.logger.info("LOADING_PROPERTIES Reading $configPropertiesFile")
if (configPropertiesFile.canRead()) {
def props = new Properties()
props.load(new FileInputStream(configPropertiesFile))

for (key in instrumentationArguments) {
defaultConfig.testInstrumentationRunnerArgument key, "${props[key]}"
}
} else {
project.logger.warn("Loading properties error: Missing $configPropertiesFile")
}
}

apply from: 'android-release-aar.gradle'
3 changes: 2 additions & 1 deletion library/gradle.properties
Expand Up @@ -14,6 +14,7 @@
# and limitations under the License.
#

VERSION_NAME=1.1.5
VERSION_NAME=1.1.6-SNAPSHOT
GROUP_ID=com.wultra.android.mtokensdk
ARTIFACT_ID=wultra-mtoken-sdk
android.useAndroidX=true
15 changes: 15 additions & 0 deletions library/src/androidTest/AndroidManifest.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2020, Wultra s.r.o. (www.wultra.com).
~
~ All rights reserved. This source code can be used only for purposes specified
~ by the given license contract signed by the rightful deputy of Wultra s.r.o.
~ This source code can be used only by the owner of the license.
~
~ Any disputes arising in respect of this agreement (license) shall be brought
~ before the Municipal Court of Prague.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wultra.android.mtokensdk.tests">
<application android:usesCleartextTraffic="true" />
</manifest>

0 comments on commit bcf1130

Please sign in to comment.