Skip to content

Commit

Permalink
Merge pull request #153 from kuisathaverat/jenkins_job
Browse files Browse the repository at this point in the history
ci: change to use Jenkins
  • Loading branch information
kuisathaverat authored Feb 5, 2021
2 parents 8bc71c4 + 2466d37 commit 78f1a93
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 104 deletions.
73 changes: 0 additions & 73 deletions .appveyor.yml

This file was deleted.

113 changes: 113 additions & 0 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/usr/bin/env groovy

@Library('apm@current') _

pipeline {
agent { label 'ubuntu-20 && immutable' }
environment {
REPO = 'gosigar'
BASE_DIR = "src/github.com/elastic/${env.REPO}"
PIPELINE_LOG_LEVEL='INFO'
}
options {
timeout(time: 1, unit: 'HOURS')
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10', daysToKeepStr: '30'))
timestamps()
ansiColor('xterm')
disableResume()
durabilityHint('PERFORMANCE_OPTIMIZED')
rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true])
quietPeriod(10)
}
triggers {
issueCommentTrigger('(?i)(.*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?|/test).*')
}
stages {
stage('Checkout') {
steps {
deleteDir()
gitCheckout(basedir: "${BASE_DIR}")
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
}
}
stage('Lint'){
steps {
withGoEnv(){
dir("${BASE_DIR}"){
sh(label: 'lint', script: '''
go mod tidy && git diff --exit-code
gofmt -l . | read && echo "Code differs from gofmt's style. Run 'gofmt -w .'" 1>&2 && exit 1 || true
''')
sh(label: 'Go vet', script: 'go vet')
}
}
}
}
stage('Build and test'){
matrix {
agent {label "${PLATFORM}"}
axes {
axis {
name 'PLATFORM'
values 'macosx', 'ubuntu-20 && immutable', 'windows-2012-r2 && windows-immutable'
}
}
stages {
stage('build'){
steps {
deleteDir()
unstash 'source'
withGoEnv(){
dir("${BASE_DIR}"){
cmd(label: 'Go build', script: 'go build')
}
}
}
}
stage('test'){
steps {
withGoEnv(){
dir("${BASE_DIR}"){
goTestJUnit(options: '-v ./...', output: 'junit-report.xml')
buildExamples()
}
}
}
post{
cleanup{
junit(testResults: "${BASE_DIR}/junit-report.xml", allowEmptyResults: true)
}
}
}
}
}
}
}
post {
cleanup {
notifyBuildResult(prComment: true)
}
}
}

def getExamplesDirs(){
return [
"examples/df",
"examples/free",
"examples/ps",
"examples/uptime"
]
}

def buildExamples(){
getExamplesDirs().each { exampleDir ->
cmd(label: "Build Example ${exampleDir}", script: "go build -o ${exampleDir}/out.exe ./${exampleDir}")
dir("${exampleDir}"){
def prefix = ''
if(isUnix()){
prefix = './'
}
cmd(label: "Running Example ${exampleDir}", script: "${prefix}out.exe")
}
}
}
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

0 comments on commit 78f1a93

Please sign in to comment.