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 dist: trusty
install: install:
- go get golang.org/x/tools/cmd/cover - go get golang.org/x/tools/cmd/cover
- make lint-deps - make mock-install
- make lint-install
jobs: jobs:
include: include:
- stage: Lint - stage: Lint
script: make lint script: make lint
- stage: Test unit and integration - stage: Test unit and integration
script: make test-unit-coverage script: make test-unit-coverage
- stage: Test e2e on privite network - stage: Test e2e on private network
script: make test-e2e script: make test-e2e
- stage: Test e2e on public network - stage: Test e2e on public network
# disable running this stage for PRs as they do not have access # 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') { node('linux') {
env.GOPATH = "${env.WORKSPACE}"
cloneDir = 'src/github.com/status-im/status-go'
paramBranch = env.branch ? ('*/' + env.branch) : '*/develop' paramBranch = env.branch ? ('*/' + env.branch) : '*/develop'
checkout( checkout(
changelog: false, changelog: false,
poll: false, poll: true,
scm: [$class: 'GitSCM', branches: [[name: paramBranch]], scm: [$class: 'GitSCM', branches: [[name: paramBranch]],
doGenerateSubmoduleConfigurations: false, doGenerateSubmoduleConfigurations: false,
extensions: [], extensions: [
[$class: 'RelativeTargetDirectory', relativeTargetDir: cloneDir]
],
submoduleCfg: [], submoduleCfg: [],
userRemoteConfigs: [[url: 'https://github.com/status-im/status-go']]] userRemoteConfigs: [[url: 'https://github.com/status-im/status-go']]]
) )
def remoteOriginRegex = ~/^remotes\/origin\// def remoteOriginRegex = ~/^remotes\/origin\//
gitSHA = sh(returnStdout: true, script: 'git rev-parse HEAD').trim() dir(cloneDir) {
gitShortSHA = gitSHA.take(7) gitSHA = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
gitBranch = sh(returnStdout: true, script: 'git name-rev --name-only HEAD').trim() - remoteOriginRegex gitShortSHA = gitSHA.take(8)
gitBranch = sh(returnStdout: true, script: 'git name-rev --name-only HEAD').trim() - remoteOriginRegex
}
stage('Debug') { stage('Debug') {
sh 'env' sh 'env'
@ -40,49 +47,59 @@ node('linux') {
println(gitSHA) println(gitSHA)
} }
// TODO(adam): enable when unit tests start passing stage('Test') {
// stage('Test') { sh '''
// sh 'make ci' make lint-install
// } make mock-install
make ci
'''
}
stage('Build') { stage('Build') {
sh 'go get github.com/karalabe/xgo' sh 'go get github.com/karalabe/xgo'
parallel ( parallel (
'statusgo-android': { 'statusgo-android': {
sh 'make statusgo-android' dir(cloneDir) {
sh 'make statusgo-android'
}
}, },
'statusgo-ios-simulator': { 'statusgo-ios-simulator': {
sh ''' dir(cloneDir) {
make statusgo-ios-simulator sh '''
cd build/bin/statusgo-ios-9.3-framework/ make statusgo-ios-simulator
zip -r status-go-ios.zip Statusgo.framework cd build/bin/statusgo-ios-9.3-framework/
''' zip -r status-go-ios.zip Statusgo.framework
'''
}
} }
) )
} }
stage('Deploy') { stage('Deploy') {
// For branch builds, replace the old artifact. For develop keep all of them. dir(cloneDir) {
def version = gitBranch == 'develop' ? getVersion(gitBranch, gitShortSHA, '') : getVersion(gitBranch, gitShortSHA, env.BUILD_ID) // For branch builds, replace the old artifact. For develop keep all of them.
def server = Artifactory.server 'artifactory' def version = gitBranch == 'develop' ? getVersion(gitBranch, gitShortSHA, '') : getVersion(gitBranch, gitShortSHA, env.BUILD_ID)
def uploadSpec = """{ def server = Artifactory.server 'artifacts'
"files": [ 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-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" "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() def buildInfo = Artifactory.newBuildInfo()
buildInfo.env.capture = false buildInfo.env.capture = false
buildInfo.name = 'status-go (' + gitBranch + '-' + gitShortSHA + ')' buildInfo.name = 'status-go (' + gitBranch + '-' + gitShortSHA + ')'
server.upload(uploadSpec, buildInfo) server.upload(uploadSpec, buildInfo)
server.publishBuildInfo(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 # e2e_test tag is required to include some files from ./lib without _test suffix
go test -timeout 40m -tags e2e_test ./lib -network=$(networkid) 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 clean: ##@other Cleanup
rm -fr build/bin/* 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 := extkeys cmd/... geth/... e2e/...
LINT_FOLDERS_WITHOUT_TESTS := extkeys cmd/... geth/... LINT_FOLDERS_WITHOUT_TESTS := extkeys cmd/... geth/...
lint-deps: lint-install:
go get -u github.com/alecthomas/gometalinter go get -u github.com/alecthomas/gometalinter
gometalinter --install gometalinter --install