Skip to content

Commit

Permalink
Merge pull request #835 from eclipse/sonar
Browse files Browse the repository at this point in the history
Add test coverage
  • Loading branch information
amvanbaren authored Nov 16, 2023
2 parents 7d21a7b + 1956a7d commit a38c9f1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ jobs:
- uses: actions/checkout@v2
- name: Set Image Version
run: echo "IMAGE_VERSION=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
# - name: Build CLI
# run: yarn --cwd cli
# - name: Build Web UI Image
# run: docker build -t $WEBUI_TAG:$IMAGE_VERSION webui
# - name: Run Server Tests
# run: server/gradlew --no-daemon -p server check
# - name: Build Server Image
# run: docker build -t $SERVER_TAG:$IMAGE_VERSION server
# - name: Push Docker Images
# run: |
# echo ${{ secrets.BOT_ACCESS_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
# docker push $SERVER_TAG:$IMAGE_VERSION
# docker push $WEBUI_TAG:$IMAGE_VERSION
# if: github.repository == 'eclipse/openvsx' && github.ref == 'refs/heads/master'
- name: Build CLI
run: yarn --cwd cli
- name: Build Web UI Image
run: docker build -t $WEBUI_TAG:$IMAGE_VERSION webui
- name: Run Server Tests
run: server/gradlew --no-daemon -p server check
- name: Build Server Image
run: docker build -t $SERVER_TAG:$IMAGE_VERSION server
- name: Push Docker Images
run: |
echo ${{ secrets.BOT_ACCESS_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push $SERVER_TAG:$IMAGE_VERSION
docker push $WEBUI_TAG:$IMAGE_VERSION
if: github.repository == 'eclipse/openvsx' && github.ref == 'refs/heads/master'
- name: Save PR number to file
if: github.event_name == 'pull_request'
run: echo ${{ github.event.number }} > PR_NUMBER.txt
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,14 @@ jobs:
restore-keys: ${{ runner.os }}-gradle
- name: Make server libraries directory
run: mkdir server/libraries
- name: Copy server libraries #TODO remove after debugging
- name: Copy server libraries
run: find ~/.gradle/caches -type f -name '*.jar' -exec cp {} server/libraries \;
- name: List Files #TODO remove after debugging
run: ls -al server/libraries
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: Build Server
run: server/gradlew --no-daemon -p server compileJava compileScala compileTestJava compileTestScala
- name: Generate JaCoCo test report
run: server/gradlew --no-daemon -p server jacocoTestReport
- name: SonarCloud Scan on PR
if: github.event.workflow_run.event == 'pull_request'
uses: sonarsource/sonarcloud-github-action@master
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"bugs": "https://github.com/eclipse/openvsx/issues",
"contributors": [
{
"name": "Miro Sp�nemann",
"name": "Miro Spönemann",
"email": "miro.spoenemann@typefox.io",
"url": "https://www.typefox.io"
}
Expand Down
9 changes: 9 additions & 0 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ buildscript {
}
}
plugins {
id 'jacoco'
id 'nu.studer.jooq' version '8.2.1'
id 'de.undercouch.download' version '5.4.0'
id 'org.springframework.boot' version '3.1.0'
Expand Down Expand Up @@ -177,5 +178,13 @@ task unitTests(type: Test) {
exclude 'org/eclipse/openvsx/repositories/RepositoryServiceSmokeTest.class'
}

jacocoTestReport {
reports {
xml.required = true
}

dependsOn test // tests are required to run before generating the report
}

apply from: 'dependencies.gradle'
apply from: 'test-extensions.gradle'
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ sonar.java.binaries=server/build/classes/java/main
sonar.java.libraries=server/libraries/*.jar
sonar.java.test.binaries=server/build/classes/java/test
sonar.java.test.libraries=server/libraries/*.jar
sonar.coverage.jacoco.xmlReportPaths=server/build/reports/jacoco/test/jacocoTestReport.xml

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=openvsx
Expand Down

0 comments on commit a38c9f1

Please sign in to comment.