diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..a509cb4 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,40 @@ +name: SonarQube Scan + +on: + push: + branches: + - main + pull_request: + branches: + - '**' + +jobs: + sonarQube: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up JDK 22 + uses: actions/setup-java@v2 + with: + java-version: '22' + + - name: Cache SonarQube packages + uses: actions/cache@v2 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar-cache + restore-keys: | + ${{ runner.os }}-sonar-cache + + - name: SonarQube Scan + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn clean verify sonar:sonar -Dsonar.projectKey= -Dsonar.host.url= -Dsonar.login=${{ secrets.SONAR_TOKEN }} + + - name: Upload SonarQube results + if: always() + run: | + echo "Uploading SonarQube results"