|
1 | 1 | name: Build |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | 5 | branches: |
|
10 | 11 | - '[0-9]+.[0-9]+.[0-9]+' |
11 | 12 | pull_request: |
12 | 13 | types: [ opened, synchronize, reopened ] |
| 14 | + |
13 | 15 | jobs: |
14 | 16 | build: |
15 | 17 | name: Build |
16 | 18 | runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + pull-requests: read # allows SonarCloud to decorate PRs with analysis results |
17 | 21 | steps: |
18 | | - - uses: actions/checkout@v3 |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
19 | 24 | with: |
20 | 25 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis |
| 26 | + |
21 | 27 | - name: Set up JDK 11 |
22 | | - uses: actions/setup-java@v1 |
| 28 | + uses: actions/setup-java@v3 |
23 | 29 | with: |
| 30 | + distribution: 'temurin' |
24 | 31 | 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 | + |
31 | 33 | - name: Cache Maven packages |
32 | | - uses: actions/cache@v1 |
| 34 | + uses: actions/cache@v3 |
33 | 35 | with: |
34 | 36 | path: ~/.m2 |
35 | 37 | key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} |
36 | 38 | restore-keys: ${{ runner.os }}-m2 |
| 39 | + |
37 | 40 | - name: Setup Gradle |
38 | 41 | uses: gradle/gradle-build-action@v2 |
| 42 | + |
39 | 43 | - name: Prepare CodeNarc dependency |
40 | 44 | 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 |
45 | 64 | env: |
46 | 65 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
47 | 66 | 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