-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
1,797 additions
and
1,325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: Build and check | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- master | ||
- release/* | ||
pull_request: | ||
|
||
jobs: | ||
buildJob: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'zulu' | ||
|
||
- name: Assemble Library | ||
run: ./gradlew library:assemble | ||
|
||
lintJob: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
needs: [buildJob] | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'zulu' | ||
|
||
- name: Lint | ||
run: ./gradlew library:lint | ||
|
||
- name: Upload lint results artifact | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: lint-results-debug | ||
path: library/build/reports/lint-results-debug.html | ||
retention-days: 5 | ||
|
||
unitTestJob: | ||
name: Unit Test | ||
runs-on: ubuntu-latest | ||
needs: [buildJob] | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'zulu' | ||
|
||
- name: Unit Test | ||
run: ./gradlew library:test | ||
|
||
- name: Upload unit test results artifact | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: unit-test-results-debug | ||
path: library/build/reports/tests/testDebugUnitTest/ | ||
retention-days: 5 | ||
|
||
intrTestJob: | ||
name: Instrumentation Test | ||
runs-on: macos-latest | ||
needs: [buildJob] | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'zulu' | ||
|
||
- name: Run instrumentation tests on emulator | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: 29 | ||
script: > | ||
./gradlew library:connectedAndroidTest | ||
-Ptest.sslPinning.baseUrl=${{ secrets.SSL_PINNING_TEST_BASE_URL }} | ||
-Ptest.sslPinning.appName=${{ secrets.SSL_PINNING_TEST_APP_NAME }} | ||
- name: Upload instrumentation test results artifact | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: instrumentation-test-results-debug | ||
path: library/build/reports/androidTests/connected/ | ||
retention-days: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,6 @@ fastlane/Preview.html | |
fastlane/screenshots | ||
fastlane/test_output | ||
fastlane/readme.md | ||
|
||
# jEnv | ||
.java-version |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2018 Wultra s.r.o. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
dependencies { | ||
classpath("com.android.tools.build:gradle:${Constants.BuildScript.androidPluginVersion}") | ||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Constants.BuildScript.kotlinVersion}") | ||
classpath("org.jetbrains.dokka:dokka-gradle-plugin:${Constants.BuildScript.dokkaVersion}") | ||
} | ||
} | ||
|
||
tasks.register("clean", Delete::class) { | ||
delete(rootProject.buildDir) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2023 Wultra s.r.o. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
|
||
val androidPluginVersion: String by System.getProperties() | ||
val kotlinVersion: String by System.getProperties() | ||
|
||
dependencies { | ||
implementation("com.android.tools.build", "gradle", androidPluginVersion) | ||
implementation(kotlin("gradle-plugin", kotlinVersion)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Copyright 2023 Wultra s.r.o. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions | ||
# and limitations under the License. | ||
# | ||
|
||
systemProp.kotlinVersion=1.8.20 | ||
systemProp.androidPluginVersion=7.4.2 | ||
systemProp.dokkaVersion=1.8.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2023 Wultra s.r.o. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
import org.gradle.api.JavaVersion | ||
|
||
object Constants { | ||
object BuildScript { | ||
// These have to be defined in buildSrc/gradle.properties | ||
// It's the only way to make them available in buildSrc/build.gradle.kts.kts | ||
val androidPluginVersion: String by System.getProperties() | ||
val kotlinVersion: String by System.getProperties() | ||
val dokkaVersion: String by System.getProperties() | ||
} | ||
|
||
object Java { | ||
val sourceCompatibility = JavaVersion.VERSION_1_8 | ||
val targetCompatibility = JavaVersion.VERSION_1_8 | ||
const val kotlinJvmTarget = "1.8" | ||
} | ||
|
||
object Android { | ||
const val compileSdkVersion = 33 | ||
const val targetSdkVersion = 33 | ||
const val minSdkVersion = 19 | ||
const val buildToolsVersion = "33.0.2" | ||
} | ||
|
||
object Dependencies { | ||
const val powerAuthSdkVersion = "1.8.0" | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
buildSrc/src/main/kotlin/com/wultra/gradle/sslpinning/WultraSslPinningTestPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2023 Wultra s.r.o. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
package com.wultra.gradle.sslpinning | ||
|
||
import com.android.build.gradle.BaseExtension | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.getByType | ||
|
||
/** | ||
* Plugin for handling server configurations for instrumentation tests. | ||
*/ | ||
class WultraSslPinningTestPlugin : Plugin<Project> { | ||
|
||
override fun apply(target: Project) { | ||
target.loadPropertiesFromGradleProps() | ||
target.addInstrumentationArgumentsToDefaultConfig() | ||
} | ||
|
||
private val instrumentationArgumentKeys = setOf("test.sslPinning.baseUrl", "test.sslPinning.appName") | ||
private val instrumentationArguments = mutableMapOf<String, String>() | ||
|
||
private fun Project.loadPropertiesFromGradleProps() { | ||
for (key in instrumentationArgumentKeys) { | ||
project.properties[key]?.let { | ||
instrumentationArguments[key] = it.toString() | ||
} | ||
} | ||
} | ||
|
||
private fun Project.addInstrumentationArgumentsToDefaultConfig() { | ||
project.extensions.getByType<BaseExtension>().let { | ||
it.defaultConfig { | ||
for (entry in instrumentationArguments) { | ||
this.testInstrumentationRunnerArguments[entry.key] = entry.value | ||
} | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
.../src/main/resources/META-INF/gradle-plugins/com.wultra.android.sslpinning.test.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
implementation-class=com.wultra.gradle.sslpinning.WultraSslPinningTestPlugin |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Thu Oct 07 12:28:27 CEST 2021 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip | ||
distributionPath=wrapper/dists | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.