1
- #
2
- # The MIT License
3
- # Copyright © 2014-2021 Ilkka Seppälä
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
- #
23
-
24
- # This workflow will build a Java project with Maven
25
- # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
26
-
27
1
name : Java PR Builder
28
2
29
3
on :
@@ -37,47 +11,47 @@ permissions:
37
11
jobs :
38
12
build-and-analyze :
39
13
40
- name : Build on JDK 17
41
- runs-on : ubuntu-20 .04
14
+ name : Build on JDK 21
15
+ runs-on : ubuntu-22 .04
42
16
steps :
43
-
44
- - name : Checkout Code
45
- uses : actions/checkout@v4
46
- with :
47
- ref : ${{ github.event.pull_request.head.sha }}
48
-
49
- - name : Set up JDK 17
50
- uses : actions/setup-java@v4
51
- with :
52
- java-version : ' 17'
53
- distribution : ' temurin'
54
- cache : ' maven'
55
-
56
- - name : Cache local Maven repository
57
- uses : actions/cache@v4
58
- with :
59
- path : ~/.m2/repository
60
- key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
61
- restore-keys : |
62
- ${{ runner.os }}-maven-
63
-
64
- # Cache Sonar packages which as used to run analysis and collect metrics
65
- - name : Cache SonarCloud packages
66
- uses : actions/cache@v4
67
- with :
68
- path : ~/.sonar/cache
69
- key : ${{ runner.os }}-sonar
70
- restore-keys : ${{ runner.os }}-sonar
71
-
72
- # Some tests need screen access
73
- - name : Install xvfb
74
- run : sudo apt-get install -y xvfb
75
17
76
- - name : Build with Maven and run SonarQube analysis
77
- env :
78
- # Intermediate variable
79
- HEAD_REF : ${{ github.head_ref }}
80
- # These two env variables are needed for sonar analysis
81
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
82
- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
83
- run : xvfb-run ./mvnw clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=iluwatar -Dsonar.projectKey=iluwatar_java-design-patterns -Dsonar.pullrequest.branch=$HEAD_REF -Dsonar.pullrequest.base=${{ github.base_ref }} -Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
18
+ - name : Checkout Code
19
+ uses : actions/checkout@v4
20
+ with :
21
+ ref : ${{ github.event.pull_request.head.sha }}
22
+
23
+ - name : Set up JDK 21
24
+ uses : actions/setup-java@v4
25
+ with :
26
+ java-version : ' 21'
27
+ distribution : ' temurin'
28
+ cache : ' maven'
29
+
30
+ - name : Cache local Maven repository
31
+ uses : actions/cache@v4
32
+ with :
33
+ path : ~/.m2/repository
34
+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
35
+ restore-keys : |
36
+ ${{ runner.os }}-maven-
37
+
38
+ # Cache Sonar packages which are used to run analysis and collect metrics
39
+ - name : Cache SonarCloud packages
40
+ uses : actions/cache@v4
41
+ with :
42
+ path : ~/.sonar/cache
43
+ key : ${{ runner.os }}-sonar
44
+ restore-keys : ${{ runner.os }}-sonar
45
+
46
+ # Some tests need screen access
47
+ - name : Install xvfb
48
+ run : sudo apt-get install -y xvfb
49
+
50
+ - name : Build with Maven and run SonarQube analysis
51
+ env :
52
+ # Intermediate variable
53
+ HEAD_REF : ${{ github.head_ref }}
54
+ # These two env variables are needed for sonar analysis
55
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
57
+ run : xvfb-run ./mvnw clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=iluwatar -Dsonar.projectKey=iluwatar_java-design-patterns -Dsonar.pullrequest.branch=$HEAD_REF -Dsonar.pullrequest.base=${{ github.base_ref }} -Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
0 commit comments