Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ferazoguerrero committed Feb 15, 2024
0 parents commit 0ad720c
Show file tree
Hide file tree
Showing 171 changed files with 9,584 additions and 0 deletions.
216 changes: 216 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
version: 2.1

orbs:
android: circleci/[email protected]
ruby: circleci/[email protected]

aliases:
- &workspace
~/passkeys-sdk
- &unit-test-folder-result
~/test-results/junit

executors:
android-executor:
docker:
# https://circleci.com/developer/images/image/cimg/android#image-tags
- image: cimg/android:2023.12.1
resource_class: large
working_directory: *workspace

mac-os-executor:
macos:
xcode: "15.1.0"
resource_class: macos.m1.medium.gen1
working_directory: *workspace

ruby-executor:
docker:
- image: cimg/ruby:3.3.0
working_directory: *workspace

commands:
test-results-folder:
parameters:
folder:
default: *unit-test-folder-result
type: string
steps:
- run:
name: Copying tests results to <<parameters.folder>>
command: |
mkdir -p <<parameters.folder>>
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} <<parameters.folder>> \;
when: always
working_directory: *workspace

install-jdk-17:
steps:
- run:
name: Install OpenJDK 17
command: |
sudo apt-get update && sudo apt-get install openjdk-17-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-17-openjdk-amd64/bin/javac
java -version
danger-check:
parameters:
danger_params:
type: string
steps:
- run:
name: Danger check
command: bundle exec danger <<parameters.danger_params>> --verbose --remove-previous-comments

jobs:
assemble:
executor: android-executor

steps:
- checkout
- android/restore-build-cache
- android/restore-gradle-cache
- ruby/install-deps
- run:
name: Assemble build
command: ./gradlew assembleDebug assembleDebugAndroidTest
- danger-check:
danger_params: --danger_id=assemble --dangerfile=dangerfiles/dangerfile_pr_validation
- android/save-gradle-cache
- android/save-build-cache

lint-check:
executor: ruby-executor

steps:
- checkout
- android/restore-build-cache
- android/restore-gradle-cache
- ruby/install-deps
- install-jdk-17
- run:
name: Kotlin lint
command: ./gradlew ktlintCheck
- danger-check:
danger_params: --danger_id=lint --dangerfile=dangerfiles/dangerfile_ktlint
- android/save-gradle-cache
- android/save-build-cache

detekt-check:
executor: android-executor

steps:
- checkout
- android/restore-build-cache
- android/restore-gradle-cache
- ruby/install-deps
- run:
name: Detekt check
command: ./gradlew detekt
- danger-check:
danger_params: --danger_id=detekt --dangerfile=dangerfiles/dangerfile_detekt
- android/save-gradle-cache
- android/save-build-cache

android-unit-test:
executor: android-executor

steps:
- checkout
- android/restore-build-cache
- android/restore-gradle-cache
- ruby/install-deps
- run:
name: Kover code coverage report
command: ./gradlew :shared:koverXmlReportDebug
- danger-check:
danger_params: --danger_id=unit_tests --dangerfile=dangerfiles/dangerfile_code_coverage
- run:
name: Kover code coverage rule
command: ./gradlew :shared:koverVerify
- android/save-gradle-cache
- android/save-build-cache
- test-results-folder
- store_test_results:
path: *unit-test-folder-result
- store_artifacts:
path: /home/circleci/test-results/

ios-unit-test:
executor: mac-os-executor

steps:
- checkout
- android/restore-build-cache
- android/restore-gradle-cache
- run:
name: Run Unit tests
command: ./gradlew :shared:iosSimulatorArm64Test
- android/save-gradle-cache
- android/save-build-cache
- test-results-folder
- store_test_results:
path: *unit-test-folder-result
- store_artifacts:
path: /Users/distiller/test-results/

ios-generate-framework:
executor: mac-os-executor

steps:
- checkout
- run:
name: Create Framework
command: ./gradlew iosArm64Binaries
- run:
name: Compress Artifacts
command: |
tar -cvzf debugFramework.tar.gz shared/build/bin/iosArm64/debugFramework
tar -cvzf releaseFramework.tar.gz shared/build/bin/iosArm64/releaseFramework
- store_artifacts:
path: debugFramework.tar.gz
- store_artifacts:
path: releaseFramework.tar.gz

android-generate-aar:
executor: android-executor

steps:
- checkout
- run:
name: Create aars
command: |
./gradlew :shared:assembleDebug
mv shared/build/outputs/aar/shared-debug.aar TwilioPasskeys-debug.aar
./gradlew :shared:assembleRelease
mv shared/build/outputs/aar/shared-release.aar TwilioPasskeys.aar
- store_artifacts:
path: TwilioPasskeys-debug.aar
- store_artifacts:
path: TwilioPasskeys.aar

workflows:
build-all:
jobs:
- assemble
- lint-check:
requires:
- assemble
- detekt-check:
requires:
- assemble
- android-unit-test:
requires:
- lint-check
- detekt-check
- ios-unit-test:
requires:
- lint-check
- detekt-check
- ios-generate-framework:
requires:
- ios-unit-test
- android-generate-aar:
requires:
- android-unit-test
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
root = true

[*]
indent_style = space
indent_size = 2
max_line_length = 150

[*.{kt, kts, xml}]
ktlint_code_style = ktlint_official
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
# Don't allow any wildcard imports
ij_kotlin_packages_to_use_import_on_demand = unset
ktlint_code_style = ktlint_official

[*.xml]
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
max_line_length = unset

[*.yml]
ij_yaml_spaces_within_brackets = false
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.iml
.gradle
.idea
.DS_Store
build
captures
.externalNativeBuild
.cxx
local.properties
xcuserdata
62 changes: 62 additions & 0 deletions AndroidApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.hilt)
alias(libs.plugins.kotlinSerialization)
kotlin("kapt")
}

android {
namespace = "com.twilio.passkeys.android"
compileSdk = 34
defaultConfig {
applicationId = "com.twilio.passkeys.android"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}

dependencies {
implementation(projects.shared)
implementation(libs.compose.ui)
implementation(libs.compose.ui.tooling.preview)
implementation(libs.compose.material3)
implementation(libs.androidx.activity.compose)
implementation(libs.hilt.android)
implementation(libs.androidx.hilt.navigation.compose)
implementation(libs.androidx.constraintlayout.compose)
implementation(libs.androidx.constraintlayout)
kapt(libs.hilt.android.compiler)
// Retrofit
implementation(libs.retrofit)
implementation(libs.retrofit2.kotlinx.serialization.converter)
implementation(libs.logging.interceptor)
implementation(libs.kotlinx.serialization.json)

debugImplementation(libs.compose.ui.tooling)
}
23 changes: 23 additions & 0 deletions AndroidApp/detekt-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<CurrentIssues>
<ID>LongMethod:HomePage.kt$@Suppress("FunctionName") @Composable @Preview fun HomePage( number: String = "+1 1111 1111", onDisconnect: () -&gt; Unit = {}, )</ID>
<ID>LongParameterList:AuthenticateRepository.kt$AuthenticateRepository$( rawId: String, id: String, clientDataJson: String, userHandle: String?, signature: String?, authenticatorData: String?, )</ID>
<ID>LongParameterList:CreateRepository.kt$CreateRepository$( rawId: String, id: String, clientDataJson: String, attestationObject: String, type: String, transports: List&lt;String&gt;, )</ID>
<ID>MagicNumber:Color.kt$0xFF0263E0</ID>
<ID>MagicNumber:Color.kt$0xFFF22F46</ID>
<ID>MagicNumber:HomePage.kt$0x08000000</ID>
<ID>MagicNumber:HomePage.kt$0xB2FFFFFF</ID>
<ID>MagicNumber:HomePage.kt$0xFF0385EB</ID>
<ID>MagicNumber:HomePage.kt$0xFF05090A</ID>
<ID>MagicNumber:HomePage.kt$0xFFFFFFFF</ID>
<ID>MagicNumber:HomePage.kt$400</ID>
<ID>MagicNumber:HomePage.kt$500</ID>
<ID>MagicNumber:LoginPage.kt$0xFF121C2D</ID>
<ID>MagicNumber:LoginPage.kt$0xFFFFFFFF</ID>
<ID>MagicNumber:LoginPage.kt$400</ID>
<ID>MagicNumber:LoginPage.kt$600</ID>
<ID>UnusedParameter:MyApplicationTheme.kt$darkTheme: Boolean = isSystemInDarkTheme()</ID>
</CurrentIssues>
</SmellBaseline>
22 changes: 22 additions & 0 deletions AndroidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="com.twilio.passkeys.android.PasskeyApp"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="com.twilio.passkeys.android.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Loading

0 comments on commit 0ad720c

Please sign in to comment.