Skip to content

Commit

Permalink
Attempting to fix iOS auth tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Daeda88 committed Jun 25, 2024
1 parent 0c085fe commit 7886f0f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ jobs:
if: failure()
with:
name: |
Android ${{ echo matrix.gradle_tasks | cut -d: -f2 }} Test Report HTML
Android ${{ matrix.gradle_tasks | cut -d: -f2 }} Test Report HTML
path: "**/build/reports/androidTests/"
- name: Upload Firebase Debug Log
uses: actions/upload-artifact@v4
if: failure()
with:
name: |
Android ${{ echo matrix.gradle_tasks | cut -d: -f2 }} Firebase Debug Log
Android ${{ matrix.gradle_tasks | cut -d: -f2 }} Firebase Debug Log
path: "**/firebase-debug.log"
build-js:
runs-on: ubuntu-latest
Expand Down
29 changes: 27 additions & 2 deletions firebase-auth/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithSimulatorTests
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest

/*
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
Expand Down Expand Up @@ -75,8 +77,8 @@ kotlin {

if (supportIosTarget) {
iosArm64()
iosX64()
iosSimulatorArm64()
iosX64().enableKeychainForTests()
iosSimulatorArm64().enableKeychainForTests()
cocoapods {
ios.deploymentTarget = "12.0"
framework {
Expand Down Expand Up @@ -160,6 +162,29 @@ if (project.property("firebase-auth.skipJsTests") == "true") {
}
}

if (supportIosTarget) {
tasks.create<Exec>("launchIosSimulator") {
commandLine("open", "-a", "Simulator")
}

tasks.withType<KotlinNativeSimulatorTest>().configureEach {
dependsOn("launchIosSimulator")
standalone.set(false)
device.set("booted")
}
}

fun KotlinNativeTargetWithSimulatorTests.enableKeychainForTests() {
testRuns.configureEach {
executionSource.binary.linkerOpts(
"-sectcreate",
"__TEXT",
"__entitlements",
file("$projectDir/src/commonTest/resources/entitlements.plist").absolutePath
)
}
}

signing {
val signingKey: String? by project
val signingPassword: String? by project
Expand Down
12 changes: 12 additions & 0 deletions firebase-auth/src/commonTest/resources/entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>{PERSONAL_ID}.bundle.id</string>
<key>keychain-access-groups</key>
<array>
<string>{PERSONAL_ID}.bundle.id</string>
</array>
</dict>
</plist>
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ skipIosTarget=false
firebase-analytics.skipIosTests=true
firebase-app.skipIosTests=false
# We are skipping auth ios tests due to an issue with keychain and simulator.
firebase-auth.skipIosTests=true
firebase-auth.skipIosTests=false
firebase-common.skipIosTests=false
firebase-common-internal.skipIosTests=false
firebase-config.skipIosTests=false
Expand Down

0 comments on commit 7886f0f

Please sign in to comment.