mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-25 17:13:58 +08:00
Set up CI with Azure Pipelines. (#510)
This commit is contained in:
parent
5b5ae861ae
commit
f224970ceb
2 changed files with 55 additions and 0 deletions
43
azure-pipelines.yml
Normal file
43
azure-pipelines.yml
Normal file
|
@ -0,0 +1,43 @@
|
|||
variables:
|
||||
GOBIN: '$(GOPATH)/bin' # Go binaries path
|
||||
GOROOT: '/usr/local/go1.12' # Go installation path
|
||||
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
|
||||
modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code
|
||||
|
||||
trigger:
|
||||
batch: "true"
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
|
||||
- job: Compile
|
||||
strategy:
|
||||
maxParallel: 3
|
||||
matrix:
|
||||
Windows:
|
||||
OS: windows
|
||||
OSX:
|
||||
OS: darwin
|
||||
Linux:
|
||||
OS: linux
|
||||
steps:
|
||||
- template: build/azure-pipelines/go-env.yaml
|
||||
- script: "go run build/build.go -os $(OS)"
|
||||
workingDirectory: '$(modulePath)'
|
||||
|
||||
- job: "unittests"
|
||||
displayName: "Run Unit Tests"
|
||||
steps:
|
||||
- template: build/azure-pipelines/go-env.yaml
|
||||
- script: "go test ./..."
|
||||
workingDirectory: '$(modulePath)'
|
||||
|
||||
- job: "GoFmt"
|
||||
steps:
|
||||
- script: |
|
||||
go fmt ./...
|
||||
git diff
|
||||
git diff --exit-code
|
||||
|
12
build/azure-pipelines/go-env.yaml
Normal file
12
build/azure-pipelines/go-env.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
# shared step for setting up go env
|
||||
# see https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/go?view=azure-devops#build-a-container-image
|
||||
steps:
|
||||
- script: |
|
||||
mkdir -p '$(GOBIN)'
|
||||
mkdir -p '$(GOPATH)/pkg'
|
||||
mkdir -p '$(modulePath)'
|
||||
shopt -s extglob
|
||||
mv !(gopath) '$(modulePath)'
|
||||
echo '##vso[task.prependpath]$(GOBIN)'
|
||||
echo '##vso[task.prependpath]$(GOROOT)/bin'
|
||||
displayName: 'Set up the Go workspace'
|
Loading…
Reference in a new issue