Skip to content

Commit 35ab898

Browse files
authored
Merge pull request #337 from graphql-java-kickstart/verify-google-code-format
chore(code-style): verify google code style
2 parents ef5b46b + ac3b0ca commit 35ab898

File tree

6 files changed

+662
-11
lines changed

6 files changed

+662
-11
lines changed

.github/workflows/pull-request.yml

+35-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,43 @@
11
name: "Pull request"
22
on:
33
pull_request:
4-
types: [opened, synchronize, reopened]
4+
types: [ opened, synchronize, reopened ]
5+
56
jobs:
67
validation:
78
name: Gradle Wrapper Validation
89
runs-on: ubuntu-latest
910
steps:
1011
- uses: actions/checkout@v2
1112
- uses: gradle/wrapper-validation-action@v1
13+
14+
verify-google-java-format:
15+
name: Google Java Format Verification
16+
runs-on: ubuntu-latest
17+
needs: validation
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
- name: Setup Java
22+
uses: actions/setup-java@v2
23+
with:
24+
distribution: 'zulu'
25+
java-version: 15
26+
- name: Cache Gradle
27+
uses: actions/cache@v2
28+
env:
29+
java-version: 15
30+
with:
31+
path: |
32+
~/.gradle/caches
33+
~/.gradle/wrapper
34+
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
35+
restore-keys: ${{ runner.os }}-${{ env.java-version }}-gradle-
36+
- name: Make gradlew executable
37+
run: chmod +x ./gradlew
38+
- name: Gradle Check
39+
run: ./gradlew --info build -x test
40+
1241
test:
1342
name: Test run
1443
strategy:
@@ -35,18 +64,18 @@ jobs:
3564
~/.gradle/caches
3665
~/.gradle/wrapper
3766
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
38-
restore-keys: |
39-
${{ runner.os }}-${{ env.java-version }}-gradle-
67+
restore-keys: ${{ runner.os }}-${{ env.java-version }}-gradle-
4068
- name: Make gradlew executable (non-Windows only)
4169
if: matrix.os != 'windows-latest'
4270
run: chmod +x ./gradlew
4371
- name: Gradle Check (non-Windows)
4472
if: matrix.os != 'windows-latest'
45-
run: ./gradlew --info check
73+
run: ./gradlew --info check -x verifyGoogleJavaFormat
4674
- name: Gradle Check (Windows)
4775
if: matrix.os == 'windows-latest'
4876
shell: cmd
49-
run: gradlew --info check
77+
run: gradlew --info check -x verifyGoogleJavaFormat
78+
5079
build:
5180
name: Sonar analysis
5281
needs: validation
@@ -83,4 +112,4 @@ jobs:
83112
env:
84113
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
85114
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
86-
run: ./gradlew build jacocoTestReport sonarqube --info
115+
run: ./gradlew build jacocoTestReport sonarqube --info -x verifyGoogleJavaFormat

.github/workflows/release.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
steps:
99
- uses: actions/checkout@v2
1010
- uses: gradle/wrapper-validation-action@v1
11+
1112
test:
1213
name: Test run
1314
needs: validation
@@ -34,7 +35,8 @@ jobs:
3435
- name: Make gradlew executable
3536
run: chmod +x ./gradlew
3637
- name: Gradle Check
37-
run: ./gradlew --info check
38+
run: ./gradlew --info check -x verifyGoogleJavaFormat
39+
3840
build:
3941
name: Publish release
4042
needs: test

.github/workflows/snapshot.yml

+34-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,34 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v2
1313
- uses: gradle/wrapper-validation-action@v1
14+
15+
verify-google-java-format:
16+
name: Google Java Format Verification
17+
runs-on: ubuntu-latest
18+
needs: validation
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
- name: Setup Java
23+
uses: actions/setup-java@v2
24+
with:
25+
distribution: 'zulu'
26+
java-version: 15
27+
- name: Cache Gradle
28+
uses: actions/cache@v2
29+
env:
30+
java-version: 15
31+
with:
32+
path: |
33+
~/.gradle/caches
34+
~/.gradle/wrapper
35+
key: ${{ runner.os }}-${{ env.java-version }}-gradle-${{ hashFiles('**/*.gradle*') }}
36+
restore-keys: ${{ runner.os }}-${{ env.java-version }}-gradle-
37+
- name: Make gradlew executable
38+
run: chmod +x ./gradlew
39+
- name: Gradle Check
40+
run: ./gradlew --info build -x test
41+
1442
test:
1543
name: Test run
1644
needs: validation
@@ -37,7 +65,8 @@ jobs:
3765
- name: Make gradlew executable
3866
run: chmod +x ./gradlew
3967
- name: Gradle Check
40-
run: ./gradlew --info check
68+
run: ./gradlew --info check -x verifyGoogleJavaFormat
69+
4170
build:
4271
name: Publish snapshot
4372
needs: test
@@ -68,7 +97,8 @@ jobs:
6897
env:
6998
OSS_USER_TOKEN_KEY: ${{ secrets.OSS_USER_TOKEN_KEY }}
7099
OSS_USER_TOKEN_PASS: ${{ secrets.OSS_USER_TOKEN_PASS }}
71-
run: ./gradlew clean build publish -x test
100+
run: ./gradlew clean build publish -x test verifyGoogleJavaFormat
101+
72102
sonar:
73103
name: Sonar analysis
74104
needs: validation
@@ -98,4 +128,5 @@ jobs:
98128
env:
99129
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
100130
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
101-
run: ./gradlew build jacocoTestReport sonarqube --info
131+
if: env.SONAR_TOKEN != null
132+
run: ./gradlew build jacocoTestReport sonarqube --info -x verifyGoogleJavaFormat

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ build/
33
*.iml
44
*.ipr
55
*.iws
6-
**/.idea/
6+
.idea/*
7+
!.idea/codeStyles/
78
target/
89
/out/
910
.classpath

0 commit comments

Comments
 (0)