Clean up Jenkinsfile-manual and Travis (#478)

Small clean up of Jenkinsfile-manual required after rebuilding Jenkins. Also improved .travis.yml a bit.
This commit is contained in:
Adam Babik 2017-11-29 07:48:40 +01:00 committed by GitHub
parent ab29ad57ba
commit d6d5945ab4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 39 deletions

View File

@ -7,14 +7,15 @@ sudo: false
dist: trusty
install:
- go get golang.org/x/tools/cmd/cover
- make lint-deps
- make mock-install
- make lint-install
jobs:
include:
- stage: Lint
script: make lint
- stage: Test unit and integration
script: make test-unit-coverage
- stage: Test e2e on privite network
- stage: Test e2e on private network
script: make test-e2e
- stage: Test e2e on public network
# disable running this stage for PRs as they do not have access

View File

@ -16,23 +16,30 @@ def getVersion(branch, sha, buildNumber) {
}
node('linux') {
env.GOPATH = "${env.WORKSPACE}"
cloneDir = 'src/github.com/status-im/status-go'
paramBranch = env.branch ? ('*/' + env.branch) : '*/develop'
checkout(
changelog: false,
poll: false,
poll: true,
scm: [$class: 'GitSCM', branches: [[name: paramBranch]],
doGenerateSubmoduleConfigurations: false,
extensions: [],
extensions: [
[$class: 'RelativeTargetDirectory', relativeTargetDir: cloneDir]
],
submoduleCfg: [],
userRemoteConfigs: [[url: 'https://github.com/status-im/status-go']]]
)
def remoteOriginRegex = ~/^remotes\/origin\//
gitSHA = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
gitShortSHA = gitSHA.take(7)
gitBranch = sh(returnStdout: true, script: 'git name-rev --name-only HEAD').trim() - remoteOriginRegex
dir(cloneDir) {
gitSHA = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
gitShortSHA = gitSHA.take(8)
gitBranch = sh(returnStdout: true, script: 'git name-rev --name-only HEAD').trim() - remoteOriginRegex
}
stage('Debug') {
sh 'env'
@ -40,49 +47,59 @@ node('linux') {
println(gitSHA)
}
// TODO(adam): enable when unit tests start passing
// stage('Test') {
// sh 'make ci'
// }
stage('Test') {
sh '''
make lint-install
make mock-install
make ci
'''
}
stage('Build') {
sh 'go get github.com/karalabe/xgo'
parallel (
'statusgo-android': {
sh 'make statusgo-android'
dir(cloneDir) {
sh 'make statusgo-android'
}
},
'statusgo-ios-simulator': {
sh '''
make statusgo-ios-simulator
cd build/bin/statusgo-ios-9.3-framework/
zip -r status-go-ios.zip Statusgo.framework
'''
dir(cloneDir) {
sh '''
make statusgo-ios-simulator
cd build/bin/statusgo-ios-9.3-framework/
zip -r status-go-ios.zip Statusgo.framework
'''
}
}
)
}
stage('Deploy') {
// For branch builds, replace the old artifact. For develop keep all of them.
def version = gitBranch == 'develop' ? getVersion(gitBranch, gitShortSHA, '') : getVersion(gitBranch, gitShortSHA, env.BUILD_ID)
def server = Artifactory.server 'artifactory'
def uploadSpec = """{
"files": [
{
"pattern": "build/bin/statusgo-android-16.aar",
"target": "libs-release-local/status-im/status-go/${version}/status-go-${version}.aar"
},
{
"pattern": "build/bin/statusgo-ios-9.3-framework/status-go-ios.zip",
"target": "libs-release-local/status-im/status-go-ios-simulator/${version}/status-go-ios-simulator-${version}.zip"
}
]
}"""
dir(cloneDir) {
// For branch builds, replace the old artifact. For develop keep all of them.
def version = gitBranch == 'develop' ? getVersion(gitBranch, gitShortSHA, '') : getVersion(gitBranch, gitShortSHA, env.BUILD_ID)
def server = Artifactory.server 'artifacts'
def uploadSpec = """{
"files": [
{
"pattern": "build/bin/statusgo-android-16.aar",
"target": "libs-release-local/status-im/status-go/${version}/status-go-${version}.aar"
},
{
"pattern": "build/bin/statusgo-ios-9.3-framework/status-go-ios.zip",
"target": "libs-release-local/status-im/status-go-ios-simulator/${version}/status-go-ios-simulator-${version}.zip"
}
]
}"""
def buildInfo = Artifactory.newBuildInfo()
buildInfo.env.capture = false
buildInfo.name = 'status-go (' + gitBranch + '-' + gitShortSHA + ')'
server.upload(uploadSpec, buildInfo)
server.publishBuildInfo(buildInfo)
def buildInfo = Artifactory.newBuildInfo()
buildInfo.env.capture = false
buildInfo.name = 'status-go (' + gitBranch + '-' + gitShortSHA + ')'
server.upload(uploadSpec, buildInfo)
server.publishBuildInfo(buildInfo)
}
}
}

View File

@ -118,7 +118,7 @@ test-e2e: ##@tests Run e2e tests
# e2e_test tag is required to include some files from ./lib without _test suffix
go test -timeout 40m -tags e2e_test ./lib -network=$(networkid)
ci: lint mock-install mock test-unit test-e2e ##@tests Run all linters and tests at once
ci: lint mock test-unit test-e2e ##@tests Run all linters and tests at once
clean: ##@other Cleanup
rm -fr build/bin/*

View File

@ -2,7 +2,7 @@ LINT_EXCLUDE := --exclude='.*_mock.go' --exclude='geth/jail/doc.go'
LINT_FOLDERS := extkeys cmd/... geth/... e2e/...
LINT_FOLDERS_WITHOUT_TESTS := extkeys cmd/... geth/...
lint-deps:
lint-install:
go get -u github.com/alecthomas/gometalinter
gometalinter --install