This repository has been archived by the owner on Jun 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathazure-pipelines.yml
123 lines (111 loc) · 3.26 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# 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:
branches:
include:
- '*'
tags:
include:
- '*'
stages:
- stage: tests
displayName: 'Tests'
jobs:
- job: unit_tests_linux
displayName: 'Unit tests on Ubuntu with'
strategy:
matrix:
Go_1_11:
imageName: 'ubuntu-16.04'
goroot: '/usr/local/go1.11'
Go_1_12:
imageName: 'ubuntu-18.04'
goroot: '/usr/local/go1.12'
Go_1_13:
imageName: 'ubuntu-18.04'
goroot: '/usr/local/go1.13'
pool:
vmImage: '$(imageName)'
variables:
GOBIN: '$(GOPATH)/bin' # Go binaries path
GOROOT: '$(goroot)' # 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'
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'
displayName: 'Set up the Go workspace'
- script: |
go version
go run ./cmd/make test
workingDirectory: '$(modulePath)'
displayName: 'Run unit tests'
- job: unit_tests_macOS
displayName: 'Unit tests on '
strategy:
matrix:
macOS_10_14:
imageName: 'macos-10.14'
pool:
vmImage: '$(imageName)'
steps:
- script: |
go version
go run ./cmd/make test
displayName: 'Run unit tests'
- job: unit_tests_windows
displayName: 'Unit tests on Windows'
pool:
vmImage: 'windows-2019'
steps:
- script: |
go version
go run ./cmd/make test
displayName: 'Run unit tests'
- job: Docker_image
displayName: 'Test Docker image'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: docker build -t "cistern:latest" .
displayName: 'Build Docker image'
- script: docker run "cistern:latest" --version
displayName: 'Run Docker image'
- stage: deploy
displayName: 'Deployment'
jobs:
- job: github_release
displayName: 'GitHub Release'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
sudo apt-get update && yes | sudo apt-get install pandoc
go run ./cmd/make release
displayName: 'Build release archives'
- task: GitHubRelease@0
displayName: 'Create GitHub release'
inputs:
gitHubConnection: release
repositoryName: '$(Build.Repository.Name)'
title: '$(Build.SourceBranch)'
isDraft: true
isPreRelease: true
releaseNotesFile: 'build/notes.md'
assets: |
build/cistern-*.tar.gz
build/cistern.man.html
build/cistern.man.1
build/cistern.toml
addChangeLog: false