-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazure-pipelines.yml
48 lines (40 loc) · 1.37 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
trigger:
branches:
include:
- master
jobs:
- job: "Build"
pool:
vmImage: "ubuntu-20.04"
variables:
- group: Environments
- name: goVersion
value: "1.15.6"
- name: sonarVersion
value: "4.6.0.2311"
steps:
- task: GoTool@0
inputs:
version: "$(goVersion)"
displayName: "Install go"
- script: |
make test
env:
GO111MODULE: on
displayName: "Test"
- script: |
go test $(go list ./... | grep -v /vendor | grep -v /test | grep -v /api) -cover=1 -short -coverprofile=./cov.out ./...
env:
GO111MODULE: on
displayName: "Save coverage"
- script: |
wget -qO- https://github.com/securego/gosec/releases/download/v2.7.0/gosec_2.7.0_linux_amd64.tar.gz | tar xvz
./gosec -no-fail -exclude-dir=test -exclude-dir=vendor -exclude-dir=api -fmt=sonarqube -out report.json ./...
env:
GO111MODULE: on
displayName: "Save secuity checker"
- script: |
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$(sonarVersion)-linux.zip -O sonar.zip
unzip sonar.zip
sonar-scanner-$(sonarVersion)-linux/bin/sonar-scanner -Dsonar.login=$(SONARQUBE) -Dsonar.host.url=$(SONARQUBE_URL)
displayName: "Run sonar scanner"