forked from Bundle-App/blockatlas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
84 lines (71 loc) · 2.39 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
78
79
80
81
82
83
trigger:
branches:
include:
- master
tags:
include:
- '*'
pr:
branches:
include:
- master
pool:
vmImage: 'Ubuntu 16.04'
variables:
GITHUB_TOKEN: '$(git.token)'
GOBIN: '$(GOPATH)/bin' # Go binaries path
GOROOT: '/usr/local/go1.13' # Go installation path
GOPATH: '$(Build.SourcesDirectory)/gopath' # Go workspace path
modulePath: '$(GOPATH)/src/github.com/trustwallet/blockatlas' # Path to the module's code
jobs:
- job: Pipeline
steps:
- 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'
echo '$(go env)'
displayName: 'Set up the Go workspace'
- script: |
go version
go get -v -t -d ./...
workingDirectory: '$(modulePath)'
displayName: 'Get dependencies'
- script: make govet
workingDirectory: '$(modulePath)'
displayName: 'Run go vet'
- script: make test
workingDirectory: '$(modulePath)'
displayName: 'Run unit tests'
- script: |
go get github.com/gavv/httpexpect
make functional
workingDirectory: '$(modulePath)'
displayName: "Run functional tests for new PR's"
condition: ne(variables['build.sourceBranch'], 'refs/heads/master')
continueOnError: true
- script: |
go get github.com/gavv/httpexpect
make functional
workingDirectory: '$(modulePath)'
displayName: 'Run functional tests for new releases'
condition: eq(variables['build.sourceBranch'], 'refs/heads/master')
continueOnError: false
- script: make integration
workingDirectory: '$(modulePath)'
displayName: 'Run integration tests'
- script: make go-build
workingDirectory: '$(modulePath)'
displayName: 'Build'
condition: not(startsWith(variables['build.sourceBranch'], 'refs/tags/'))
- script: |
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
./bin/goreleaser --rm-dist
workingDirectory: '$(modulePath)'
displayName: 'Go Releaser'
condition: startsWith(variables['build.sourceBranch'], 'refs/tags/')