Add sonar CI job (#2437)
This commit is contained in:
parent
786f485d78
commit
9bd7a3e2f7
|
@ -4,6 +4,9 @@
|
|||
expire_in: 1 hour
|
||||
paths:
|
||||
- result/*
|
||||
except:
|
||||
variables:
|
||||
- $SONARJOB == "1"
|
||||
|
||||
.debian_build_job:
|
||||
extends: .build_job
|
||||
|
@ -109,3 +112,25 @@ pages:
|
|||
only:
|
||||
- master
|
||||
|
||||
sonar-inspect:
|
||||
image: buildpkg/debian:buster
|
||||
stage: build
|
||||
script:
|
||||
- scripts/sonar
|
||||
artifacts:
|
||||
expire_in: 1 hour
|
||||
paths:
|
||||
- lemonldap-ng-*/cover_db/sonar_generic.xml
|
||||
- lemonldap-ng-*/perlcritic_report.txt
|
||||
only:
|
||||
variables:
|
||||
- $SONARJOB == "1"
|
||||
|
||||
sonar-upload:
|
||||
stage: deploy
|
||||
image: sonarsource/sonar-scanner-cli
|
||||
script:
|
||||
- sonar-scanner
|
||||
only:
|
||||
variables:
|
||||
- $SONARJOB == "1"
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
mk-build-deps --install --remove \
|
||||
--tool "apt-get -o Debug::pkgProblemResolver=yes -q -y" \
|
||||
debian/control
|
||||
apt -y install libperl-critic-perl libdevel-cover-perl cpanminus
|
||||
cpanm install Devel::Cover::Report::SonarGeneric
|
||||
make SKIP_DOCUMENTATION=1
|
||||
|
||||
for module in common handler portal manager; do
|
||||
cd lemonldap-ng-$module
|
||||
perlcritic --cruel --quiet --verbose "%f~|~%s~|~%l~|~%c~|~%m~|~%e~|~%p~||~%n" lib t > perlcritic_report.txt
|
||||
cover -delete
|
||||
HARNESS_PERL_SWITCHES=-MDevel::Cover prove
|
||||
cover -report SonarGeneric
|
||||
sed -i "s,path=\"blib,path=\"lemonldap-ng-$module,g" cover_db/sonar_generic.xml
|
||||
cd ..
|
||||
done
|
|
@ -0,0 +1,19 @@
|
|||
# must be unique in a given SonarQube instance
|
||||
# this is the name displayed in the SonarQube UI
|
||||
sonar.projectName=LemonLDAP::NG
|
||||
sonar.projectKey=lemonldap-ng
|
||||
|
||||
# Encoding of the source code. Default is default system encoding
|
||||
sonar.sourceEncoding=UTF-8
|
||||
sonar.sources=lib
|
||||
sonar.tests=t
|
||||
|
||||
sonar.modules=lemonldap-ng-common,lemonldap-ng-handler,lemonldap-ng-portal,lemonldap-ng-manager
|
||||
|
||||
lemonldap-ng-common.sonar.perlcritic.reportPath=lemonldap-ng-common/perlcritic_report.txt
|
||||
lemonldap-ng-handler.sonar.perlcritic.reportPath=lemonldap-ng-handler/perlcritic_report.txt
|
||||
lemonldap-ng-portal.sonar.perlcritic.reportPath=lemonldap-ng-portal/perlcritic_report.txt
|
||||
lemonldap-ng-manager.sonar.perlcritic.reportPath=lemonldap-ng-manager/perlcritic_report.txt
|
||||
|
||||
# requires manually fixing file paths in each coverage file
|
||||
sonar.coverageReportPaths=lemonldap-ng-common/cover_db/sonar_generic.xml,lemonldap-ng-handler/cover_db/sonar_generic.xml,lemonldap-ng-portal/cover_db/sonar_generic.xml,lemonldap-ng-manager/cover_db/sonar_generic.xml
|
Loading…
Reference in New Issue