Skip to content

Commit e84a9aa

Browse files
authored
feat: java support for jdk17 (#1952)
1 parent 54a572a commit e84a9aa

File tree

38 files changed

+157
-56
lines changed

38 files changed

+157
-56
lines changed

.github/workflows/acceptance_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ concurrency:
2222

2323
env:
2424
python_version: '3.11'
25-
java_version: '11'
26-
java_distribution: 'temurin'
25+
java_version: '17'
26+
java_distribution: 'zulu'
2727

2828
jobs:
2929
fail_if_pull_request_is_draft: # Fails in order to indicate that pull request needs to be marked as ready to review to pass.

.github/workflows/docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
types: [ prereleased, released ]
88

99
env:
10-
java_version: '11'
11-
java_distribution: 'temurin'
10+
java_version: '17'
11+
java_distribution: 'zulu'
1212

1313
jobs:
1414
validate_gradle_wrapper:

.github/workflows/end_to_end.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ on:
3535

3636
env:
3737
python_version: '3.11'
38-
java_version: '11'
39-
java_distribution: 'temurin'
38+
java_version: '17'
39+
java_distribution: 'zulu'
4040

4141
jobs:
4242
validate_gradle_wrapper:

.github/workflows/formatting.yml

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
- '.github/workflows/**'
99

1010
env:
11-
java_version: '11'
12-
java_distribution: 'temurin'
11+
java_version: '17'
12+
java_distribution: 'zulu'
1313

1414
jobs:
1515
formatting:
@@ -21,25 +21,55 @@ jobs:
2121
with:
2222
java-version: ${{ env.java_version }}
2323
distribution: ${{ env.java_distribution }}
24+
2425
- name: Cache Gradle packages
2526
uses: actions/cache@v3
2627
with:
2728
path: ~/.gradle/caches
2829
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
2930
restore-keys: ${{ runner.os }}-gradle
30-
- name: Check code compliance to google java format standards
31-
uses: gradle/gradle-build-action@v2
31+
32+
- name: Run Spotless Check
33+
run: |
34+
./gradlew spotlessCheck --quiet --continue 2>&1 | tee spotless-output.txt
35+
if grep -q "\.java" spotless-output.txt; then
36+
exit 1
37+
fi
38+
39+
- name: Upload Spotless Output
40+
if: ${{ failure() }}
41+
uses: actions/upload-artifact@v4
3242
with:
33-
arguments: verGJF
43+
name: spotless-output
44+
path: spotless-output.txt
45+
46+
- name: Extract Affected Files
47+
if: ${{ failure() }}
48+
run: |
49+
grep "\.java" spotless-output.txt > affected-files.txt || true
50+
3451
- name: Comment PR if code does not comply to Google Java style guide
3552
if: ${{ failure() }}
3653
uses: actions/github-script@v6
3754
with:
38-
github-token: ${{secrets.GITHUB_TOKEN}}
55+
github-token: ${{ secrets.GITHUB_TOKEN }}
3956
script: |
57+
const fs = require('fs');
58+
const files = fs.existsSync('affected-files.txt') ? fs.readFileSync('affected-files.txt', 'utf8').trim().split('\n') : [];
59+
if (files.length === 0) return;
60+
61+
const actionsDashboardUrl = `https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
62+
63+
const commentBody = `### 🚨 Code Formatting Issue 🚨\n\n`
64+
+ `This contribution does not follow the conventions set by the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html).\n\n`
65+
+ `Please run the following command at the root of the project to fix formatting errors:\n\n`
66+
+ "```sh\n./gradlew spotlessApply\n```\n\n"
67+
+ `<details><summary><strong>🗂️ Affected files</strong></summary>\n\n${files.map(file => `- \`${file.trim()}\``).join('\n')}</details>\n\n`
68+
+ `[Go to the Actions Dashboard to download the full Spotless output](${actionsDashboardUrl})\n\n`;
69+
4070
github.rest.issues.createComment({
4171
issue_number: context.issue.number,
4272
owner: context.repo.owner,
4373
repo: context.repo.repo,
44-
body: "This contribution does not follow the conventions set by the [Google Java style guide](https://google.github.io/styleguide/javaguide.html). Please run the following command line at the root of the project to fix formatting errors: ```./gradlew goJF```."
45-
})
74+
body: commentBody
75+
});

.github/workflows/package_installers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ env:
2727
MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.MACOS_NOTARIZATION_USERNAME }}
2828
MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.MACOS_NOTARIZATION_TEAM_ID }}
2929
MACOS_NOTARIZATION_PWD: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
30-
java_version: '17.0'
30+
java_version: '17'
3131
java_distribution: 'zulu'
3232

3333
jobs:

.github/workflows/publish_assets.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
workflow_dispatch:
77

88
env:
9-
java_version: '17.0'
9+
java_version: '17'
1010
java_distribution: 'zulu'
1111

1212
jobs:
@@ -101,7 +101,6 @@ jobs:
101101

102102
- name: Build and Publish to Sonatype
103103
run: |
104-
# The gradle java verifying plugin does not work with java 17.
105104
# Don't verify since it has already been done when the PR was created.
106-
./gradlew publish --rerun-tasks -x verifyGoogleJavaFormat
105+
./gradlew publish --rerun-tasks -x spotlessCheck
107106

.github/workflows/stg_web_client_merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
NODE_VERSION: "20"
11-
java_version: '17.0'
11+
java_version: '17'
1212
java_distribution: 'zulu'
1313

1414
jobs:

.github/workflows/stg_web_svc_merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
NODE_VERSION: "20"
11-
java_version: '17.0'
11+
java_version: '17'
1212
java_distribution: 'zulu'
1313

1414
jobs:

.github/workflows/test_pack_doc.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ jobs:
1919
runs-on: ${{ matrix.os }}
2020
strategy:
2121
matrix:
22-
java_version: [ 11, 17 ]
22+
java_version: [ '17' ]
2323
os: [ ubuntu-latest, windows-latest ]
2424
steps:
2525
- uses: actions/checkout@v3
2626
- name: Set up JDK ${{ matrix.java_version }}
2727
uses: actions/setup-java@v3
2828
with:
2929
java-version: ${{ matrix.java_version }}
30-
distribution: 'temurin'
30+
distribution: 'zulu'
3131
- name: Cache Gradle packages
3232
uses: actions/cache@v3
3333
with:
@@ -37,7 +37,6 @@ jobs:
3737
- name: Run tests on Java ${{ matrix.java_version }} and ${{ matrix.os }}
3838
uses: gradle/gradle-build-action@v2
3939
with:
40-
# We run test aggregation with --continue to make sure all tests run, even if some fail.
4140
arguments: testAggregateTestReport --continue
4241
- name: Persist aggregated test reports on failure - Java ${{ matrix.java_version }} on ${{ matrix.os }}
4342
if: ${{ failure() }}
@@ -51,15 +50,15 @@ jobs:
5150
runs-on: ${{ matrix.os }}
5251
strategy:
5352
matrix:
54-
java_version: [ 11, 17 ]
53+
java_version: [ '17' ]
5554
os: [ ubuntu-latest, windows-latest ]
5655
steps:
5756
- uses: actions/checkout@v3
5857
- name: Set up JDK ${{ matrix.java_version }}
5958
uses: actions/setup-java@v3
6059
with:
6160
java-version: ${{ matrix.java_version }}
62-
distribution: 'temurin'
61+
distribution: 'zulu'
6362
- name: Cache Gradle packages
6463
uses: actions/cache@v3
6564
with:
@@ -75,20 +74,21 @@ jobs:
7574
with:
7675
name: Application - CLI executable - Java ${{ matrix.java_version }} JAR file -- ${{ matrix.os }}
7776
path: cli/build/libs/gtfs-validator-*-cli.jar
77+
7878
doc:
7979
needs: [test]
8080
runs-on: ${{ matrix.os }}
8181
strategy:
8282
matrix:
83-
java_version: [ 11, 17 ]
83+
java_version: [ '17' ]
8484
os: [ ubuntu-latest, windows-latest ]
8585
steps:
8686
- uses: actions/checkout@v3
8787
- name: Set up JDK ${{ matrix.java_version }}
8888
uses: actions/setup-java@v3
8989
with:
9090
java-version: ${{ matrix.java_version }}
91-
distribution: 'temurin'
91+
distribution: 'zulu'
9292
- name: Cache Gradle packages
9393
uses: actions/cache@v3
9494
with:
@@ -102,5 +102,5 @@ jobs:
102102
- name: Persist javadoc
103103
uses: actions/upload-artifact@v4
104104
with:
105-
name: Documentation - javadoc - Java ${{ matrix.java_version }} - ${{ matrix.java_version }}
106-
path: build/docs/javadoc/
105+
name: Documentation - javadoc - Java ${{ matrix.java_version }} - ${{ matrix.os }}
106+
path: build/docs/javadoc/

.github/workflows/web_client_pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
env:
1212
NODE_VERSION: "20"
13-
java_version: '17.0'
13+
java_version: '17'
1414
java_distribution: 'zulu'
1515

1616
jobs:

0 commit comments

Comments
 (0)