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

[CI] - Spotless GitHub actions #544

Merged
merged 10 commits into from
Nov 21, 2023
43 changes: 40 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Build

on:
pull_request:
pull_request: {}
workflow_dispatch: {}

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -27,11 +31,12 @@ jobs:
os: windows-latest

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Java
- name: Configure JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
Expand All @@ -54,3 +59,35 @@ jobs:
with:
name: 'reports'
path: '**/build/reports/**'

spotless:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 20

- name: Spotless Apply
uses: gradle/gradle-build-action@v2
with:
arguments: spotlessApply

- name: Commit newly formatted files
uses: stefanzweifel/git-auto-commit-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: "Apply spotless formatting"
commit_options: '--no-verify'
file_pattern: '**/*.kt'
commit_user_name: "GitHub Actions"
4 changes: 0 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ fun Project.configureBuildAndTestTask(taskName: String, moduleType: ModulePlatfo
tasks.register(taskName) {
val gradleCommand = getGradleCommand(platform)

doFirst {
project.exec {commandLine(gradleCommand, "spotlessCheck") }
}

doLast {
when (moduleType) {
ModulePlatformType.SINGLE -> {
Expand Down
Loading