Skip to content

Commit

Permalink
[DEVOPS] Define dev->feature->main PR workflows (#1)
Browse files Browse the repository at this point in the history
* Define dev->feature->main PR workflows

* Fix job descriptions

* remove unused androidx dependencies

* set build-logic rootProject.name

* format plugins by groups

* rename kotlin Jvm plugin

* Remove android compose configuration; rely on compose multiplatform plugin

* uncomment source sets; fix typo

* move android project files from main to androidMain

* revert to kotlin android plugin over kotlin multiplatform

* Revert "move android project files from main to androidMain"

This reverts commit a8fed91.

* set jvm target to same bytecode level as android target

* add androidx activity compose dependency

* add compose preview and :core:entities dependencies

* Implement jvm platform
  • Loading branch information
TSampley authored Feb 11, 2024
1 parent 0f7d6ef commit e03d0da
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 16 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/docs-pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "PR Checks for `main` documentation"
on:
pull_request:
types:
- opened # initially opened
- reopened # closed then opened again
- synchronize # any changes pushed
branches:
- main
paths: # Only run checks on changes to documentation
- "**/docs/*"
- "*/README.md"

jobs:
build:
name: "Generate Latest Documentation"
runs-on: [ubuntu-22.04]
if: github.event.pull_request.draft == false # ignore draft pull requests
# env:
#
# outputs:
#
steps:
- name: "Checkout Project"
uses: actions/checkout@v4
- name: "Setup Java 17"
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
- name: "Setup Gradle"
uses: gradle/actions/setup-gradle@v3

- name: "Generate Documentation"
run: ./gradlew dokka

# - run: upload documentation to GitHub pages site
37 changes: 37 additions & 0 deletions .github/workflows/feature-pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "PR Checks for feature branches"
on:
pull_request:
types:
- opened # initially opened
- reopened # closed then opened again
- synchronize # any changes pushed
branches:
- "feature/*"
paths-ignore: # Only run checks on changes to code
- "**/docs/*"
- "*/README.md"

jobs:
build:
name: "Setup and Build Project (Feature)"
runs-on: [ubuntu-22.04]
if: github.event.pull_request.draft == false # ignore draft pull requests
# env:
#
# outputs:
#
steps:
- name: "Checkout Project"
uses: actions/checkout@v4
- name: "Setup Java 17"
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
- name: "Setup Gradle"
uses: gradle/actions/setup-gradle@v3

- name: "Build: Assemble and Test entire project"
run: ./gradlew build

# - run: ./gradlew generate coverage report, upload test/coverage reports
37 changes: 37 additions & 0 deletions .github/workflows/main-pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "PR Checks for `main`"
on:
pull_request:
types:
- opened # initially opened
- reopened # closed then opened again
- synchronize # any changes pushed
branches:
- main
paths-ignore: # Only run checks on changes to code
- "**/docs/*"
- "*/README.md"

jobs:
build:
name: "Setup and Build Project"
runs-on: [ubuntu-22.04]
if: github.event.pull_request.draft == false # ignore draft pull requests
# env:
#
# outputs:
#
steps:
- name: "Checkout Project"
uses: actions/checkout@v4
- name: "Setup Java 17"
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
- name: "Setup Gradle"
uses: gradle/actions/setup-gradle@v3

- name: "Build: Assemble and Test entire project"
run: ./gradlew build

# - run: ./gradlew generate coverage report, upload test/coverage reports
13 changes: 6 additions & 7 deletions app-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.androidApplication)
alias(libs.plugins.composeMultiplatform)
}

Expand All @@ -14,12 +14,6 @@ android {
versionCode = 1
versionName = "1.0"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.get()
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
Expand All @@ -40,5 +34,10 @@ android {
}

dependencies {
implementation(project(":core:entities"))

implementation(libs.androidx.activityCompose)
implementation(compose.preview)
implementation(compose.ui)
implementation(compose.material3)
}
2 changes: 1 addition & 1 deletion app-desktop/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
alias(libs.plugins.org.jetbrains.kotlin.jvm)
alias(libs.plugins.kotlinJvm)
alias(libs.plugins.composeMultiplatform)
}

Expand Down
1 change: 1 addition & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ dependencyResolutionManagement {
// }
}

rootProject.name = "build-logic"
include(":conventions")
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ plugins {
alias(libs.plugins.composeMultiplatform).apply(false)
alias(libs.plugins.kotlinAndroid).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
alias(libs.plugins.org.jetbrains.kotlin.jvm) apply false
alias(libs.plugins.kotlinJvm).apply(false)
}
6 changes: 5 additions & 1 deletion core/entities/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ plugins {

kotlin {
jvm {
jvmToolchain(17)
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
androidTarget {
compilations.all {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.pointyware.painteddogs.core.entities

class JvmPlatform : Platform {
override val name: String = "JVM ${System.getProperty("os.name")}"
}
actual fun getPlatform(): Platform {
return JvmPlatform()
}
12 changes: 6 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[versions]
agp = "8.2.2"
androidx-compose = "1.8.2"
kotlin = "1.9.21"
compose = "1.5.12"
androidx-activityCompose = "1.8.2"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
androidx-activityCompose = { module = "androidx.activity:activity-compose", version.ref = "androidx-compose" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "compose" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
org-jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

0 comments on commit e03d0da

Please sign in to comment.