2727 secrets :
2828 SONAR_TOKEN :
2929 required : false
30+ CODECOV_TOKEN :
31+ required : false
3032
3133permissions :
3234 contents : read
@@ -35,64 +37,63 @@ permissions:
3537jobs :
3638 build :
3739 name : Sonar JaCoCo Coverage
38- runs-on : ubuntu-22 .04
40+ runs-on : ubuntu-24 .04
3941 steps :
40- # PR callers check out the merge commit; branch callers use the pushed SHA.
41- - uses : actions/checkout@v6
42+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4243 with :
4344 ref : ${{ inputs.is_pr && format('refs/pull/{0}/merge', github.event.number) || github.sha }}
4445 fetch-depth : 0
46+ persist-credentials : false
4547
46- - name : Set up JDK17
47- uses : actions/setup-java@v5
48+ - name : Setup Environment
49+ uses : ./.github/ actions/setup-env
4850 with :
49- distribution : ' temurin'
50- java-version : ' 17'
51- cache : ' maven'
51+ install-python : ' true'
52+ install-apt-deps : ' true'
5253
5354 - name : Cache SonarCloud packages
54- uses : actions/cache@v5
55+ uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
5556 with :
5657 path : ~/.sonar/cache
5758 key : ${{ runner.os }}-sonar
5859 restore-keys : ${{ runner.os }}-sonar
5960
6061 - name : Cache local Maven repository
61- uses : actions/cache@v5
62+ uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6263 with :
6364 path : ~/.m2/repository
6465 key : ${{ runner.os }}-m2-${{ hashFiles('pom.xml', '*/pom.xml', '*/*/pom.xml', '*/*/*/pom.xml') }}
6566 restore-keys : |
6667 ${{ runner.os }}-m2
6768
6869 - name : Install Non-OSS
69- run : |
70- git clone https://github.com/shapeblue/cloudstack-nonoss.git nonoss
71- cd nonoss && bash -x install-non-oss.sh && cd ..
70+ uses : ./.github/actions/install-nonoss
71+
72+ - name : Run Build and Tests with Coverage
73+ run : mvn -B -T$(nproc) -P developer,systemvm,quality -Dsimulator -Dnoredist clean install
7274
73- - name : Run Build and Tests with Coverage (PR)
74- if : inputs.is_pr
75+ - name : Upload to SonarQube
76+ if : inputs.is_pr && github.repository == 'apache/cloudstack' && github.event.pull_request.head.repo.full_name == github.repository
7577 env :
7678 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7779 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
7880 PR_ID : ${{ github.event.pull_request.number }}
7981 HEADREF : ${{ github.event.pull_request.head.ref }}
80- run : >
81- mvn -T$(nproc) -P quality -Dsimulator -Dnoredist clean install
82- org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
83- -Dsonar.projectKey=apache_cloudstack
84- -Dsonar.pullrequest.key="$PR_ID"
85- -Dsonar.pullrequest.branch="$HEADREF"
86- -Dsonar.pullrequest.github.repository=apache/cloudstack
87- -Dsonar.pullrequest.provider=GitHub
88- -Dsonar.pullrequest.github.summary_comment=true
82+ run : |
83+ mvn -B -P quality org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=apache_cloudstack -Dsonar.pullrequest.key="$PR_ID" -Dsonar.pullrequest.branch="$HEADREF" -Dsonar.pullrequest.github.repository=apache/cloudstack -Dsonar.pullrequest.provider=GitHub -Dsonar.pullrequest.github.summary_comment=true
8984
90- - name : Run Tests with Coverage (Main)
85+ - name : Upload to SonarQube
9186 if : " !inputs.is_pr"
9287 env :
9388 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
9489 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
95- run : >
96- mvn -T$(nproc) -P quality -Dsimulator -Dnoredist clean install
97- org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
98- -Dsonar.projectKey=apache_cloudstack
90+ run : mvn -B -P quality org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=apache_cloudstack -Dsonar.branch.name=${{ github.ref_name }}
91+
92+ - uses : codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
93+ with :
94+ files : ./client/target/site/jacoco-aggregate/jacoco.xml
95+ fail_ci_if_error : true
96+ flags : unittests
97+ verbose : true
98+ name : codecov
99+ token : ${{ secrets.CODECOV_TOKEN }}
0 commit comments