Skip to content

Commit

Permalink
Merge pull request rsksmart#2565 from rsksmart/fix_sonar_test_coverag…
Browse files Browse the repository at this point in the history
…e_reports

Fix SonarQube zero tests coverage reports
  • Loading branch information
Vovchyk authored Jul 18, 2024
2 parents 5696a03 + 13fb6e9 commit a197428
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- "**"

jobs:
build-rskj:
build:
runs-on: ubuntu-latest
container:
image: openjdk:8-jdk
Expand Down Expand Up @@ -94,12 +94,18 @@ jobs:
path: |
rskj-core/build
- name: Download test reports
- name: Download test results
uses: actions/download-artifact@v4
with:
name: test-report
name: test-results
path: |
rskj-core/build/test-results/
- name: Download test reports
uses: actions/download-artifact@v4
with:
name: test-reports
path: |
rskj-core/build/reports/
- name: Run SonarQube analysis
Expand All @@ -119,19 +125,23 @@ jobs:
-Dsonar.organization=rsksmart \
-Dsonar.projectKey=rskj \
-Dsonar.host.url="https://sonarcloud.io" \
-Dsonar.junit.reportPaths=rskj-core/build/test-results/ \
-Dsonar.coverage.jacoco.xmlReportPaths=rskj-core/build/reports/jacoco/test/jacocoTestReport.xml \
-Dsonar.token="$SONAR_TOKEN"
else
./gradlew sonarqube --no-daemon -x build -x test \
-Dsonar.branch.name="$GH_REF" \
-Dsonar.organization=rsksmart \
-Dsonar.projectKey=rskj \
-Dsonar.host.url="https://sonarcloud.io" \
-Dsonar.junit.reportPaths=rskj-core/build/test-results/ \
-Dsonar.coverage.jacoco.xmlReportPaths=rskj-core/build/reports/jacoco/test/jacocoTestReport.xml \
-Dsonar.token="$SONAR_TOKEN"
fi
mining-tests:
needs: build-rskj
needs: build
runs-on: ubuntu-latest
services:
bitcoind1:
Expand Down Expand Up @@ -219,7 +229,7 @@ jobs:
| cut -d = -f 2- | paste -sd - -)
echo "Using RskJ version $version at ../rskj-core/build/libs/rskj-core-$version-all.jar"
java -Drsk.conf.file=./rsk-integration-test.conf -cp ../rskj-core/build/libs/rskj-core-"$version"-all.jar co.rsk.Start --regtest & rskpid=$!
tries=0
MAX_TRIES=10
while [ $tries -lt $MAX_TRIES ]; do
Expand All @@ -228,16 +238,17 @@ jobs:
tries=$((tries+1))
sleep 1
done
if [ $tries -eq $MAX_TRIES ]; then
echo "RskJ unreachable after $MAX_TRIES attempts. Aborting." >&2
exit 1
fi
npm test
kill $rskpid
unit-tests:
needs: build
runs-on: ubuntu-latest
container:
image: openjdk:8-jdk
Expand Down Expand Up @@ -270,12 +281,18 @@ jobs:
run: |
./gradlew --no-daemon --stacktrace test
- name: Persist test reports for sonar
- name: Persist test results for sonar
uses: actions/upload-artifact@v4
with:
name: test-report
name: test-results
path: |
rskj-core/build/test-results/
- name: Persist test reports for sonar
uses: actions/upload-artifact@v4
with:
name: test-reports
path: |
rskj-core/build/reports/
integration-tests:
Expand Down

0 comments on commit a197428

Please sign in to comment.