diff --git a/.github/workflows/sonarcloud-backend.yml b/.github/workflows/sonarcloud-backend.yml new file mode 100644 index 0000000..6b34b0b --- /dev/null +++ b/.github/workflows/sonarcloud-backend.yml @@ -0,0 +1,35 @@ +name: SonarCloud Backend +on: + push: + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 22 + uses: actions/setup-java@v3 + with: + java-version: 22 + distribution: 'zulu' # Alternative distribution options are available. + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=neuefische_hh-java-24-2-teamproject-2_backend --file backend/pom.xml \ No newline at end of file diff --git a/.github/workflows/sonarcloud-frontend.yml b/.github/workflows/sonarcloud-frontend.yml new file mode 100644 index 0000000..c4ef4e3 --- /dev/null +++ b/.github/workflows/sonarcloud-frontend.yml @@ -0,0 +1,18 @@ +name: Build Frontend +on: + push: + pull_request: + types: [opened, synchronize, reopened] +jobs: + sonarcloud: + name: SonarCloud + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/backend/pom.xml b/backend/pom.xml index c2e9bbd..19365b2 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -15,6 +15,9 @@ backend 22 + neuefische + https://sonarcloud.io + neuefische_hh-java-24-2-teamproject-2_backend @@ -46,10 +49,29 @@ org.springframework.boot spring-boot-maven-plugin - - maven-surefire-plugin - 3.2.5 - + + maven-surefire-plugin + 3.2.5 + + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + + prepare-agent + + + + report + test + + report + + + + diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..bf20d84 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,13 @@ +sonar.projectKey=neuefische_hh-java-24-2-teamproject-2_frontend +sonar.organization=neuefische + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=neuefische_hh-java-24-2-teamproject-2_frontend +#sonar.projectVersion=1.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +sonar.sources=./frontend/src + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 \ No newline at end of file