Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Build and publish QA 'flavour' of iOS app #1509

Merged
merged 16 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 75 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ jobs:
path: |
**/build/test-results/*

ios-app:
ios-qa-app:
needs: [code-style]
runs-on: macos-latest
timeout-minutes: 60
Expand Down Expand Up @@ -217,7 +217,7 @@ jobs:
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}

- name: Build iOS application
run: fastlane ios build
run: fastlane ios build_qa
working-directory: ios-app/Tivi
env:
API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
Expand All @@ -232,7 +232,7 @@ jobs:
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: ios-build-outputs
name: ios-qa-build-outputs
path: |
ios-app/Tivi/*.ipa
ios-app/Tivi/*.dSYM.zip
Expand All @@ -241,7 +241,70 @@ jobs:
if: always()
uses: actions/upload-artifact@v3
with:
name: ios-logs
name: ios-qa-logs
path: |
**/fastlane-buildlog

ios-prod-app:
needs: [code-style]
runs-on: macos-latest
timeout-minutes: 60
env:
ORG_GRADLE_PROJECT_TIVI_TMDB_API_KEY: ${{ secrets.ORG_GRADLE_PROJECT_TIVI_TMDB_API_KEY }}
ORG_GRADLE_PROJECT_TIVI_TRAKT_CLIENT_ID: ${{ secrets.ORG_GRADLE_PROJECT_TIVI_TRAKT_CLIENT_ID }}
ORG_GRADLE_PROJECT_TIVI_TRAKT_CLIENT_SECRET: ${{ secrets.ORG_GRADLE_PROJECT_TIVI_TRAKT_CLIENT_SECRET }}
ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_URL: ${{ secrets.ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_URL }}
ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_USERNAME }}
ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_PASSWORD }}
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60

steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17

- uses: gradle/gradle-build-action@v2
with:
cache-disabled: true

- name: Decrypt secrets
run: ./release/decrypt-secrets.sh
env:
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}

- name: Build iOS application
run: fastlane ios build_prod
working-directory: ios-app/Tivi
env:
API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
API_KEY_CONTENTS: ${{ secrets.APP_STORE_CONNECT_API_KEY_CONTENTS }}
ISSUER_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_ISSUER_ID }}
MATCH_PASSWORD: ${{ secrets.FASTLANE_MATCH_PASSWORD }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.FASTLANE_MATCH_GH_PAT }}
TIVI_BUILD_NUMBER: ${{ github.run_number }}

- name: Upload build outputs
if: always()
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: ios-prod-build-outputs
path: |
ios-app/Tivi/*.ipa
ios-app/Tivi/*.dSYM.zip

- name: Upload build logs
if: always()
uses: actions/upload-artifact@v3
with:
name: ios-prod-logs
path: |
**/fastlane-buildlog

Expand Down Expand Up @@ -295,7 +358,7 @@ jobs:

publish:
if: github.ref == 'refs/heads/main'
needs: [android, ios-app, ios-test, desktop]
needs: [android, ios-qa-app, ios-prod-app, ios-test, desktop]
runs-on: macos-latest
timeout-minutes: 20

Expand Down Expand Up @@ -332,11 +395,16 @@ jobs:

- uses: actions/download-artifact@v3
with:
name: ios-build-outputs
name: ios-qa-build-outputs
path: ios-app/Tivi

- uses: actions/download-artifact@v3
with:
name: ios-prod-build-outputs
path: ios-app/Tivi

- name: Publish to TestFlight
run: fastlane ios uploadtestflight
run: fastlane ios publish_all
working-directory: ios-app/Tivi
env:
API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,5 @@ report.xml
Preview.html
screenshots/**/*.png
test_output

*.env*
17 changes: 7 additions & 10 deletions android-app/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
plugins {
id("app.tivi.android.application")
id("app.tivi.kotlin.android")
alias(libs.plugins.ksp)
id("app.tivi.compose")
}

Expand Down Expand Up @@ -145,26 +144,21 @@ androidComponents {
}

dependencies {
implementation(projects.shared)
qaImplementation(projects.shared.qa)
standardImplementation(projects.shared.prod)

implementation(libs.androidx.activity.activity)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.browser)
implementation(libs.androidx.emoji)
implementation(libs.androidx.profileinstaller)
implementation(libs.androidx.splashscreen)

qaImplementation(libs.leakCanary)

implementation(libs.kotlin.coroutines.android)

implementation(libs.google.firebase.crashlytics)

implementation(libs.okhttp.loggingInterceptor)

ksp(libs.kotlininject.compiler)

qaImplementation(libs.chucker.library)
qaImplementation(libs.leakCanary)

androidTestImplementation(projects.androidApp.commonTest)
androidTestImplementation(libs.androidx.uiautomator)
androidTestImplementation(libs.junit)
Expand Down Expand Up @@ -192,3 +186,6 @@ fun <T : Any> propOrDef(propertyName: String, defaultValue: T): T {

fun DependencyHandler.qaImplementation(dependencyNotation: Any) =
add("qaImplementation", dependencyNotation)

fun DependencyHandler.standardImplementation(dependencyNotation: Any) =
add("standardImplementation", dependencyNotation)
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import app.tivi.inject.create

class TiviApplication : Application(), Configuration.Provider {
val component: AndroidApplicationComponent by unsafeLazy {
AndroidApplicationComponent::class.create(this)
AndroidApplicationComponent.create(this)
}

private lateinit var workerFactory: WorkerFactory
Expand Down

This file was deleted.

21 changes: 7 additions & 14 deletions android-app/app/src/main/kotlin/app/tivi/home/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package app.tivi.home

import android.app.Activity
import android.content.Context
import android.net.Uri
import android.os.Bundle
import androidx.activity.compose.setContent
Expand All @@ -16,22 +16,20 @@ import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import app.tivi.BuildConfig
import app.tivi.TiviActivity
import app.tivi.inject.ActivityComponent
import app.tivi.inject.ActivityScope
import app.tivi.TiviApplication
import app.tivi.inject.AndroidActivityComponent
import app.tivi.inject.AndroidApplicationComponent
import app.tivi.inject.UiComponent
import app.tivi.inject.create
import app.tivi.screens.DiscoverScreen
import com.slack.circuit.backstack.rememberSaveableBackStack
import com.slack.circuit.foundation.rememberCircuitNavigator
import me.tatarka.inject.annotations.Component
import me.tatarka.inject.annotations.Provides

class MainActivity : TiviActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()

super.onCreate(savedInstanceState)
val component = MainActivityComponent::class.create(this)
val component = AndroidActivityComponent.create(this, AndroidApplicationComponent.from(this))

WindowCompat.setDecorFitsSystemWindows(window, false)

Expand All @@ -57,11 +55,6 @@ class MainActivity : TiviActivity() {
}
}

@ActivityScope
@Component
abstract class MainActivityComponent(
@get:Provides override val activity: Activity,
@Component val applicationComponent: AndroidApplicationComponent = AndroidApplicationComponent.from(activity),
) : ActivityComponent, UiComponent {
abstract val tiviContent: TiviContent
private fun AndroidApplicationComponent.Companion.from(context: Context): AndroidApplicationComponent {
return (context.applicationContext as TiviApplication).component
}
33 changes: 0 additions & 33 deletions android-app/app/src/main/res/values/font_certs.xml

This file was deleted.

This file was deleted.

6 changes: 6 additions & 0 deletions api/tmdb/src/commonMain/kotlin/app/tivi/tmdb/TmdbComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
package app.tivi.tmdb

import app.tivi.app.ApplicationInfo
import app.tivi.appinitializers.AppInitializer
import app.tivi.inject.ApplicationScope
import me.tatarka.inject.annotations.IntoSet
import me.tatarka.inject.annotations.Provides

interface TmdbComponent : TmdbCommonComponent, TmdbPlatformComponent
Expand All @@ -31,4 +33,8 @@ interface TmdbCommonComponent {
fun provideTmdbImageUrlProvider(tmdbManager: TmdbManager): TmdbImageUrlProvider {
return tmdbManager.getLatestImageProvider()
}

@Provides
@IntoSet
fun provideTmdbInitializer(bind: TmdbInitializer): AppInitializer = bind
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright 2019, Google LLC, Christopher Banes and the Tivi project contributors
// SPDX-License-Identifier: Apache-2.0

package app.tivi.appinitializers
package app.tivi.tmdb

import app.tivi.domain.interactors.UpdateTmdbConfig
import app.tivi.domain.invoke
import app.tivi.appinitializers.AppInitializer
import app.tivi.util.AppCoroutineDispatchers
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
Expand All @@ -13,13 +12,13 @@ import me.tatarka.inject.annotations.Inject

@Inject
class TmdbInitializer(
private val updateTmdbConfig: UpdateTmdbConfig,
private val tmdbManager: TmdbManager,
private val dispatchers: AppCoroutineDispatchers,
) : AppInitializer {
override fun initialize() {
@OptIn(DelicateCoroutinesApi::class)
GlobalScope.launch(dispatchers.main) {
updateTmdbConfig.invoke()
tmdbManager.refreshConfiguration()
}
}
}
2 changes: 1 addition & 1 deletion desktop-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ kotlin {
sourceSets {
val jvmMain by getting {
dependencies {
implementation(projects.shared)
implementation(projects.shared.qa)
implementation(compose.desktop.currentOs)
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

org.gradle.caching=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx5g -Dfile.encoding=UTF-8

# https://docs.gradle.org/7.6/userguide/configuration_cache.html
org.gradle.configuration-cache=true
Expand Down
1 change: 0 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ androidx-browser = "androidx.browser:browser:1.6.0"
androidx-collection = "androidx.collection:collection:1.3.0-beta01"
androidx-core = "androidx.core:core-ktx:1.10.1"
androidx-splashscreen = "androidx.core:core-splashscreen:1.0.1"
androidx-emoji = "androidx.emoji:emoji:1.1.0"

androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidxlifecycle" }

Expand Down
Loading