-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
50 lines (42 loc) · 1.15 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
#! /usr/bin/env groovy
pipeline {
agent { label 'docker' }
environment {
COMPOSE_FILE = 'docker-compose.ci.yml'
COMPOSE_PROJECT_NAME = "${env.JOB_NAME}-${env.BUILD_ID}"
}
stages {
stage('Build Image') {
steps {
sh "docker-compose build --pull"
}
}
stage('Install') {
steps {
sh "docker-compose run --rm -T test go install ./..."
}
}
stage('Vet') {
steps {
echo 'Running `go vet`…'
sh "docker-compose run --rm -T test go vet ./..."
}
}
stage('Fmt') {
steps {
echo 'Running `go fmt`…'
sh "docker-compose run --rm -T test /bin/sh -c 'gofmt -e -d . | tee /dev/stderr > bad_files.txt && test ! -s bad_files.txt'"
}
}
stage('Test') {
steps {
sh "docker-compose run --rm -T test go test ./..."
}
}
}
post {
cleanup {
sh "docker-compose down --remove-orphans --rmi=all --volumes"
}
}
}