From 486d70d5568c022383db58da54be32edf19ad32e Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Thu, 23 Jan 2025 14:33:00 +0100 Subject: [PATCH] :recycle: [CI] Aligned chaching of dependencies for Sonar Scan workflow Signed-off-by: Alberto Codutti --- .github/workflows/sonarCloud-scan.yaml | 35 +++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/sonarCloud-scan.yaml b/.github/workflows/sonarCloud-scan.yaml index 5c1104b2b76..b019c51a7ff 100644 --- a/.github/workflows/sonarCloud-scan.yaml +++ b/.github/workflows/sonarCloud-scan.yaml @@ -5,6 +5,7 @@ on: branches: - 'develop' - 'release-**' + - 'feat-improvedGitHubActionCaching' pull_request: branches: - 'develop' @@ -14,33 +15,39 @@ jobs: build: name: Analyze runs-on: ubuntu-latest + timeout-minutes: 45 steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up JDK 11 + - name: Clones Kapua repo inside the runner + uses: actions/checkout@v4 + + - name: Setup Java 11 uses: actions/setup-java@v4 with: - java-version: 11 distribution: 'zulu' - - name: Set up Node 16 - uses: actions/setup-node@v4 + java-version: 11 + + - name: Setup Node 16 + uses: actions/setup-node@v4 # Installs Node and NPM with: node-version: 16 + - name: Install Swagger CLI # Installs Swagger CLI to bundle OpenAPI files run: 'npm install -g @apidevtools/swagger-cli' + shell: bash + + - name: Cache Maven repository - External dependencies # Cache of external Maven dependencies to speed up build time + id: cache-maven-external-deps + uses: actions/cache@v4 + with: + path: ~/.m2/repository/ + key: ${{ runner.os }}-maven-develop-dependencies + - name: Cache SonarQube packages uses: actions/cache@v4 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Cache Maven packages - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}