Adds do.sh build script
All checks were successful
gitea-deepak/gogmagog/pipeline/head This commit looks good
All checks were successful
gitea-deepak/gogmagog/pipeline/head This commit looks good
This commit is contained in:
parent
0a6caeffc5
commit
4801411b1d
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@ -18,7 +18,7 @@ pipeline {
|
||||
}
|
||||
stage('Compile') {
|
||||
steps {
|
||||
sh 'go build'
|
||||
sh './do.sh build'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
@ -26,7 +26,7 @@ pipeline {
|
||||
stage('go vet') {
|
||||
steps {
|
||||
echo 'Running vetting'
|
||||
sh 'go vet .'
|
||||
sh './do.sh _vet'
|
||||
}
|
||||
}
|
||||
stage('test') {
|
||||
@ -36,7 +36,7 @@ pipeline {
|
||||
steps {
|
||||
echo 'Running test'
|
||||
|
||||
sh 'go test -v -coverprofile=coverage.out -covermode count > tests.out ./...'
|
||||
sh './do.sh _test'
|
||||
|
||||
sh "go get github.com/tebeka/go2xunit"
|
||||
sh "go2xunit < tests.out -output tests.xml"
|
||||
@ -54,7 +54,7 @@ pipeline {
|
||||
PATH="${env.PATH}:${env.GOPATH}/bin"
|
||||
}
|
||||
steps {
|
||||
sh 'golint -set_exit_status ./...'
|
||||
sh './do.sh _lint'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
41
do.sh
Normal file
41
do.sh
Normal file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
# Do - The Simplest Build Tool on Earth.
|
||||
# Documentation and examples see https://github.com/8gears/do
|
||||
|
||||
set -Eeuo pipefail # -e "Automatic exit from bash shell script on error" -u "Treat unset variables and parameters as errors"
|
||||
|
||||
build() {
|
||||
echo "I am ${FUNCNAME[0]}ing"
|
||||
go version
|
||||
go build
|
||||
}
|
||||
|
||||
test() {
|
||||
echo "I am ${FUNCNAME[0]}ing"
|
||||
_test
|
||||
_lint
|
||||
_vet
|
||||
}
|
||||
|
||||
_test() {
|
||||
echo "I am ${FUNCNAME[0]}ing"
|
||||
go test -v -coverprofile=coverage.out -covermode count ./... | tee tests.out
|
||||
}
|
||||
|
||||
_lint() {
|
||||
echo "I am ${FUNCNAME[0]}ing"
|
||||
golint -set_exit_status ./...
|
||||
}
|
||||
|
||||
_vet() {
|
||||
echo "I am ${FUNCNAME[0]}ing"
|
||||
go vet ./...
|
||||
}
|
||||
|
||||
all() {
|
||||
test && build
|
||||
}
|
||||
|
||||
"$@" # <- execute the task
|
||||
|
||||
[ "$#" -gt 0 ] || printf "Usage:\n\t./do.sh %s\n" "($(compgen -A function | grep '^[^_]' | paste -sd '|' -))"
|
5
main.go
5
main.go
@ -45,8 +45,3 @@ func main() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Hello is method here to be testable.
|
||||
func Hello() string {
|
||||
return "Hello, world!\n"
|
||||
}
|
||||
|
@ -1,10 +1 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestHello(t *testing.T) {
|
||||
want := "Hello, world!\n"
|
||||
if got := Hello(); got != want {
|
||||
t.Errorf("Hello() = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user