From 578eb41b641ed7ff5eea1ebf5df958908c2f0534 Mon Sep 17 00:00:00 2001 From: Joel Hendrix Date: Wed, 10 Jul 2019 13:13:01 -0700 Subject: [PATCH] Refactor azure devops pipeline Break monolithic script into separate scripts with useful names. Moved formatting checks to the end with succeededOrFailed conditions. --- azure-pipelines.yml | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ab9eeacb9..f4a7642bd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -26,20 +26,27 @@ steps: go install ./vendor/golang.org/x/lint/golint workingDirectory: '$(sdkPath)' displayName: 'Install Dependencies' -- script: | - set -e - grep -L -r --include *.go --exclude-dir vendor -P "Copyright (\d{4}|\(c\)) Microsoft" ./ | tee >&2 | test -z "$(<&0)" - test -z "$(gofmt -s -l -w ./autorest/. | tee >&2)" - test -z "$(golint ./autorest/... | tee >&2)" +- script: go vet ./autorest/... workingDirectory: '$(sdkPath)' - displayName: 'Formatting and Linting' -- script: | - set -e - go vet ./autorest/... - go build -v ./autorest/... + displayName: 'Vet' +- script: go build -v ./autorest/... workingDirectory: '$(sdkPath)' - displayName: 'Vet and Build' -- script: | - go test -race -v ./autorest/... + displayName: 'Build' +- script: go test -race -v ./autorest/... workingDirectory: '$(sdkPath)' displayName: 'Run Tests' +- script: grep -L -r --include *.go --exclude-dir vendor -P "Copyright (\d{4}|\(c\)) Microsoft" ./ | tee >&2 + workingDirectory: '$(sdkPath)' + displayName: 'Copyright Header Check' + failOnStderr: true + condition: succeededOrFailed() +- script: gofmt -s -l -w ./autorest/. >&2 + workingDirectory: '$(sdkPath)' + displayName: 'Format Check' + failOnStderr: true + condition: succeededOrFailed() +- script: golint ./autorest/... >&2 + workingDirectory: '$(sdkPath)' + displayName: 'Linter Check' + failOnStderr: true + condition: succeededOrFailed()