Skip to content

Commit

Permalink
Add GitHub Action for automated build process
Browse files Browse the repository at this point in the history
  • Loading branch information
teogor committed Aug 20, 2024
1 parent bd20a4f commit 25848e9
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 10 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Code Quality CI

on:
push:
branches: [ main ]
pull_request:
branches: [ '*' ]

jobs:
lint:
name: Spotless check
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v4.1.7
- name: Set up JDK
uses: actions/setup-java@v4.2.2
with:
distribution: 'zulu'
java-version: 17
- name: spotless
run: ./gradlew spotlessCheck

api_check:
name: API check
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v4.1.7
- name: Set up JDK
uses: actions/setup-java@v4.2.2
with:
distribution: 'zulu'
java-version: 17
- name: API check
run: ./gradlew apiCheck

build:
name: Build and Tests
runs-on: macos-latest
steps:
- uses: actions/checkout@v4.1.7

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

- name: Cache Gradle and wrapper
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Make Gradle executable
run: chmod +x ./gradlew

- name: Build with Gradle
run: |
./gradlew build
17 changes: 12 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,18 @@ val modulesByPath = listOf(

val ktlintVersion = "0.50.0"

val excludeModules = listOf(
project.name,
"app",
"module-unity",
)
val isCI = System.getenv("CI") != null
val excludeModules = if (!isCI) {
listOf(
project.name,
"app",
"module-unity",
)
} else {
listOf(
project.name,
)
}

subprojects {
if (!excludeModules.contains(this.name)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ private fun String.splitCamelCase(): String {
private fun String.toTitleCase(): String {
return this.split(" ").joinToString(" ") { word ->
word.replaceFirstChar { char ->
if (char.isLowerCase()) char.titlecase(Locale.getDefault())
else char.toString()
if (char.isLowerCase()) {
char.titlecase(Locale.getDefault())
} else {
char.toString()
}
}
}
}
9 changes: 6 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

rootProject.name = "Drifter"

// Demo Application
include(":demo:app")
include(":demo:module-unity")
val isCI = System.getenv("CI") != null
if (!isCI) {
// Demo Application
include(":demo:app")
include(":demo:module-unity")
}

// Drifter
include(":bom")
Expand Down

0 comments on commit 25848e9

Please sign in to comment.