diff --git a/Dockerfile b/Dockerfile index cefca0c..7827f2b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM golang:1-alpine AS build RUN apk add git RUN mkdir -p /go/src/github.com/Pandentia COPY ./ /go/src/github.com/Pandentia/protoplex -RUN go get github.com/Pandentia/protoplex +RUN go get github.com/Pandentia/protoplex/cmd/protoplex # deploy FROM alpine:latest diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..ea3ee04 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,127 @@ +String buildCommand = ''' +export CGO_ENABLED=0 + +export GOOS=$(echo ${STAGE_NAME} | cut -d '/' -f 1) +export GOARCH=$(echo ${STAGE_NAME} | cut -d '/' -f 2) + +go build -o builds/protoplex_${GOOS}_${GOARCH} -ldflags "-s -w" ./cmd/protoplex +''' + +pipeline { + agent { + label 'go' + } + stages { + stage('Prepare') { + steps{ + checkout scm + sh 'go get -u -v .' + sh 'mkdir -p builds' + } + } + stage('Build') { + stages { + stage('linux/386') { + steps { + sh buildCommand + } + } + stage('linux/amd64') { + steps { + sh buildCommand + } + } + stage('linux/arm') { + steps { + sh buildCommand + } + } + stage('linux/arm64') { + steps { + sh buildCommand + } + } + stage('linux/mips') { + steps { + sh buildCommand + } + } + stage('linux/mips64') { + steps { + sh buildCommand + } + } + stage('linux/mips64le') { + steps { + sh buildCommand + } + } + stage('linux/ppc64') { + steps { + sh buildCommand + } + } + stage('linux/ppc64le') { + steps { + sh buildCommand + } + } + stage('linux/s390x') { + steps { + sh buildCommand + } + } + stage('windows/386') { + steps { + sh buildCommand + } + } + stage('windows/amd64') { + steps { + sh buildCommand + } + } + stage('windows/arm') { + steps { + sh buildCommand + } + } + stage('freebsd/386') { + steps { + sh buildCommand + } + } + stage('freebsd/amd64') { + steps { + sh buildCommand + } + } + stage('freebsd/arm') { + steps { + sh buildCommand + } + } + stage('netbsd/386') { + steps { + sh buildCommand + } + } + stage('netbsd/amd64') { + steps { + sh buildCommand + } + } + stage('netbsd/arm') { + steps { + sh buildCommand + } + } + } + } + stage('Cleanup') { + steps { + archiveArtifacts 'builds/*' + } + } + } +} diff --git a/protoplex.go b/cmd/protoplex/protoplex.go similarity index 100% rename from protoplex.go rename to cmd/protoplex/protoplex.go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..9a2f7aa --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/Pandentia/protoplex + +go 1.12 + +require github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..d60ee79 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8 h1:UUHMLvzt/31azWTN/ifGWef4WUqvXk0iRqdhdy/2uzI= +github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=