2019-06-27 13:40:18 +08:00
|
|
|
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
|
2020-01-28 23:42:31 +08:00
|
|
|
- script: "go run -mod=readonly build/build.go -os $(OS)"
|
2019-06-27 13:40:18 +08:00
|
|
|
|
|
|
|
- job: "unittests"
|
|
|
|
displayName: "Run Unit Tests"
|
|
|
|
steps:
|
|
|
|
- template: build/azure-pipelines/go-env.yaml
|
2020-01-28 23:42:31 +08:00
|
|
|
- script: "go test -mod=readonly ./..."
|
|
|
|
|
|
|
|
- job: "modtidy"
|
|
|
|
displayName: "Check Go Modules"
|
|
|
|
steps:
|
|
|
|
- template: build/azure-pipelines/go-env.yaml
|
|
|
|
- script: |
|
|
|
|
set -e
|
|
|
|
go mod tidy
|
|
|
|
git status --porcelain
|
|
|
|
git diff
|
|
|
|
[ ! -n "$(git status --porcelain go.mod go.sum)" ] || { echo "Error: go.mod/go.sum outdated, please run go mod tidy."; false; }
|
|
|
|
|
|
|
|
- job: "modvendor"
|
|
|
|
displayName: "Check Go Vendor"
|
|
|
|
steps:
|
|
|
|
- template: build/azure-pipelines/go-env.yaml
|
|
|
|
- script: |
|
|
|
|
set -e
|
|
|
|
go mod vendor
|
|
|
|
git status --porcelain
|
|
|
|
[ ! -n "$(git status --porcelain vendor)" ] || { echo "Error: Vendor does not match go.mod/go.sum, please run go mod vendor."; false; }
|
2019-06-27 13:40:18 +08:00
|
|
|
|
|
|
|
- job: "GoFmt"
|
2020-01-28 23:42:31 +08:00
|
|
|
displayName: "Check Go Formatting"
|
2019-06-27 13:40:18 +08:00
|
|
|
steps:
|
2020-01-28 23:42:31 +08:00
|
|
|
- template: build/azure-pipelines/go-env.yaml
|
2019-06-27 13:40:18 +08:00
|
|
|
- script: |
|
2020-01-28 23:42:31 +08:00
|
|
|
set -e
|
2019-06-27 13:40:18 +08:00
|
|
|
go fmt ./...
|
2020-01-28 23:42:31 +08:00
|
|
|
git status --porcelain
|
2019-06-27 13:40:18 +08:00
|
|
|
git diff
|
2020-01-28 23:42:31 +08:00
|
|
|
[ ! -n "$(git status --porcelain)" ] || { echo "Error: Go files not formatted, please run go fmt ./... ."; false; }
|
2019-06-27 13:40:18 +08:00
|
|
|
|
2020-01-03 05:09:19 +08:00
|
|
|
- job: "GoGen"
|
|
|
|
displayName: "Check Go Generate"
|
|
|
|
steps:
|
2020-01-28 23:42:31 +08:00
|
|
|
- template: build/azure-pipelines/go-env.yaml
|
2020-01-03 05:09:19 +08:00
|
|
|
- script: |
|
2020-01-28 23:42:31 +08:00
|
|
|
set -e
|
2020-01-03 05:09:19 +08:00
|
|
|
go generate .
|
2020-01-28 23:42:31 +08:00
|
|
|
git status --porcelain
|
2020-01-03 05:09:19 +08:00
|
|
|
git diff
|
2020-01-28 23:42:31 +08:00
|
|
|
[ ! -n "$(git status --porcelain)" ] || { echo "Error: Generated files not up to date, please run go generate . ."; false; }
|