diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7348c2a36..0c43bb105 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }} @@ -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' @@ -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" diff --git a/build.gradle.kts b/build.gradle.kts index 0abd8134a..14a04fc8a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 -> {