Skip to content

Commit 5fb3c19

Browse files
authored
Merge pull request #1 from mohdaquib/feature/project-scaffolding
Feature/project scaffolding
2 parents f66ea5b + ed2e5dc commit 5fb3c19

32 files changed

Lines changed: 518 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
lint:
13+
name: Lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Make gradlew executable
18+
run: chmod +x ./gradlew
19+
- uses: actions/setup-java@v4
20+
with:
21+
distribution: temurin
22+
java-version: 17
23+
cache: gradle
24+
- name: Run Android lint
25+
run: ./gradlew lint
26+
27+
detekt:
28+
name: Detekt
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Make gradlew executable
33+
run: chmod +x ./gradlew
34+
- uses: actions/setup-java@v4
35+
with:
36+
distribution: temurin
37+
java-version: 17
38+
cache: gradle
39+
- name: Run Detekt
40+
run: ./gradlew detekt
41+
42+
unit-tests:
43+
name: Unit Tests & Coverage (≥80%)
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
- name: Make gradlew executable
48+
run: chmod +x ./gradlew
49+
- uses: actions/setup-java@v4
50+
with:
51+
distribution: temurin
52+
java-version: 17
53+
cache: gradle
54+
- name: Run unit tests with coverage
55+
run: ./gradlew testDebugUnitTest
56+
- name: Upload coverage reports
57+
if: always()
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: coverage-reports
61+
path: |
62+
app/build/reports/coverage/
63+
scanner-core/build/reports/coverage/
64+
scanner-ui/build/reports/coverage/
65+
scanner-rules/build/reports/coverage/
66+
retention-days: 14
67+
- name: Check coverage ≥ 80%
68+
run: python3 scripts/check_coverage.py . 80

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
.externalNativeBuild
1414
.cxx
1515
local.properties
16+
/.idea/markdown.xml
17+
/.idea/gradle.xml
18+
/.idea/misc.xml

app/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
plugins {
22
alias(libs.plugins.android.application)
33
alias(libs.plugins.kotlin.compose)
4+
alias(libs.plugins.hilt)
5+
alias(libs.plugins.ksp)
46
}
57

68
android {
@@ -22,6 +24,9 @@ android {
2224
}
2325

2426
buildTypes {
27+
debug {
28+
enableUnitTestCoverage = true
29+
}
2530
release {
2631
isMinifyEnabled = false
2732
proguardFiles(
@@ -40,6 +45,9 @@ android {
4045
}
4146

4247
dependencies {
48+
implementation(project(":scanner-ui"))
49+
implementation(libs.hilt.android)
50+
ksp(libs.hilt.android.compiler)
4351
implementation(libs.androidx.core.ktx)
4452
implementation(libs.androidx.lifecycle.runtime.ktx)
4553
implementation(libs.androidx.activity.compose)

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:tools="http://schemas.android.com/tools">
44

55
<application
6+
android:name=".ComposeA11yScannerApplication"
67
android:allowBackup="true"
78
android:dataExtractionRules="@xml/data_extraction_rules"
89
android:fullBackupContent="@xml/backup_rules"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.composea11yscanner
2+
3+
import android.app.Application
4+
import dagger.hilt.android.HiltAndroidApp
5+
6+
@HiltAndroidApp
7+
class ComposeA11yScannerApplication : Application()

build.gradle.kts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
33
alias(libs.plugins.android.application) apply false
4+
alias(libs.plugins.android.library) apply false
5+
alias(libs.plugins.kotlin.android) apply false
46
alias(libs.plugins.kotlin.compose) apply false
7+
alias(libs.plugins.hilt) apply false
8+
alias(libs.plugins.ksp) apply false
9+
alias(libs.plugins.detekt)
10+
}
11+
12+
detekt {
13+
source.setFrom(
14+
fileTree(rootDir) {
15+
include("**/src/**/*.kt")
16+
exclude("**/build/**", "**/.gradle/**")
17+
}
18+
)
19+
config.setFrom(file("config/detekt/detekt.yml"))
20+
buildUponDefaultConfig = true
21+
parallel = true
522
}

config/detekt/detekt.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
build:
2+
maxIssues: 0
3+
excludeCorrectable: false
4+
5+
config:
6+
validation: true
7+
warningsAsErrors: false
8+
9+
style:
10+
MaxLineLength:
11+
maxLineLength: 140
12+
WildcardImport:
13+
active: false
14+
MagicNumber:
15+
active: false
16+
17+
complexity:
18+
LongMethod:
19+
threshold: 60
20+
LongParameterList:
21+
functionThreshold: 6
22+
constructorThreshold: 7
23+
TooManyFunctions:
24+
thresholdInFiles: 20
25+
thresholdInClasses: 15
26+
thresholdInObjects: 15
27+
thresholdInInterfaces: 15
28+
29+
naming:
30+
FunctionNaming:
31+
functionPattern: '[a-z][a-zA-Z0-9]*'
32+
excludes: ['**/test/**', '**/androidTest/**']

gradle/libs.versions.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ lifecycleRuntimeKtx = "2.10.0"
88
activityCompose = "1.13.0"
99
kotlin = "2.2.10"
1010
composeBom = "2024.09.00"
11+
hilt = "2.59.2"
12+
ksp = "2.3.7"
13+
coroutines = "1.10.1"
14+
detekt = "1.23.7"
1115

1216
[libraries]
1317
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@@ -24,8 +28,16 @@ androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "u
2428
androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
2529
androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
2630
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
31+
hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
32+
hilt-android-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" }
33+
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
34+
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" }
2735

2836
[plugins]
2937
android-application = { id = "com.android.application", version.ref = "agp" }
38+
android-library = { id = "com.android.library", version.ref = "agp" }
39+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
3040
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
31-
41+
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
42+
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
43+
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }

sample/build.gradle.kts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.compose)
4+
alias(libs.plugins.hilt)
5+
alias(libs.plugins.ksp)
6+
}
7+
8+
android {
9+
namespace = "com.composea11yscanner.sample"
10+
compileSdk = 36
11+
12+
defaultConfig {
13+
applicationId = "com.composea11yscanner.sample"
14+
minSdk = 24
15+
targetSdk = 36
16+
versionCode = 1
17+
versionName = "1.0"
18+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
19+
}
20+
21+
buildTypes {
22+
release {
23+
isMinifyEnabled = false
24+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
25+
}
26+
}
27+
compileOptions {
28+
sourceCompatibility = JavaVersion.VERSION_11
29+
targetCompatibility = JavaVersion.VERSION_11
30+
}
31+
32+
buildFeatures { compose = true }
33+
}
34+
35+
dependencies {
36+
implementation(project(":scanner-ui"))
37+
implementation(project(":scanner-core"))
38+
implementation(project(":scanner-rules"))
39+
implementation(libs.androidx.core.ktx)
40+
implementation(libs.androidx.lifecycle.runtime.ktx)
41+
implementation(libs.androidx.activity.compose)
42+
implementation(platform(libs.androidx.compose.bom))
43+
implementation(libs.androidx.compose.ui)
44+
implementation(libs.androidx.compose.ui.graphics)
45+
implementation(libs.androidx.compose.ui.tooling.preview)
46+
implementation(libs.androidx.compose.material3)
47+
implementation(libs.hilt.android)
48+
ksp(libs.hilt.android.compiler)
49+
testImplementation(libs.junit)
50+
androidTestImplementation(libs.androidx.junit)
51+
androidTestImplementation(libs.androidx.espresso.core)
52+
androidTestImplementation(platform(libs.androidx.compose.bom))
53+
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
54+
debugImplementation(libs.androidx.compose.ui.tooling)
55+
debugImplementation(libs.androidx.compose.ui.test.manifest)
56+
}

sample/proguard-rules.pro

Whitespace-only changes.

0 commit comments

Comments
 (0)