Skip to content

Commit 0eaf2a6

Browse files
committed
Use Java 17 for the SonarQube scan
1 parent 22f3b0f commit 0eaf2a6

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

.github/workflows/build.yml

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Build
2+
23
on:
34
push:
45
branches:
@@ -10,39 +11,57 @@ on:
1011
- '[0-9]+.[0-9]+.[0-9]+'
1112
pull_request:
1213
types: [ opened, synchronize, reopened ]
14+
1315
jobs:
1416
build:
1517
name: Build
1618
runs-on: ubuntu-latest
19+
permissions:
20+
pull-requests: read # allows SonarCloud to decorate PRs with analysis results
1721
steps:
18-
- uses: actions/checkout@v3
22+
- name: Checkout
23+
uses: actions/checkout@v4
1924
with:
2025
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
26+
2127
- name: Set up JDK 11
22-
uses: actions/setup-java@v1
28+
uses: actions/setup-java@v3
2329
with:
30+
distribution: 'temurin'
2431
java-version: 11
25-
- name: Cache SonarCloud packages
26-
uses: actions/cache@v1
27-
with:
28-
path: ~/.sonar/cache
29-
key: ${{ runner.os }}-sonar
30-
restore-keys: ${{ runner.os }}-sonar
32+
3133
- name: Cache Maven packages
32-
uses: actions/cache@v1
34+
uses: actions/cache@v3
3335
with:
3436
path: ~/.m2
3537
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3638
restore-keys: ${{ runner.os }}-m2
39+
3740
- name: Setup Gradle
3841
uses: gradle/gradle-build-action@v2
42+
3943
- name: Prepare CodeNarc dependency
4044
working-directory: .
41-
run: |
42-
./tool_prepare-codenarc.sh
43-
- name: Build and analyze
44-
working-directory: .
45+
run: ./tool_prepare-codenarc.sh
46+
47+
- name: Verify
48+
run: mvn -e -B verify
49+
50+
- name: Set up JDK 17
51+
uses: actions/setup-java@v3
52+
with:
53+
distribution: 'temurin'
54+
java-version: 17
55+
56+
- name: Cache SonarQube packages
57+
uses: actions/cache@v3
58+
with:
59+
path: ~/.sonar/cache
60+
key: ${{ runner.os }}-sonar
61+
restore-keys: ${{ runner.os }}-sonar
62+
63+
- name: SonarQube Scan
4564
env:
4665
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4766
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
48-
run: mvn -e -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=green-code-initiative_ecocode-android
67+
run: mvn -e -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=green-code-initiative_ecocode-android

0 commit comments

Comments
 (0)