Support Azure pipeline (#22)
introduce azure pipeline, retire travis-ci
This commit is contained in:
parent
7e6f47ea30
commit
654ef21253
3 changed files with 102 additions and 18 deletions
101
.azure-pipelines.yml
Normal file
101
.azure-pipelines.yml
Normal file
|
|
@ -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/'
|
||||
12
.travis.yml
12
.travis.yml
|
|
@ -1,12 +0,0 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- "1.9"
|
||||
- "1.10"
|
||||
|
||||
install: true
|
||||
|
||||
script:
|
||||
- go build -o sshpiper ./sshpiperd
|
||||
- ./sshpiper version
|
||||
- ./cover.sh
|
||||
|
|
@ -1,14 +1,9 @@
|
|||
# SSH Piper
|
||||
|
||||
[](https://travis-ci.org/tg123/sshpiper)
|
||||
[](https://farmer1992.visualstudio.com/opensources/_build/latest?definitionId=15?branchName=master)
|
||||
[](https://goreportcard.com/report/github.com/tg123/sshpiper)
|
||||
[](https://godoc.org/github.com/tg123/sshpiper/ssh)
|
||||
|
||||
|
||||
sshpiper: [](https://coveralls.io/github/tg123/sshpiper.crypto)
|
||||
|
||||
sshpiperd: [](https://coveralls.io/github/tg123/sshpiper)
|
||||
|
||||
SSH Piper works as a proxy-like ware, and route connections by `username`, `src ip` , etc.
|
||||
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue