Skip to content

Commit

Permalink
Merge pull request #32 from teogor/ci/add-github-action-build
Browse files Browse the repository at this point in the history
Implement GitHub Action for Automated Build Process
  • Loading branch information
teogor authored Aug 20, 2024
2 parents bd20a4f + 9e49e1d commit c32dabe
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 10 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
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: Make Gradle executable
run: chmod +x ./gradlew

- 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: Make Gradle executable
run: chmod +x ./gradlew

- 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 c32dabe

Please sign in to comment.