| name: Fineract Sonarqube |
| on: |
| workflow_dispatch: |
| workflow_call: |
| secrets: |
| SONAR_ORGANIZATION: |
| required: false |
| SONAR_PROJECT_KEY: |
| required: false |
| SONAR_HOST_URL: |
| required: false |
| SONARCLOUD_TOKEN: |
| required: false |
| DEVELOCITY_ACCESS_KEY: |
| required: false |
| permissions: |
| contents: read |
| jobs: |
| build: |
| if: >- |
| ${{ |
| github.event_name == 'push' && |
| ( |
| github.ref_name == 'develop' || |
| startsWith(github.ref_name, 'release/') || |
| startsWith(github.ref_name, '1.') |
| ) |
| }} |
| runs-on: ubuntu-24.04 |
| timeout-minutes: 90 |
| env: |
| TZ: Asia/Kolkata |
| SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }} |
| SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} |
| SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} |
| DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} |
| JAVA_BINARIES: . |
| steps: |
| - name: Set up JDK 21 |
| uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5 |
| with: |
| java-version: '21' |
| distribution: 'zulu' |
| - name: Download workspace |
| id: download-workspace |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 |
| continue-on-error: true |
| with: |
| name: fineract-workspace-${{ github.run_id }} |
| path: . |
| |
| - name: Extract workspace |
| if: steps.download-workspace.outcome == 'success' |
| run: tar -xf fineract-workspace.tar |
| |
| - name: Checkout |
| if: steps.download-workspace.outcome != 'success' |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| with: |
| persist-credentials: false |
| fetch-depth: 0 |
| fetch-tags: true |
| |
| - name: Build workspace fallback |
| if: steps.download-workspace.outcome != 'success' |
| uses: ./.github/actions/setup-and-build-fineract |
| with: |
| cache-read-only: false |
| - name: Setup Gradle and Validate Wrapper |
| uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 |
| with: |
| validate-wrappers: true |
| - name: Sonar |
| run: ./gradlew --no-daemon --console=plain -Dsonar.verbose=true -Dsonar.token=$SONAR_TOKEN -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.organization=$SONAR_ORGANIZATION -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.java.binaries=$JAVA_BINARIES --info --stacktrace sonar -x buildJavaSdk |