Skip to content

Commit

Permalink
Merge pull request #40 from twilio/dev
Browse files Browse the repository at this point in the history
Release 0.2.0
  • Loading branch information
SergioFierro authored Oct 25, 2024
2 parents 244a4da + 194f305 commit 1436faf
Show file tree
Hide file tree
Showing 21 changed files with 369 additions and 88 deletions.
82 changes: 71 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ commands:
- run:
name: Install Firebase CLI
command: npm install --save-dev firebase-tools
set-sample-backend-for-ios:
steps:
- run:
name: Set sample backend URL
command: |
SAMPLE_BACKEND_DOMAIN="${SAMPLE_BACKEND_URL/https:\/\/}"
SAMPLE_BACKEND_DOMAIN="${SAMPLE_BACKEND_DOMAIN/\/}"
cd iosApp
sed -i '' "s|let domain: String = \".*\"|let domain: String = \"${SAMPLE_BACKEND_DOMAIN}\"|" iosApp/Constants.swift
sed -i '' "s|<string>webcredentials:.*</string>|<string>webcredentials:${SAMPLE_BACKEND_DOMAIN}</string>|" iosApp/iosApp.entitlements
jobs:
assemble:
Expand Down Expand Up @@ -273,16 +284,25 @@ jobs:
- checkout
- run:
name: Create Framework
command: ./gradlew iosArm64Binaries
command: ./gradlew shared:assembleTwilioPasskeysAuthenticationXCFramework
- 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
ln -s shared/build/XCFrameworks/debug/TwilioPasskeysAuthentication.xcframework TwilioPasskeysAuthentication.xcframework
zip -r debugFramework.zip TwilioPasskeysAuthentication.xcframework
rm TwilioPasskeysAuthentication.xcframework
ln -s shared/build/XCFrameworks/release/TwilioPasskeysAuthentication.xcframework TwilioPasskeysAuthentication.xcframework
zip -r releaseFramework.zip TwilioPasskeysAuthentication.xcframework
rm TwilioPasskeysAuthentication.xcframework
- store_artifacts:
path: debugFramework.tar.gz
path: debugFramework.zip
- store_artifacts:
path: releaseFramework.tar.gz
path: releaseFramework.zip
- persist_to_workspace:
root: *workspace
paths:
- debugFramework.zip
- releaseFramework.zip

android-generate-aar:

Expand Down Expand Up @@ -334,24 +354,54 @@ jobs:
- attach_workspace:
at: *workspace
- run:
name: Determine the type of release for iOS SDK
name: Perform Versioning, Bump Up & Generate ChangeLog
command: |
IOS_RELEASE_TYPE=$(ruby scripts/versioning/require_release.rb true)
echo "Release type = $IOS_RELEASE_TYPE"
if [ "$IOS_RELEASE_TYPE" == "NONE" ]; then
echo "No need to release a new version"
circleci-agent step halt
else
echo "Starting a new $IOS_RELEASE_TYPE release"
fi
VERSION_BUMP=$(ruby scripts/versioning/bump_kmp_sdk_version.rb "$IOS_RELEASE_TYPE")
echo "Version Bump = $VERSION_BUMP"
CHANGELOG=$(ruby scripts/versioning/generate_changelog.rb true)
echo "Changelog: $CHANGELOG"
echo "VERSION_BUMP=$VERSION_BUMP" >> $BASH_ENV
echo "CHANGELOG=$CHANGELOG" >> $BASH_ENV
shell: /bin/bash -l
environment:
TMP_WORKSPACE: *tmp-workspace
ENV_VARS_FILE: *env-vars-file
- run:
name: Publish XCFramework to GitHub
command: |
if [ ! -f releaseFramework.zip ]; then
echo "releaseFramework.zip not found in workspace"
exit 1
fi
mv releaseFramework.zip TwilioPasskeysAuthentication.xcframework.zip
CHECKSUM=$(sha256sum TwilioPasskeysAuthentication.xcframework.zip | cut -d ' ' -f 1)
echo "Checksum: $CHECKSUM"
git clone [email protected]:twilio/twilio-verify-passkeys-ios.git
cd twilio-verify-passkeys-ios
sed -i "s|url: .*|url: \"https://github.com/twilio/twilio-verify-passkeys-ios/releases/download/v$VERSION_BUMP/TwilioPasskeysAuthentication.xcframework.zip\",|" Package.swift
sed -i "s|checksum:\".*\"|checksum: \"$CHECKSUM\"|" Package.swift
git config --global user.email $GITHUB_USER_EMAIL
git config --global user.name $GITHUB_USER_NAME
git add .
git commit -m "Update to version v$VERSION_BUMP"
git tag "v$VERSION_BUMP"
git push origin main
gem install faraday
ruby ../scripts/versioning/create_github_release.rb twilio twilio-verify-passkeys-ios $GITHUB_API_TOKEN "v$VERSION_BUMP" "TwilioPasskeysAuthentication v$VERSION_BUMP" "${CHANGELOG}" ../TwilioPasskeysAuthentication.xcframework.zip
shell: /bin/bash -l
environment:
TMP_WORKSPACE: *tmp-workspace
ENV_VARS_FILE: *env-vars-file
- persist_to_workspace:
root: *workspace
paths:
- *tmp-workspace

generate-android-sample-app-using-local-sdk:
executor: android-node-executor
Expand Down Expand Up @@ -403,6 +453,7 @@ jobs:
- run:
name: Configure GCloud App Distribution service
command: echo $GCLOUD_SERVICE_KEY > ${HOME}/gcloud-app-distribution-service-key.json
- set-sample-backend-for-ios
- run:
name: Deploy to Firebase App Distribution
command: |
Expand All @@ -429,6 +480,7 @@ jobs:
command: |
cd iosApp
bundle install
- set-sample-backend-for-ios
- run:
name: Generate simulator build
command: |
Expand Down Expand Up @@ -638,3 +690,11 @@ workflows:
branches:
only:
- main
- should-release-ios-version:
requires:
- ios-generate-framework
- check-simulator-ios-sdk-e2e-tests-result
filters:
branches:
only:
- main
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ local.properties
xcuserdata
gradle-task-output.log
tmp
.kotlin
12 changes: 5 additions & 7 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ plugins {
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.hilt)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.compose.compiler)
kotlin("kapt")
}

Expand Down Expand Up @@ -59,9 +60,6 @@ android {
buildConfig = true
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
Expand Down Expand Up @@ -94,14 +92,14 @@ android {
}

dependencies {
implementation(libs.androidx.material3.android)
implementation(libs.androidx.ui.tooling.preview.android)
debugImplementation(projects.shared)
releaseImplementation("com.twilio:twilio-verify-passkeys-android:$sdkVersionName")
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(platform(libs.compose.bom))
implementation(libs.androidx.constraintlayout.compose)
implementation(libs.androidx.constraintlayout)
kapt(libs.hilt.android.compiler)
Expand All @@ -111,5 +109,5 @@ dependencies {
implementation(libs.logging.interceptor)
implementation(libs.kotlinx.serialization.json)

debugImplementation(libs.compose.ui.tooling)
debugImplementation(platform(libs.compose.bom))
}
39 changes: 20 additions & 19 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
[versions]
agp = "8.2.0"
agp = "8.7.1"
apkscale = "0.1.6"
constraintlayout = "2.1.4"
constraintlayoutCompose = "1.0.1"
credentials = "1.2.0"
kotlin = "1.9.20"
coroutines = "1.7.3"
compose = "1.5.4"
compose-compiler = "1.5.5"
compose-material3 = "1.1.2"
androidx-activityCompose = "1.8.2"
credentials = "1.3.0"
kotlin = "2.0.21"
coroutines = "1.9.0"
compose-bom = "2024.10.00"
androidx-activityCompose = "1.9.3"
hilt = "2.48"
hiltNavigationCompose = "1.1.0"
mockkAndroid = "1.13.8"
mockkAndroid = "1.13.13"
retrofit = "2.9.0"
retrofit2KotlinxSerializationConverter = "1.0.0"
loggingInterceptor = "4.10.0"
kotlinx-serialization-json = "1.6.0"
coreKtx = "1.5.0"
junitKtx = "1.1.5"
activityKtx = "1.8.2"
kotlinx-serialization-json = "1.6.3"
coreKtx = "1.6.1"
junitKtx = "1.2.1"
activityKtx = "1.9.3"
robolectric = "4.11.1"
runner = "1.5.2"
runner = "1.6.2"
skie = "0.9.3"
truth = "1.1.5"
kover = "0.7.5"
ktlint = "12.0.3"
detekt = "1.23.4"
dokka = "1.9.20"
dokkaVersioningPlugin = "1.9.20"
nexus = "1.3.0"
material3Android = "1.3.0"
uiToolingPreviewAndroid = "1.7.4"

[libraries]
androidx-credentials = { module = "androidx.credentials:credentials", version.ref = "credentials" }
Expand All @@ -45,11 +46,7 @@ kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotl
kotlin-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
kotlin-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" }
compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" }
mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockkAndroid" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
Expand All @@ -61,6 +58,8 @@ androidx-activity-ktx = { group = "androidx.activity", name = "activity-ktx", ve
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
truth = { module = "com.google.truth:truth", version.ref = "truth" }
dokka-versioning-plugin = { module = "org.jetbrains.dokka:versioning-plugin", version.ref = "dokkaVersioningPlugin" }
androidx-material3-android = { group = "androidx.compose.material3", name = "material3-android", version.ref = "material3Android" }
androidx-ui-tooling-preview-android = { group = "androidx.compose.ui", name = "ui-tooling-preview-android", version.ref = "uiToolingPreviewAndroid" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
Expand All @@ -77,3 +76,5 @@ ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
nexus = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
skie = { id = "co.touchlab.skie", version.ref = "skie" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 18 additions & 0 deletions iosApp/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ platform :ios do
puts "IPA size is #{ipa_size_mb} MB"
File.open("sizes.txt", "w") { |file| file.write("IPA size: #{'%.1f' % ipa_size_mb} MB\n") }

gym(
scheme: "iosAppWithoutSDK",
project: "iosApp.xcodeproj",
export_method: "development",
xcargs: settings_to_override,
silent: true,
output_directory: "IPAs/",
output_name: "iosAppWithoutSDK.ipa"
)

ipa_without_sdk_path = lane_context[SharedValues::IPA_OUTPUT_PATH]

# Print the size of the IPA without SDK
ipa_without_sdk_size_kb = `du -sk #{ipa_without_sdk_path}`.split[0].to_i
ipa_without_sdk_size_mb = ipa_without_sdk_size_kb / 1024.0 # Convert KB to MB
puts "IPA without SDK size is #{ipa_without_sdk_size_mb} MB"
File.open("sizes.txt", "a") { |file| file.write("IPA without SDK size: #{'%.1f' % ipa_without_sdk_size_mb} MB\n") }

# Unzip the IPA file
sh "unzip #{ipa_path} -d extracted"

Expand Down
Loading

0 comments on commit 1436faf

Please sign in to comment.