Gitlab-CI: Sonar for merge requests

Signed-off-by: Taylor Smock <tsmock@fb.com>
pull/1/head
Taylor Smock 2020-12-23 08:33:29 -07:00
rodzic a47032c8ec
commit 504e06faf5
1 zmienionych plików z 22 dodań i 3 usunięć

Wyświetl plik

@ -37,6 +37,8 @@ assemble:
artifacts: artifacts:
paths: paths:
- build/ - build/
interruptible: true
assemble with java 11: assemble with java 11:
stage: build stage: build
@ -46,6 +48,7 @@ assemble with java 11:
artifacts: artifacts:
paths: paths:
- build/ - build/
interruptible: true
assemble with java 12: assemble with java 12:
stage: build stage: build
@ -56,6 +59,7 @@ assemble with java 12:
paths: paths:
- build/ - build/
allow_failure: true allow_failure: true
interruptible: true
assemble with java 13: assemble with java 13:
stage: build stage: build
@ -66,6 +70,7 @@ assemble with java 13:
paths: paths:
- build/ - build/
allow_failure: true allow_failure: true
interruptible: true
assemble with java 14: assemble with java 14:
stage: build stage: build
@ -76,6 +81,7 @@ assemble with java 14:
paths: paths:
- build/ - build/
allow_failure: true allow_failure: true
interruptible: true
assemble with java 15: assemble with java 15:
stage: build stage: build
@ -86,6 +92,7 @@ assemble with java 15:
paths: paths:
- build/ - build/
allow_failure: true allow_failure: true
interruptible: true
code_navigation: code_navigation:
stage: build stage: build
@ -107,6 +114,7 @@ code_navigation:
- if: '$CI_PIPELINE_SOURCE != "schedule" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - if: '$CI_PIPELINE_SOURCE != "schedule" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: always when: always
allow_failure: true allow_failure: true
interruptible: true
############## ##############
# Test stage # # Test stage #
@ -120,6 +128,7 @@ build:
paths: paths:
- build - build
needs: ["assemble"] needs: ["assemble"]
interruptible: true
test: test:
stage: test stage: test
@ -133,6 +142,7 @@ test:
reports: reports:
junit: build/test-results/**/TEST-*.xml junit: build/test-results/**/TEST-*.xml
needs: ["assemble"] needs: ["assemble"]
interruptible: true
coverage: coverage:
stage: deploy stage: deploy
@ -143,18 +153,21 @@ coverage:
artifacts: artifacts:
reports: reports:
cobertura: "build/reports/jacoco/test/coverage.xml" cobertura: "build/reports/jacoco/test/coverage.xml"
interruptible: true
compile against min JOSM: compile against min JOSM:
stage: test stage: test
script: script:
- ./gradlew compileJava_minJosm - ./gradlew compileJava_minJosm
needs: ["assemble"] needs: ["assemble"]
interruptible: true
compile against latest JOSM: compile against latest JOSM:
stage: test stage: test
script: script:
- ./gradlew compileJava_latestJosm - ./gradlew compileJava_latestJosm
needs: ["assemble"] needs: ["assemble"]
interruptible: true
build with java 11: build with java 11:
stage: test stage: test
@ -163,6 +176,7 @@ build with java 11:
- ./gradlew build - ./gradlew build
allow_failure: true # due to copy-paste-detection allow_failure: true # due to copy-paste-detection
needs: ["assemble with java 11"] needs: ["assemble with java 11"]
interruptible: true
build with java 12: build with java 12:
stage: test stage: test
@ -171,6 +185,7 @@ build with java 12:
- ./gradlew build - ./gradlew build
allow_failure: true allow_failure: true
needs: ["assemble with java 12"] needs: ["assemble with java 12"]
interruptible: true
build with java 13: build with java 13:
stage: test stage: test
@ -179,6 +194,7 @@ build with java 13:
- ./gradlew build - ./gradlew build
allow_failure: true allow_failure: true
needs: ["assemble with java 13"] needs: ["assemble with java 13"]
interruptible: true
build with java 14: build with java 14:
stage: test stage: test
@ -187,6 +203,7 @@ build with java 14:
- ./gradlew build - ./gradlew build
allow_failure: true allow_failure: true
needs: ["assemble with java 14"] needs: ["assemble with java 14"]
interruptible: true
build with java 15: build with java 15:
stage: test stage: test
@ -195,6 +212,7 @@ build with java 15:
- ./gradlew build - ./gradlew build
allow_failure: true allow_failure: true
needs: ["assemble with java 15"] needs: ["assemble with java 15"]
interruptible: true
################ ################
# Deploy stage # # Deploy stage #
@ -214,6 +232,7 @@ build with java 15:
# needs: ["assemble"] # needs: ["assemble"]
# only: # only:
# - master # - master
# interruptible: true
sonarcloud.io: sonarcloud.io:
image: registry.gitlab.com/josm/docker-library/openjdk-11-josmplugin:latest image: registry.gitlab.com/josm/docker-library/openjdk-11-josmplugin:latest
@ -224,12 +243,12 @@ sonarcloud.io:
script: script:
- git fetch --unshallow - git fetch --unshallow
- ./gradlew -Dsonar.login=$SONAR_TOKEN sonarqube - ./gradlew -Dsonar.login=$SONAR_TOKEN sonarqube
needs: ["test"] needs: []
rules: rules:
- if: '$CI_COMMIT_TAG && $SONAR_TOKEN =~ /[0-9a-z]+/' - if: '$CI_COMMIT_TAG && $SONAR_TOKEN =~ /[0-9a-z]+/'
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $SONAR_TOKEN =~ /[0-9a-z]+/' - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $SONAR_TOKEN =~ /[0-9a-z]+/'
#- if: '$CI_MERGE_REQUEST_IID && $SONAR_TOKEN =~ /[0-9a-z]+/' - if: '$CI_MERGE_REQUEST_IID && $SONAR_TOKEN =~ /[0-9a-z]+/'
#- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $SONAR_TOKEN =~ /[0-9a-z]+/' - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $SONAR_TOKEN =~ /[0-9a-z]+/'
release: release: