Skip to content

Commit 171568b

Browse files
ci: Updated CI pipeline
1 parent 2c4e509 commit 171568b

File tree

3 files changed

+40
-35
lines changed

3 files changed

+40
-35
lines changed

.github/workflows/gradle.yml

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,55 +13,56 @@ on:
1313
pull_request:
1414
branches: [ "master" ]
1515

16+
# Concurrency control to cancel any in-progress runs on the same branch/PR.
17+
# This saves CI resources and prevents confusion from multiple running workflows.
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
1622
jobs:
1723
build:
18-
1924
runs-on: ubuntu-latest
2025
permissions:
2126
contents: read
2227

2328
steps:
24-
- uses: actions/checkout@v4
25-
- name: Set up JDK 21 with Amazon Corretto
26-
uses: actions/setup-java@v4
27-
with:
28-
java-version: '21'
29-
distribution: 'corretto'
29+
- uses: actions/checkout@v4
3030

31-
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
32-
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
33-
- name: Setup Gradle
34-
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
31+
- name: Set up JDK 21 with Amazon Corretto
32+
uses: actions/setup-java@v4
33+
with:
34+
java-version: '21'
35+
distribution: 'corretto'
3536

36-
- name: Build with Gradle Wrapper
37-
run: ./gradlew build
37+
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
38+
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
39+
- name: Setup Gradle
40+
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
3841

39-
# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
40-
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
41-
#
42-
# - name: Setup Gradle
43-
# uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
44-
# with:
45-
# gradle-version: '8.9'
46-
#
47-
# - name: Build with Gradle 8.9
48-
# run: gradle build
42+
# Best practice: Add execute permissions to the Gradle Wrapper to prevent permission errors.
43+
- name: Make gradlew executable
44+
run: chmod +x ./gradlew
4945

50-
dependency-submission:
46+
- name: Build with Gradle Wrapper
47+
run: ./gradlew build
5148

49+
dependency-submission:
50+
# This job will only run after the 'build' job has completed successfully.
51+
needs: build
5252
runs-on: ubuntu-latest
5353
permissions:
5454
contents: write
5555

5656
steps:
57-
- uses: actions/checkout@v4
58-
- name: Set up JDK 21 with Amazon Corretto
59-
uses: actions/setup-java@v4
60-
with:
61-
java-version: '21'
62-
distribution: 'corretto'
57+
- uses: actions/checkout@v4
58+
59+
- name: Set up JDK 21 with Amazon Corretto
60+
uses: actions/setup-java@v4
61+
with:
62+
java-version: '21'
63+
distribution: 'corretto'
6364

64-
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
65-
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
66-
- name: Generate and submit dependency graph
67-
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
65+
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
66+
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
67+
- name: Generate and submit dependency graph
68+
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0

config/checkstyle/checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<property name="charset" value="UTF-8"/>
2222

23-
<property name="severity" value="${org.checkstyle.google.severity}" default="warning"/>
23+
<property name="severity" value="${org.checkstyle.google.severity}" default="error"/>
2424

2525
<property name="fileExtensions" value="java, properties, xml"/>
2626
<!-- Excludes all 'module-info.java' files -->

gradle/commons/checkstyle.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ checkstyle {
77
configProperties = [
88
"checkstyle.cache.file": "${projectDir}/checkstyle-cachefile"
99
]
10+
11+
// Fail the build if there is more than 0 errors.
12+
// This enforces a strict quality gate.
13+
maxErrors = 0
1014
}
1115

1216
tasks.withType(Checkstyle).configureEach {

0 commit comments

Comments
 (0)