1- # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3-
4- # This workflow uses actions that are not certified by GitHub.
5- # They are provided by a third-party and are governed by
6- # separate terms of service, privacy policy, and support
7- # documentation.
8-
9- name : Java CI with Maven
1+ name : Java CI
102
113on :
124 push :
13- branches : [ "master" ] # Trigger the action on push to the master branch
5+ branches : ["master"]
146 pull_request :
15- branches : [ "master" ] # Trigger the action on pull requests targeting the master branch
7+ branches : ["master"]
168
179jobs :
1810 build :
19- runs-on : ubuntu-latest # Use the latest version of Ubuntu for the build environment
11+ runs-on : ubuntu-latest
2012
2113 steps :
22- # Step 1: Check out the code from the repository
23- - name : Check out code
24- uses : actions/checkout@v4
25-
26- # Step 2: Set up JDK 21
27- - name : Set up JDK 21
28- uses : actions/setup-java@v4
29- with :
30- java-version : ' 21'
31- distribution : ' temurin' # Use the Temurin distribution for OpenJDK
32- cache : maven # Cache Maven dependencies to speed up subsequent builds
33-
34- # Step 3: Clean and build with Maven
35- - name : Build with Maven
36- run : mvn -B clean package --file pom.xml # Build the project with Maven, suppress the interactive mode
37-
38- # Step 4: Run Tests
39- # - name: Run Tests
40- # run: mvn test --file pom.xml # Run the tests to ensure the code works as expected
41-
42- # # Step 5: Upload the built JAR file as an artifact
43- # - name: Upload JAR Artifact
44- # uses: actions/upload-artifact@v4
45- # with:
46- # name: backupmanager-jar # Name of the artifact
47- # path: target/BackupManager-1.0-SNAPSHOT-jar-with-dependencies.jar # Path to the JAR file
14+ - uses : actions/checkout@v4
4815
49- # # Step 6: Static Code Analysis with SpotBugs (optional)
50- - name : Static Code Analysis with SpotBugs
51- run : mvn com.github.spotbugs:spotbugs-maven-plugin:spotbugs # Run SpotBugs for static code analysis
16+ - name : Setup JDK 21
17+ uses : actions/setup-java@v4
18+ with :
19+ distribution : temurin
20+ java-version : 21
21+ cache : maven
5222
53- # # Step 7: Update dependency graph to improve Dependabot alerts
54- - name : Update dependency graph
55- uses : advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 # Submit dependency graph for security monitoring
23+ - name : Build + Quality (skip tests)
24+ run : mvn -B clean verify -DskipTests=true
0 commit comments