.travis.yml 1.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
language: go
dist: trusty

go:
- 1.12.x

env:
  global:
    - GO111MODULE=on

addons:
  sonarcloud:
    organization: "jenkins-zh"
    token:
      secure: 3caad1285eb0edf2b4f65ee07b3cd8edde6c5176 # encrypted value of your token

script:
  - make clean
  # Execute some tests
LinuxSuRen's avatar
LinuxSuRen 已提交
20
  - make tools init test
21 22 23 24
  # And finally run the SonarQube analysis - read the "sonar-project.properties"
  # file to see the specific configuration
  - curl -LsS https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.0.0.1744-linux.zip > sonar-scanner-cli-4.0.0.1744-linux.zip
  - unzip sonar-scanner-cli-4.0.0.1744-linux.zip
25 26
  - export branch=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo pr-$TRAVIS_PULL_REQUEST; fi)
  - sonar-scanner-4.0.0.1744-linux/bin/sonar-scanner -D sonar.branch.name=$branch -Dsonar.projectKey=jenkins-zh_jenkins-cli -Dsonar.organization=jenkins-zh -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=674e187e300edc0ad56a05705bd0b21cbe18bd52
27
  # it's bad, but no better solution for now
LinuxSuRen's avatar
LinuxSuRen 已提交
28 29
#  - sleep 30
#  - if [ 'OK' != $(curl -s "https://sonarcloud.io/api/qualitygates/project_status?branch=$branch&projectKey=jenkins-zh_jenkins-cli" | python -c "import sys, json; print(json.load(sys.stdin)['projectStatus']['status'])") ]; then exit -1; fi