-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
52 lines (50 loc) · 1.41 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env groovy
// kcc-go
pipeline {
agent {
docker {
image 'golang:1.13'
}
}
environment {
GOBIN = '/tmp/go-bin'
GOCACHE = '/tmp/go-build'
HOME = '/tmp'
}
stages {
stage('Bootstrap') {
steps {
echo 'Bootstrapping..'
sh 'export'
sh 'go version'
sh 'curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOBIN) v1.21.0'
sh 'go get -v github.com/tebeka/go2xunit'
sh 'go mod vendor'
}
}
stage('Lint') {
steps {
echo 'Linting..'
sh 'PATH=$PATH:$GOBIN golangci-lint run --modules-download-mode vendor --out-format checkstyle --issues-exit-code 0 > tests.lint.xml'
checkstyle pattern: 'tests.lint.xml', canComputeNew: false, unstableTotalHigh: '100'
}
}
stage('Test') {
steps {
withCredentials([usernamePassword(credentialsId: 'TEST_CREDENTIALS', usernameVariable: 'TEST_USERNAME', passwordVariable: 'TEST_PASSWORD'), string(credentialsId: 'KOPANO_SERVER_DEFAULT_URI', variable: 'KOPANO_SERVER_DEFAULT_URI')]) {
echo 'Testing..'
sh 'echo Kopano Server URI: \$KOPANO_SERVER_DEFAULT_URI'
sh 'echo Kopano Server Username: \$TEST_USERNAME'
sh 'go test -v -count=1 | tee tests.output'
sh 'PATH=$PATH:$GOBIN go2xunit -fail -input tests.output -output tests.xml'
}
junit allowEmptyResults: true, testResults: 'tests.xml'
}
}
}
post {
always {
cleanWs()
}
}
}