diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1ce7462fe..1810d4538c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,14 +42,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - uses: actions/setup-java@v1 with: java-version: 8 - uses: eskatos/gradle-command-action@v1 - name: gradle + name: license header with: - arguments: check -x :reactor-core:test --no-daemon + arguments: spotlessCheck -PspotlessFrom=origin/${{ github.base_ref }} wrapper-cache-enabled: true dependencies-cache-enabled: true configuration-cache-enabled: true -#the above should exclude jcstress in master, adding a 3rd job below for jcstress \ No newline at end of file + - uses: eskatos/gradle-command-action@v1 + name: other tests + with: + arguments: check -x :reactor-core:test --no-daemon + wrapper-cache-enabled: true + dependencies-cache-enabled: true + configuration-cache-enabled: true \ No newline at end of file diff --git a/build.gradle b/build.gradle index ee781fb29a..4b71cdbbe0 100644 --- a/build.gradle +++ b/build.gradle @@ -39,6 +39,7 @@ plugins { id 'biz.aQute.bnd.builder' version '5.0.1' apply false id 'io.spring.nohttp' version '0.0.5.RELEASE' id "io.github.reyerizo.gradle.jcstress" version "0.8.11" apply false + id "com.diffplug.spotless" version "5.14.0" } apply plugin: "io.reactor.gradle.detect-ci" @@ -106,6 +107,27 @@ nohttp { allowlistFile = project.file('codequality/nohttp/allowlist.lines') } +spotless { + if (project.hasProperty("spotlessFrom")) { + println "[Spotless] Ratchet from $project.spotlessFrom" + ratchetFrom project.spotlessFrom + } + else if (isCiServer) { + println "[Spotless] CI detected without explicit branch, not enforcing check" + enforceCheck false + } + else { + String spotlessBranch = "origin/3.3.x" + println "[Spotless] Local run detected, ratchet from $spotlessBranch" + ratchetFrom spotlessBranch + } + java { + target '**/*.java' + targetExclude '**/java8stubs/**/*', '**/java9stubs/**/*' + licenseHeaderFile('codequality/spotless/licenseSlashstarStyle.txt') + } +} + configure(subprojects) { p -> apply plugin: 'java' apply plugin: 'jacoco' diff --git a/codequality/spotless/licenseSlashstarStyle.txt b/codequality/spotless/licenseSlashstarStyle.txt new file mode 100644 index 0000000000..ba474eb3de --- /dev/null +++ b/codequality/spotless/licenseSlashstarStyle.txt @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2011-$today.year VMware Inc. or its affiliates, All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +