FAQ
I ended up doing this:
1. Check out code into WORKSPACE

2. install plugin Inject Environment Variables
     put this in "Properties Content":
PATH=$PATH:/tmp/go/bin
GOPATH = $WORKSPACE/trunk
GOROOT = /tmp/go
GOTOOLDIR = /tmp/go/pkg/tool/linux_amd64
GOARCH=amd64
GOCHAR=6
GOHOSTARCH=amd64
GOHOSTOS=linux
GOOS=linux
CC=gcc
GOGCCFLAGS=-fPIC -m64 -pthread -fmessage-length=0
CXX=g++
CGO_ENABLED=1

then to run my tests in execution shell:
go get "whateverhere"
pushd $WORKSPACE/trunk/src/app/command01 && go test && popd
pushd $WORKSPACE/trunk/src/app/command02 && go test && popd


On Monday, August 6, 2012 11:58:56 AM UTC-7, Steven Degutis wrote:

I've wanted to test my special Go lib in Jenkins for CI before, but had no
idea how. In case anyone else is thinking the same, I figured it
out. Here's what I have so far as a "execute script" command as part of my
Jenkins build:

rm -rf $WORKSPACE/src $WORKSPACE/pkg
mkdir -p $WORKSPACE/src/jenkinsspecific
mv $WORKSPACE/* $WORKSPACE/src/jenkinsspecific || true
cd $WORKSPACE/src/jenkinsspecific
export GOPATH=$WORKSPACE
go get
go list -f '{{range .TestImports}}{{.}}
{{end}}' PACKAGE | xargs go get
go test

It's not perfect, and it doesn't run sub-packages but it gets the job done
for simple repos.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Dave Cheney at Apr 16, 2014 at 9:35 am
    As you've set GOPATH

    go test .../app/...

    would suffice

    On Wednesday, 16 April 2014 07:45:30 UTC+10,
    ni...@netops.animationmentor.com wrote:
    I ended up doing this:
    1. Check out code into WORKSPACE

    2. install plugin Inject Environment Variables
    put this in "Properties Content":
    PATH=$PATH:/tmp/go/bin
    GOPATH = $WORKSPACE/trunk
    GOROOT = /tmp/go
    GOTOOLDIR = /tmp/go/pkg/tool/linux_amd64
    GOARCH=amd64
    GOCHAR=6
    GOHOSTARCH=amd64
    GOHOSTOS=linux
    GOOS=linux
    CC=gcc
    GOGCCFLAGS=-fPIC -m64 -pthread -fmessage-length=0
    CXX=g++
    CGO_ENABLED=1

    then to run my tests in execution shell:
    go get "whateverhere"
    pushd $WORKSPACE/trunk/src/app/command01 && go test && popd
    pushd $WORKSPACE/trunk/src/app/command02 && go test && popd


    On Monday, August 6, 2012 11:58:56 AM UTC-7, Steven Degutis wrote:

    I've wanted to test my special Go lib in Jenkins for CI before, but had
    no idea how. In case anyone else is thinking the same, I figured it
    out. Here's what I have so far as a "execute script" command as part of my
    Jenkins build:

    rm -rf $WORKSPACE/src $WORKSPACE/pkg
    mkdir -p $WORKSPACE/src/jenkinsspecific
    mv $WORKSPACE/* $WORKSPACE/src/jenkinsspecific || true
    cd $WORKSPACE/src/jenkinsspecific
    export GOPATH=$WORKSPACE
    go get
    go list -f '{{range .TestImports}}{{.}}
    {{end}}' PACKAGE | xargs go get
    go test

    It's not perfect, and it doesn't run sub-packages but it gets the job
    done for simple repos.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 15, '14 at 11:15p
activeApr 16, '14 at 9:35a
posts2
users2
websitegolang.org

2 users in discussion

Dave Cheney: 1 post Nick: 1 post

People

Translate

site design / logo © 2022 Grokbase