From 654ef21253010f6a45c88e2eefbd9434dfd00a04 Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Fri, 11 Jan 2019 19:43:10 -0800 Subject: [PATCH] Support Azure pipeline (#22) introduce azure pipeline, retire travis-ci --- .azure-pipelines.yml | 101 +++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 12 ----- README.md | 7 +-- 3 files changed, 102 insertions(+), 18 deletions(-) create mode 100644 .azure-pipelines.yml delete mode 100644 .travis.yml diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml new file mode 100644 index 00000000..33bf1b87 --- /dev/null +++ b/.azure-pipelines.yml @@ -0,0 +1,101 @@ +pool: + vmImage: 'Ubuntu 16.04' + +variables: + GOBIN: '$(GOPATH)/bin' # Go binaries path + GOROOT: '/usr/local/go1.11' # Go installation path + GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path + modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code + +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' + +- script: | + set -e + + go version + go get -u golang.org/x/lint/golint + go get -u github.com/jstemmer/go-junit-report + go get -u github.com/axw/gocov/gocov + go get -u github.com/AlekSi/gocov-xml + go get -u gopkg.in/matm/v1/gocov-html + go get -u github.com/mattn/goveralls + + sudo apt install -y libpam0g-dev + workingDirectory: '$(modulePath)' + displayName: 'Get dependencies' + +- script: | + ./lint.sh + workingDirectory: '$(modulePath)' + displayName: Lint + +- script: | + set -e + + go build -tags pam -o sshpiper ./sshpiperd + ./sshpiper version + workingDirectory: '$(modulePath)' + displayName: 'Basic build' + +- script: | + set -e + + go test -tags pam -v -coverprofile=coverage.txt -covermode count ./... 2>&1 | go-junit-report > junit.xml + gocov convert coverage.txt > coverage.json + gocov-xml < coverage.json > coverage.xml + gocov-html < coverage.json > index.html + goveralls -coverprofile=coverage.txt -service=travis-ci -repotoken $COVERALLS_TOKEN + mkdir reports + cp junit.xml ./reports/junit.xml + cp coverage.xml ./reports/coverage.xml + cp index.html ./reports/index.html + + + workingDirectory: '$(modulePath)' + displayName: 'Run unit tests' + env: + COVERALLS_TOKEN: $(COVERALLS_TOKEN) + +- task: DockerCompose@0 + inputs: + dockerComposeFile: '$(modulePath)/sshpiperd/e2e/docker-compose.yml' + dockerComposeCommand: 'up --build --abort-on-container-exit --exit-code-from piper' + currentWorkingDirectory: '$(modulePath)' + displayName: E2E + +- task: DockerCompose@0 + inputs: + dockerComposeFile: '$(modulePath)/sshpiperd/snap/docker-compose.yml' + dockerComposeCommand: 'up --build --abort-on-container-exit' + currentWorkingDirectory: '$(modulePath)' + displayName: Generate snap + +- task: PublishTestResults@2 + inputs: + testRunner: JUnit + testResultsFiles: '$(modulePath)/reports/junit.xml' + +- task: PublishCodeCoverageResults@1 + inputs: + codeCoverageTool: 'cobertura' + summaryFileLocation: '$(modulePath)/reports/coverage.xml' + reportDirectory: '$(modulePath)/reports/' + +- task: PublishPipelineArtifact@0 + inputs: + artifactName: 'Test Reports' + targetPath: '$(modulePath)/reports/' + +- task: PublishPipelineArtifact@0 + inputs: + artifactName: 'Snap' + targetPath: '$(modulePath)/sshpiperd/snap/' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1431e15a..00000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: go - -go: - - "1.9" - - "1.10" - -install: true - -script: - - go build -o sshpiper ./sshpiperd - - ./sshpiper version - - ./cover.sh diff --git a/README.md b/README.md index 5ccea91c..6b13bdfc 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,9 @@ # SSH Piper -[![Build Status](https://travis-ci.org/tg123/sshpiper.svg?branch=master)](https://travis-ci.org/tg123/sshpiper) +[![Build Status](https://farmer1992.visualstudio.com/opensources/_apis/build/status/sshpiper?branchName=master)](https://farmer1992.visualstudio.com/opensources/_build/latest?definitionId=15?branchName=master) [![Go Report Card](https://goreportcard.com/badge/github.com/tg123/sshpiper)](https://goreportcard.com/report/github.com/tg123/sshpiper) -[![GoDoc](https://godoc.org/github.com/tg123/sshpiper/ssh?status.svg)](https://godoc.org/github.com/tg123/sshpiper/ssh) -sshpiper: [![Coverage Status](https://coveralls.io/repos/github/tg123/sshpiper.crypto/badge.svg)](https://coveralls.io/github/tg123/sshpiper.crypto) - -sshpiperd: [![Coverage Status](https://coveralls.io/repos/github/tg123/sshpiper/badge.svg)](https://coveralls.io/github/tg123/sshpiper) - SSH Piper works as a proxy-like ware, and route connections by `username`, `src ip` , etc. ```