diff --git a/.github/workflows/sonar-backend.yml b/.github/workflows/sonar-backend.yml new file mode 100644 index 0000000..0657dae --- /dev/null +++ b/.github/workflows/sonar-backend.yml @@ -0,0 +1,38 @@ +name: Analyze Backend +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 22 + uses: actions/setup-java@v4 + with: + java-version: 22 + distribution: 'temurin' # Alternative distribution options are available. + - 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 and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + working-directory: ./backend + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=neuefische_java-curriculum-6-java-02-Fullstack-Project-backend \ No newline at end of file diff --git a/backend/pom.xml b/backend/pom.xml index 19e6b6e..62c1b66 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -15,6 +15,8 @@ backend 22 + neuefische + https://sonarcloud.io @@ -46,6 +48,25 @@ + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + + prepare-agent + + + + report + test + + report + + + + org.springframework.boot spring-boot-maven-plugin diff --git a/backend/src/lombok.config b/backend/src/lombok.config new file mode 100644 index 0000000..f202d30 --- /dev/null +++ b/backend/src/lombok.config @@ -0,0 +1,4 @@ +# tells Lombok that this is the root directory and that it shouldn’t search parent directories for more configuration files +config.stopBubbling = true +# tells Lombok to add @lombok.Generated annotation to all generated methods +lombok.addLombokGeneratedAnnotation = true \ No newline at end of file