Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detekt #18

Merged
merged 6 commits into from
Jun 2, 2024
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
102 changes: 0 additions & 102 deletions .github/workflows/android.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Pull Request

on:
pull_request:
branches: [ "main" ]

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
detekt:
name: Detekt review
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4.1.0
with:
fetch-depth: 1
ref: ${{ github.head_ref }}
- name: Detekt PR Check
uses: alaegin/Detekt-Action@v1.23.6
with:
reviewdog_reporter: github-pr-check
github_token: ${{ secrets.github_token }}
fail_on_error: true
detekt_config: internal/detekt-config.yml

buildtestanalyze:
name: Build, test and analyze
runs-on: ubuntu-latest
timeout-minutes: 120
permissions: # needed for CodeQL steps
security-events: write
packages: read
actions: read
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4.1.0
- name: Initialize CodeQL # CodeQL init should happen before project build!
uses: github/codeql-action/init@v3
with:
languages: java-kotlin
build-mode: manual
- name: Set up JDK 17
uses: actions/setup-java@v3.13.0
with:
distribution: 'temurin'
java-version: '17'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build and test
run: ./gradlew build
- name: Perform CodeQL Analysis # CodeQL analysis needs project build!
uses: github/codeql-action/analyze@v3
with:
category: "/language:java-kotlin"
49 changes: 49 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Merge

on:
push:
branches: [ "main" ]

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
buildtestanalyze:
uses: ./.github/workflows/build-and-test.yml
secrets: inherit

uploadartifacts:
name: Archive production artifacts
runs-on: ubuntu-latest
needs: buildtestanalyze
steps:
- name: Checkout code
uses: actions/checkout@v4.1.0
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: app
path: app/build/outputs/apk/

dokka:
runs-on: ubuntu-latest
needs: buildtestanalyze
steps:
- name: Checkout code
uses: actions/checkout@v4.1.0
- name: Set up JDK 17
uses: actions/setup-java@v3.13.0
with:
distribution: 'temurin'
java-version: '17'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Run Dokka with Gradle
run: ./gradlew dokkaHtmlMultiModule
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build/dokka/htmlMultiModule
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ dependencies {
implementation(libs.hilt.navigation.compose)

implementation(project(":core:bluetooth"))
}
}

This file was deleted.

4 changes: 2 additions & 2 deletions app/src/main/kotlin/edu/stanford/spezi/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
setContent {
SpeziTheme {
BluetoothScreen()
BluetoothScreen()
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ class MainApplication : Application() {

SpeziLogger.setLoggingEnabled(enabled = BuildConfig.DEBUG)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ class BluetoothViewModel @Inject internal constructor(
object EnableBluetooth : Event
data class RequestPermissions(val permissions: List<String>) : Event
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ class BluetoothUiStateMapper @Inject constructor() {
}

private fun format(value: Number?): String = String.format(Locale.US, "%.2f", value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ data class DeviceUiModel(
val address: String,
val measurementsCount: Int,
val summary: String,
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ private fun AdditionalInfo(uiState: BluetoothUiState) {
Text(text = text)
}


@Composable
fun DeviceComposable(device: DeviceUiModel) {
ElevatedCard(modifier = Modifier.fillMaxWidth()) {
Expand Down Expand Up @@ -102,4 +101,4 @@ private fun BluetoothEvents(events: Flow<BluetoothViewModel.Event>) {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,4 @@ class BluetoothViewModelTest {
uiStateMapper = uiStateMapper
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ class BluetoothUiStateMapperTest {
const val WEIGHT = 4.56
const val ADDRESS = "some device address"
}
}
}
2 changes: 1 addition & 1 deletion build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ gradlePlugin {
conventionPlugin(id = "hilt", className = "HiltConventionPlugin")
conventionPlugin(id = "library", className = "SpeziLibraryConventionPlugin")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ internal fun DependencyHandler.debugImplementation(dependency: Any) {

internal fun DependencyHandler.androidTestImplementation(dependency: Any) {
add("androidTestImplementation", dependency)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ internal fun Project.commonExtensions(configBlock: CommonExtension<*,*,*,*,*,*>.
isLibrary() -> extension<LibraryExtension>(configBlock)
else -> error("commonExtensions was called before setting the module type plugin")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ enum class PluginId(val id: String) {
HILT(id = "com.google.dagger.hilt.android"),
KSP(id = "com.google.devtools.ksp"),
COMPOSE_COMPILER("org.jetbrains.kotlin.plugin.compose")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ class HiltConventionPlugin : Plugin<Project> {
enableAggregatingTask = true
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ abstract class SpeziAbstractConfigPlugin(private val modulePlugin: PluginId) : P
testImplementation(project(":core:testing"))
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package edu.stanford.spezi.build.logic.convention.plugins

import edu.stanford.spezi.build.logic.convention.model.PluginId

class SpeziApplicationConventionPlugin : SpeziAbstractConfigPlugin(modulePlugin = PluginId.ANDROID_APPLICATION)
class SpeziApplicationConventionPlugin : SpeziAbstractConfigPlugin(modulePlugin = PluginId.ANDROID_APPLICATION)
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ class SpeziBaseConfigConventionPlugin : Plugin<Project> {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ class SpeziComposeConventionPlugin : Plugin<Project> {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package edu.stanford.spezi.build.logic.convention.plugins

import edu.stanford.spezi.build.logic.convention.model.PluginId

class SpeziLibraryConventionPlugin : SpeziAbstractConfigPlugin(modulePlugin = PluginId.ANDROID_LIBRARY)
class SpeziLibraryConventionPlugin : SpeziAbstractConfigPlugin(modulePlugin = PluginId.ANDROID_LIBRARY)
2 changes: 1 addition & 1 deletion build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ dependencyResolutionManagement {
}

rootProject.name = "build-logic"
include(":convention")
include(":convention")
Loading
Loading