diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 00000000..116d16d1 --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,38 @@ +name: SonarQube + +on: + push: + branches: + - master + pull_request: + types: [ opened, synchronize, reopened ] + +env: + JAVA_VERSION: 21 + +jobs: + build: + runs-on: ubuntu-latest + steps: + # Checkout + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + fetch-depth: 0 + + # Setup + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: "temurin" + cache: "maven" + + - name: Install Playwright dependencies + run: sudo apt-get install -y libgbm1 + + # Run test coverage and SonarQube analysis + - name: Analyze with SonarQube + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn --batch-mode verify sonar:sonar -Dsonar.projectKey=Athou_commafeed diff --git a/pom.xml b/pom.xml index fbac5646..fdd3e9ab 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 @@ -12,6 +12,9 @@ UTF-8 17 + + athou + https://sonarcloud.io @@ -38,6 +41,11 @@ + + org.sonarsource.scanner.maven + sonar-maven-plugin + 5.1.0.4751 +