diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8106a9b58..6bcda1eb9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,7 +8,7 @@ on: workflow_dispatch: jobs: - test: + android: name: Analyze, test, build, and ${{ github.event_name == 'pull_request' && 'validate on' || 'upload to' }} Google Play runs-on: ubuntu-latest permissions: @@ -20,6 +20,15 @@ jobs: - name: Read asdf versions id: asdf run: cat .tool-versions | sed 's/ /=/' | tee -a "$GITHUB_OUTPUT" + - name: Parse java version + id: java-spec + run: | + DISTRIBUTION=(`echo ${{steps.asdf.outputs.java}} | cut -d - -f1`) + VERSION=(`echo ${{steps.asdf.outputs.java}} | cut -d - -f2`) + echo "java-distribution=$DISTRIBUTION" >> "$GITHUB_OUTPUT" + echo "java-version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 with: @@ -34,9 +43,30 @@ jobs: - name: Set up Java uses: actions/setup-java@v3 with: - distribution: temurin - java-version: 17 + distribution: ${{steps.java-spec.outputs.java-distribution}} + java-version: ${{steps.java-spec.outputs.java-version}} cache: gradle + - uses: actions/cache@v3 + with: + path: ~/.konan + key: konan-${{ runner.os }}-${{ hashFiles('build.gradle.kts') }} + restore-keys: konan-${{ runner.os }} + - run: ./gradlew spotlessCheck + - name: shared checks & unit tests + run: ./gradlew shared:check + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: android-shared-reports + path: shared/build/reports + - name: android checks & unit tests + run: ./gradlew androidApp:check + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: android-android-reports + path: androidApp/build/reports + - name: Fetch AWS secrets uses: aws-actions/aws-secretsmanager-get-secrets@v1 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9380b13f2..745a528b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,3 +9,12 @@ repos: types: [text] files: \.(json|arb)$ args: ["--autofix"] + - repo: https://github.com/realm/SwiftLint + rev: 0.54.0 + hooks: + - id: swiftlint + - repo: https://github.com/jguttman94/pre-commit-gradle + rev: v0.3.0 + hooks: + - id: gradle-spotless + entry: gradle-spotless -w diff --git a/.tool-versions b/.tool-versions index f2a971aa7..6d5bf7890 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1,2 @@ ruby 3.2.2 +java temurin-17.0.9+9 diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 5fe0ab1a7..683b17e79 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -13,29 +13,15 @@ android { 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 - } - } + 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_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } - kotlinOptions { - jvmTarget = "1.8" - } + kotlinOptions { jvmTarget = "1.8" } } dependencies { @@ -45,4 +31,4 @@ dependencies { implementation(libs.compose.material3) implementation(libs.androidx.activity.compose) debugImplementation(libs.compose.ui.tooling) -} \ No newline at end of file +} diff --git a/androidApp/src/main/AndroidManifest.xml b/androidApp/src/main/AndroidManifest.xml index 22d1facc8..f62ac2fbe 100644 --- a/androidApp/src/main/AndroidManifest.xml +++ b/androidApp/src/main/AndroidManifest.xml @@ -14,4 +14,4 @@ - \ No newline at end of file + diff --git a/androidApp/src/main/java/com/mbta/tid/mbta_app/android/MainActivity.kt b/androidApp/src/main/java/com/mbta/tid/mbta_app/android/MainActivity.kt index 8ea948a3a..457b3587f 100644 --- a/androidApp/src/main/java/com/mbta/tid/mbta_app/android/MainActivity.kt +++ b/androidApp/src/main/java/com/mbta/tid/mbta_app/android/MainActivity.kt @@ -34,7 +34,5 @@ fun GreetingView(text: String) { @Preview @Composable fun DefaultPreview() { - MyApplicationTheme { - GreetingView("Hello, Android!") - } + MyApplicationTheme { GreetingView("Hello, Android!") } } diff --git a/androidApp/src/main/java/com/mbta/tid/mbta_app/android/MyApplicationTheme.kt b/androidApp/src/main/java/com/mbta/tid/mbta_app/android/MyApplicationTheme.kt index 70f4921e0..e6aa07646 100644 --- a/androidApp/src/main/java/com/mbta/tid/mbta_app/android/MyApplicationTheme.kt +++ b/androidApp/src/main/java/com/mbta/tid/mbta_app/android/MyApplicationTheme.kt @@ -20,36 +20,35 @@ fun MyApplicationTheme( darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit ) { - val colors = if (darkTheme) { - darkColorScheme( - primary = Color(0xFFBB86FC), - secondary = Color(0xFF03DAC5), - tertiary = Color(0xFF3700B3) + val colors = + if (darkTheme) { + darkColorScheme( + primary = Color(0xFFBB86FC), + secondary = Color(0xFF03DAC5), + tertiary = Color(0xFF3700B3) + ) + } else { + lightColorScheme( + primary = Color(0xFF6200EE), + secondary = Color(0xFF03DAC5), + tertiary = Color(0xFF3700B3) + ) + } + val typography = + Typography( + bodyMedium = + TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp + ) ) - } else { - lightColorScheme( - primary = Color(0xFF6200EE), - secondary = Color(0xFF03DAC5), - tertiary = Color(0xFF3700B3) + val shapes = + Shapes( + small = RoundedCornerShape(4.dp), + medium = RoundedCornerShape(4.dp), + large = RoundedCornerShape(0.dp) ) - } - val typography = Typography( - bodyMedium = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 16.sp - ) - ) - val shapes = Shapes( - small = RoundedCornerShape(4.dp), - medium = RoundedCornerShape(4.dp), - large = RoundedCornerShape(0.dp) - ) - MaterialTheme( - colorScheme = colors, - typography = typography, - shapes = shapes, - content = content - ) + MaterialTheme(colorScheme = colors, typography = typography, shapes = shapes, content = content) } diff --git a/androidApp/src/main/res/values/styles.xml b/androidApp/src/main/res/values/styles.xml index 6b4fa3d08..676b4ddaf 100644 --- a/androidApp/src/main/res/values/styles.xml +++ b/androidApp/src/main/res/values/styles.xml @@ -1,3 +1,3 @@