dnscontrol/azure-pipelines.yml
Patrick Gaskin 2f83aa9302 Internals: Switch to v2 go.mod, drop GOPATH, and fix Azure Pipelines (#595)
* Switched to v2 go.mod

Also set GO111MODULE=on in build stuff to always use Go modules
even when in GOPATH.

* Ensure go.mod, go.sum, and vendor are up to date

* Attempt to fix Azure pipelines

* Add set -e to properly fail on exit (it didn't seem to be
  propagating properly before).
* Set workingDirectory for GoFmt and GoGen (this might be why it
  fails unlike compile and unitests).

* Another attempt to fix Azure Pipelines

* Use the Go env template for all go-related jobs.

* Completely fixed Azure Pipelines

* Added a display name to GoFmt for consistency.
* Fixed diffs for GoFmt and GoGen.
* Show git status for checks.

* Drop GOPATH for tests

TODO: Do the same for integration tests.

* Drop GOPATH for integration tests

* Show more diffs

* Regenerate provider support matrix

This wasn't done in #590...
2020-01-28 10:42:31 -05:00

70 lines
1.8 KiB
YAML

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 -mod=readonly build/build.go -os $(OS)"
- job: "unittests"
displayName: "Run Unit Tests"
steps:
- template: build/azure-pipelines/go-env.yaml
- 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; }
- job: "GoFmt"
displayName: "Check Go Formatting"
steps:
- template: build/azure-pipelines/go-env.yaml
- script: |
set -e
go fmt ./...
git status --porcelain
git diff
[ ! -n "$(git status --porcelain)" ] || { echo "Error: Go files not formatted, please run go fmt ./... ."; false; }
- job: "GoGen"
displayName: "Check Go Generate"
steps:
- template: build/azure-pipelines/go-env.yaml
- script: |
set -e
go generate .
git status --porcelain
git diff
[ ! -n "$(git status --porcelain)" ] || { echo "Error: Generated files not up to date, please run go generate . ."; false; }