Skip to content

Commit

Permalink
Проверка сонаром на трависе
Browse files Browse the repository at this point in the history
Переименован сонар аддон


SonarHost


sonar.organization


lf


lf


apt-get


Правильный путь


sudo travis


Опять травис


Сонаркешь в гитигнор


chmod +x


chmod
  • Loading branch information
asosnoviy committed Mar 20, 2018
1 parent 4cc6a7a commit 3121895
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.vscode/launch.json
sonarlint.json

\.sonar/
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sudo: required
dist: trusty
addons:
sonarcloud: true
jdk:
- oraclejdk8
before_install:
- chmod +x travis.sh
cache:
directories:
- '$HOME/.m2/repository'
- '$HOME/.sonar/cache'
script:
- ./travis.sh
19 changes: 19 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# must be unique in a given SonarQube instance
sonar.projectKey=opensource-irac

# this is the name displayed in the SonarQube UI
sonar.projectName=opensource-irac

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
# If not set, SonarQube starts looking for source code from the directory containing
# the sonar-project.properties file.

sonar.sources=./src

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8

sonar.organization=sonar-opensource-add

# sonar.coverageReportPaths=coverage/genericCoverage.xml
28 changes: 28 additions & 0 deletions travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

#!/bin/bash
set -e

# oscript /usr/share/oscript/lib/opm/src/opm.os run coverage

temp=`cat packagedef | grep ".Версия(" | sed 's|[^"]*"||' | sed -r 's/".+//'`
version=${temp##*|}

if [ "$TRAVIS_SECURE_ENV_VARS" == "true" ]; then
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
sonar-scanner \
-Dsonar.host.url=https://sonar.silverbulleters.org \
-Dsonar.analysis.mode=issues \
-Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST \
-Dsonar.github.repository=$TRAVIS_REPO_SLUG \
-Dsonar.github.oauth=$SONAR_GITHUB_TOKEN \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.scanner.skip=false

elif [ "$TRAVIS_BRANCH" == "develop" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
sonar-scanner \
-Dsonar.host.url=https://sonar.silverbulleters.org \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.projectVersion=$version\
-Dsonar.scanner.skip=false
fi
fi

0 comments on commit 3121895

Please sign in to comment.