Skip to content

fix: adjusting cache to starter v1.13.1 PAGOPA-1148 #221

fix: adjusting cache to starter v1.13.1 PAGOPA-1148

fix: adjusting cache to starter v1.13.1 PAGOPA-1148 #221

Workflow file for this run

name: Code Review
# Controls when the workflow will run
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
PROJECT_KEY: "pagopa_pagopa-api-config-cache"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
code-review:
name: Code Review
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Set up Maven
uses: stCarolas/setup-maven@v4.5
with:
maven-version: 3.8.2
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar-project.properties/cache
key: ${{ runner.os }}-sonar-project.properties
restore-keys: ${{ runner.os }}-sonar-project.properties
- name: Build and analyze on Pull Requests
if: ${{ github.event_name == 'pull_request' }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
-Dsonar.organization=pagopa
-Dsonar.projectKey=${{ env.PROJECT_KEY }}
-Dsonar.coverage.jacoco.xmlReportPaths=./target/site/jacoco/jacoco.xml
-Dsonar.coverage.exclusions="**/imported/**,**/exception/**,**/config/**"
-Dsonar.cpd.exclusions="**/model/**"
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
env:
# Needed to get some information about the pull request, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # TODO
#to resolve dependencies
GITHUB_TOKEN_READ_PACKAGES: ${{ secrets.GITHUB_TOKEN }}
- name: Build and analyze on Push main
if: ${{ github.event_name != 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN_READ_PACKAGES: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
-Dsonar.organization=pagopa
-Dsonar.projectKey=${{ env.PROJECT_KEY }}
-Dsonar.coverage.jacoco.xmlReportPaths=./target/site/jacoco/jacoco.xml
-Dsonar.coverage.exclusions="**/config/*,**/*Mock*,**/model/**,**/entity/*"
-Dsonar.cpd.exclusions="**/model/**,**/entity/*"
-Dsonar.branch.name=${{ github.head_ref }}
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.login=${{ secrets.SONAR_TOKEN }}