user defined error msg for maximum upload of attachments (#518) #1944
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: SonarQube Analysis | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| pull_request: | |
| branches: | |
| - '**' # run on all PR branches | |
| types: [opened, synchronize, reopened] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read # allows workflow to checkout private repository | |
| pull-requests: read # Allows SonarQube to decorate PRs with analysis results | |
| jobs: | |
| sonar-scan: | |
| environment: pr-analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # Ensure shallow clones are disabled for better analysis relevancy | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Install dependencies | |
| run: | | |
| mvn clean install -P unit-tests -DskipIntegrationTests | |
| - name: Install SonarQube Scanner | |
| run: | | |
| if [ ! -L /usr/local/bin/sonar-scanner ]; then | |
| curl -sSLo sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip | |
| unzip sonar-scanner-cli.zip | |
| sudo mv sonar-scanner-5.0.1.3006-linux /opt/sonar-scanner | |
| sudo ln -s /opt/sonar-scanner/bin/sonar-scanner /usr/local/bin/sonar-scanner | |
| fi | |
| - name: Run SonarQube analysis | |
| env: | |
| SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: | | |
| set +x | |
| echo "::add-mask::$SONAR_TOKEN" | |
| if [ "${{ github.event_name }}" == "pull_request" ]; then | |
| sonar-scanner \ | |
| -Dsonar.projectKey=cap-java-sdm \ | |
| -Dsonar.sources=sdm/src/main/java \ | |
| -Dsonar.java.binaries=sdm/target/classes \ | |
| -Dsonar.java.libraries=sdm/target/sdm.jar \ | |
| -Dsonar.junit.reportPaths=sdm/target/surefire-reports \ | |
| -Dsonar.coverage.jacoco.xmlReportPaths=sdm/target/site/jacoco/jacoco.xml \ | |
| -Dsonar.inclusions=**/*.java \ | |
| -Dsonar.exclusions=**/target/**,**/node_modules/**,sdm/src/main/test/**,app/**/*.capnb,sdm/src/main/java/com/sap/cds/sdm/model/**,sdm/src/main/java/com/sap/cds/sdm/caching/CacheKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/RepoKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/TokenCacheKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/SecondaryTypesKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/SecondaryPropertiesKey.java \ | |
| -Dsonar.java.file.suffixes=.java \ | |
| -Dsonar.host.url="$SONAR_HOST_URL" \ | |
| -Dsonar.login="$SONAR_TOKEN" \ | |
| -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} \ | |
| -Dsonar.pullrequest.branch=${{ github.head_ref }} \ | |
| -Dsonar.pullrequest.base=${{ github.base_ref }} | |
| else | |
| sonar-scanner \ | |
| -Dsonar.projectKey=cap-java-sdm \ | |
| -Dsonar.sources=sdm/src/main/java \ | |
| -Dsonar.java.binaries=sdm/target/classes \ | |
| -Dsonar.java.libraries=sdm/target/sdm.jar \ | |
| -Dsonar.junit.reportPaths=sdm/target/surefire-reports \ | |
| -Dsonar.coverage.jacoco.xmlReportPaths=sdm/target/site/jacoco/jacoco.xml \ | |
| -Dsonar.inclusions=**/*.java \ | |
| -Dsonar.exclusions=**/target/**,**/node_modules/**,sdm/src/main/test/**,app/**/*.capnb,sdm/src/main/java/com/sap/cds/sdm/model/**,sdm/src/main/java/com/sap/cds/sdm/caching/CacheKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/RepoKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/TokenCacheKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/SecondaryTypesKey.java,sdm/src/main/java/com/sap/cds/sdm/caching/SecondaryPropertiesKey.java \ | |
| -Dsonar.java.file.suffixes=.java \ | |
| -Dsonar.host.url="$SONAR_HOST_URL" \ | |
| -Dsonar.login="$SONAR_TOKEN" | |
| fi | |
| - name: Quality Gate Check | |
| id: sonarqube-quality-gate | |
| uses: sonarsource/sonarqube-quality-gate-action@master | |
| with: | |
| sonar_host_url: ${{ secrets.SONAR_HOST_URL }} | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |