This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
77 lines (67 loc) · 2.36 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Go
# Build your Go project.
# Add steps that test, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/go
trigger:
- master
pool:
vmImage: 'Ubuntu-16.04'
variables:
GOBIN: '$(GOPATH)/bin' # Go binaries path
GOROOT: '/usr/local/go1.11' # Go installation path
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code
GO111MODULE: on
CGO_LDFLAGS_ALLOW: '.*'
steps:
- script: |
wget "https://dl.google.com/go/go1.12.4.linux-amd64.tar.gz" --output-document "$(Agent.BuildDirectory)/go1.12.4.tar.gz"
tar -C '$(Agent.BuildDirectory)' -xzf "$(Agent.BuildDirectory)/go1.12.4.tar.gz"
displayName: 'Install Go 1.12.4'
- script: |
mkdir -p '$(GOBIN)'
mkdir -p '$(GOPATH)/pkg'
mkdir -p '$(modulePath)'
shopt -s extglob
shopt -s dotglob
mv !(gopath) '$(modulePath)'
echo '##vso[task.prependpath]$(GOBIN)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
sudo apt install bzr
displayName: 'Set up the Go workspace'
- script: |
git submodule update --init --recursive
cd c-deps
./builddeps.sh
cd ..
workingDirectory: '$(modulePath)'
displayName: 'Build rocksdb'
- script: |
go get github.com/jstemmer/go-junit-report
go get github.com/axw/gocov/gocov
go get github.com/AlekSi/gocov-xml
go get github.com/matm/gocov-html
workingDirectory: '$(modulePath)'
displayName: 'Download code coverage tools'
- script: |
go version
go mod download
go test -v -coverprofile=coverage.txt -covermode=count ./... 2>&1 | tee coverage.out
cat coverage.out | go-junit-report > report.xml
go vet -composites=false ./...
gocov convert coverage.txt > coverage.json
gocov-xml < coverage.json > coverage.xml
mkdir coverage
gocov-html < coverage.json > coverage/index.html
workingDirectory: '$(modulePath)'
displayName: 'Get dependencies, then build'
- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: $(System.DefaultWorkingDirectory)/**/report.xml
failTaskOnFailedTests: true
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(System.DefaultWorkingDirectory)/**/coverage.xml
reportDirectory: $(System.DefaultWorkingDirectory)/**/coverage