Skip to content

Commit

Permalink
Add jenkins to build + run tests (#37)
Browse files Browse the repository at this point in the history
Jenkinsfile has 2 stages to build and run unit tests.
  • Loading branch information
mstemm authored Jan 29, 2020
1 parent 55cc2da commit f5407c5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
26 changes: 26 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pipeline {
agent {
label 'builder-backend-j8'
}

stages {
stage("Build") {
steps {
dir(".") {
script {
sh "ls && pwd && echo $PWD && docker run --rm -v \$(pwd):/usr/src/myapp -w /usr/src/myapp golang:1.13 make build"
}
}
}
}
stage("Tests") {
steps {
dir(".") {
script {
sh "docker run --rm -v \$(pwd):/usr/src/myapp -w /usr/src/myapp golang:1.13 go test ./..."
}
}
}
}
}
}
3 changes: 0 additions & 3 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

set -eux

# run unit test before build
go test ./...

export GO111MODULE=on

$GOPATH/bin/goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*") || true
Expand Down

0 comments on commit f5407c5

Please sign in to comment.