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

Implement GitHub Action for Automated Build Process #32

Merged
merged 1 commit into from
Aug 20, 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
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/[email protected]

- name: Set up JDK
uses: actions/[email protected]
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/[email protected]

- name: Set up JDK
uses: actions/[email protected]
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/[email protected]

- name: set up JDK
uses: actions/[email protected]
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