mirror of
https://github.com/SapphicCode/protoplex.git
synced 2025-09-26 19:31:23 +08:00
Add a Jenkinsfile (and some refactors) (#6)
This commit is contained in:
@@ -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
|
||||
|
127
Jenkinsfile
vendored
Normal file
127
Jenkinsfile
vendored
Normal file
@@ -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/*'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
5
go.mod
Normal file
5
go.mod
Normal file
@@ -0,0 +1,5 @@
|
||||
module github.com/Pandentia/protoplex
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8
|
Reference in New Issue
Block a user