From ac3b0ca1c53d5515e0869f37c2e1c9b646306287 Mon Sep 17 00:00:00 2001 From: oliemansm Date: Sat, 1 May 2021 15:23:22 +0200 Subject: [PATCH] chore(code-style): verify google code style --- .github/workflows/pull-request.yml | 41 +- .github/workflows/release.yml | 4 +- .github/workflows/snapshot.yml | 37 +- .gitignore | 3 +- .idea/codeStyles/Project.xml | 583 +++++++++++++++++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 + 6 files changed, 662 insertions(+), 11 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index dac5e6fb..dd09d092 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,7 +1,8 @@ name: "Pull request" on: pull_request: - types: [opened, synchronize, reopened] + types: [ opened, synchronize, reopened ] + jobs: validation: name: Gradle Wrapper Validation @@ -9,6 +10,34 @@ jobs: steps: - uses: actions/checkout@v2 - uses: gradle/wrapper-validation-action@v1 + + verify-google-java-format: + name: Google Java Format Verification + runs-on: ubuntu-latest + needs: validation + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Java + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: 15 + - name: Cache Gradle + uses: actions/cache@v2 + env: + java-version: 15 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: ${{ runner.os }}-${{ env.java-version }}-gradle- + - name: Make gradlew executable + run: chmod +x ./gradlew + - name: Gradle Check + run: ./gradlew --info build -x test + test: name: Test run strategy: @@ -35,18 +64,18 @@ jobs: ~/.gradle/caches ~/.gradle/wrapper key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: | - ${{ runner.os }}-${{ env.java-version }}-gradle- + restore-keys: ${{ runner.os }}-${{ env.java-version }}-gradle- - name: Make gradlew executable (non-Windows only) if: matrix.os != 'windows-latest' run: chmod +x ./gradlew - name: Gradle Check (non-Windows) if: matrix.os != 'windows-latest' - run: ./gradlew --info check + run: ./gradlew --info check -x verifyGoogleJavaFormat - name: Gradle Check (Windows) if: matrix.os == 'windows-latest' shell: cmd - run: gradlew --info check + run: gradlew --info check -x verifyGoogleJavaFormat + build: name: Sonar analysis needs: validation @@ -83,4 +112,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: ./gradlew build jacocoTestReport sonarqube --info + run: ./gradlew build jacocoTestReport sonarqube --info -x verifyGoogleJavaFormat diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eea5e7f6..407451bf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,7 @@ jobs: steps: - uses: actions/checkout@v2 - uses: gradle/wrapper-validation-action@v1 + test: name: Test run needs: validation @@ -34,7 +35,8 @@ jobs: - name: Make gradlew executable run: chmod +x ./gradlew - name: Gradle Check - run: ./gradlew --info check + run: ./gradlew --info check -x verifyGoogleJavaFormat + build: name: Publish release needs: test diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 296977f2..49b85102 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -11,6 +11,34 @@ jobs: steps: - uses: actions/checkout@v2 - uses: gradle/wrapper-validation-action@v1 + + verify-google-java-format: + name: Google Java Format Verification + runs-on: ubuntu-latest + needs: validation + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Java + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: 15 + - name: Cache Gradle + uses: actions/cache@v2 + env: + java-version: 15 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: ${{ runner.os }}-${{ env.java-version }}-gradle- + - name: Make gradlew executable + run: chmod +x ./gradlew + - name: Gradle Check + run: ./gradlew --info build -x test + test: name: Test run needs: validation @@ -37,7 +65,8 @@ jobs: - name: Make gradlew executable run: chmod +x ./gradlew - name: Gradle Check - run: ./gradlew --info check + run: ./gradlew --info check -x verifyGoogleJavaFormat + build: name: Publish snapshot needs: test @@ -68,7 +97,8 @@ jobs: env: OSS_USER_TOKEN_KEY: ${{ secrets.OSS_USER_TOKEN_KEY }} OSS_USER_TOKEN_PASS: ${{ secrets.OSS_USER_TOKEN_PASS }} - run: ./gradlew clean build publish -x test + run: ./gradlew clean build publish -x test verifyGoogleJavaFormat + sonar: name: Sonar analysis needs: validation @@ -98,4 +128,5 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: ./gradlew build jacocoTestReport sonarqube --info + if: env.SONAR_TOKEN != null + run: ./gradlew build jacocoTestReport sonarqube --info -x verifyGoogleJavaFormat diff --git a/.gitignore b/.gitignore index 20acee31..5713e1ce 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,8 @@ build/ *.iml *.ipr *.iws -**/.idea/ +.idea/* +!.idea/codeStyles/ target/ /out/ .classpath diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..4809a830 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,583 @@ + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..79ee123c --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file