ci:update image tag (#15607) (#15673) #32737
This file contains 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: | |
- master | |
- '2.3[1-9]' | |
pull_request: | |
branches: | |
- master | |
- '2.3[1-9]' | |
concurrency: | |
group: ${{ github.workflow}}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
sonarqube: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Cache maven artifacts | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }} | |
restore-keys: ${{ runner.os }}-maven- | |
- name: Analyse PR | |
env: | |
BASE_BRANCH: ${{ github.base_ref }} | |
BRANCH: ${{ github.ref }} | |
PR: ${{ github.event.number }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.DHIS2_BOT_SONARCLOUD_TOKEN }} | |
MAVEN_BUILD_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=125 | |
if: github.event_name == 'pull_request' | |
run: | | |
mvn -f dhis-2/pom.xml clean install -Psonarqube -Pjdk11 $MAVEN_BUILD_OPTS | |
mvn -f dhis-2/pom.xml sonar:sonar -Dsonar.internal.analysis.dbd=false -Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} -Dsonar.projectKey=dhis2_dhis2-core -Dsonar.coverage.jacoco.xmlReportPaths=$(find "$(pwd)" -path '*jacoco.xml' | sed 's/.*/&/' | tr '\n' ',') $MAVEN_BUILD_OPTS | |
- name: Analyse long-living branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.DHIS2_BOT_SONARCLOUD_TOKEN }} | |
MAVEN_BUILD_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=125 | |
if: github.event_name != 'pull_request' | |
run: | | |
mvn -f dhis-2/pom.xml clean install -Psonarqube -Pjdk11 $MAVEN_BUILD_OPTS | |
mvn -f dhis-2/pom.xml sonar:sonar -Dsonar.internal.analysis.dbd=false -Dsonar.branch.name=${GITHUB_REF#refs/heads/} -Dsonar.projectKey=dhis2_dhis2-core -Dsonar.coverage.jacoco.xmlReportPaths=$(find "$(pwd)" -path '*jacoco.xml' | sed 's/.*/&/' | tr '\n' ',') $MAVEN_BUILD_OPTS |