Skip to content

Commit

Permalink
add sonarcloud to actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
funkymalc committed Jun 27, 2024
1 parent 76c8c1e commit 8ff74ba
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ name: deploy

on:
push:

pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

env:
K8S_NAMESPACE: 'reshare'
K8S_DEPLOYMENT: 'mod-ncip-1-14-5'
Expand All @@ -23,8 +26,28 @@ jobs:
java-version: '17'
distribution: 'adopt'

- name: Cache SonarCloud 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
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Build with Maven
run: mvn clean install
run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report

- name: SQ analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=indexdata -Dsonar.projectKey=indexdata_${{ github.event.repository.name }}

- name: Log in to the Container registry
uses: docker/login-action@v2
Expand Down

0 comments on commit 8ff74ba

Please sign in to comment.