Zack Williams | 310f344 | 2018-09-18 21:45:26 -0700 | [diff] [blame] | 1 | --- |
| 2 | # verification jobs for 'voltha-go' repo |
| 3 | |
| 4 | - project: |
| 5 | name: voltha-go |
| 6 | project: '{name}' |
| 7 | |
| 8 | jobs: |
| 9 | - 'verify-voltha-go-jobs': |
| 10 | branch-regexp: '{supported-branches-regexp}' |
| 11 | |
| 12 | - job-group: |
| 13 | name: 'verify-voltha-go-jobs' |
| 14 | jobs: |
| 15 | - 'verify-licensed' |
Zack Williams | c277fe3 | 2019-03-14 09:13:19 -0700 | [diff] [blame] | 16 | # - 'verify-sonarqube': |
| 17 | # dependency-jobs: 'verify_voltha-go_licensed' |
Zack Williams | 310f344 | 2018-09-18 21:45:26 -0700 | [diff] [blame] | 18 | # - 'voltha-go-tests': |
| 19 | # dependency-jobs: 'verify_voltha-go_sonarqube' |
| 20 | |
| 21 | # disabled until codebase is ready to pass tests |
| 22 | - job-template: |
| 23 | id: 'voltha-go-tests' |
| 24 | name: 'verify_{project}_tests' |
| 25 | |
| 26 | description: | |
| 27 | Created by {id} job-template from ci-management/jjb/verify/voltha-go.yaml |
| 28 | |
| 29 | triggers: |
| 30 | - cord-infra-gerrit-trigger-patchset: |
| 31 | gerrit-server-name: '{gerrit-server-name}' |
| 32 | project-regexp: '^{project}$' |
| 33 | branch-regexp: '{branch-regexp}' |
| 34 | dependency-jobs: '{dependency-jobs}' |
| 35 | file-include-regexp: '{all-files-regexp}' |
| 36 | |
| 37 | properties: |
| 38 | - cord-infra-properties: |
| 39 | build-days-to-keep: '{build-days-to-keep}' |
| 40 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 41 | |
| 42 | wrappers: |
| 43 | - lf-infra-wrappers: |
| 44 | build-timeout: 20 |
| 45 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 46 | |
| 47 | scm: |
| 48 | - cord-infra-gerrit-scm: |
| 49 | git-url: '$GIT_URL/$GERRIT_PROJECT' |
| 50 | refspec: '$GERRIT_REFSPEC' |
| 51 | branch: '$GERRIT_BRANCH' |
| 52 | submodule-recursive: 'false' |
Zack Williams | cd3eb20 | 2018-10-02 14:33:13 -0700 | [diff] [blame] | 53 | choosing-strategy: 'gerrit' |
Zack Williams | 310f344 | 2018-09-18 21:45:26 -0700 | [diff] [blame] | 54 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 55 | basedir: '{project}' |
| 56 | |
| 57 | node: 'ubuntu16.04-basebuild-1c-2g' |
| 58 | project-type: freestyle |
| 59 | concurrent: true |
| 60 | |
| 61 | builders: |
| 62 | - shell: | |
| 63 | #!/usr/bin/env bash |
| 64 | set -eux -o pipefail |
| 65 | |
| 66 | export GOPATH=~/go |
| 67 | export PATH=$PATH:/usr/lib/go-1.10/bin:/usr/local/go/bin:~/go/bin |
| 68 | |
| 69 | # move code the proper location |
| 70 | mkdir -p $GOPATH/src/github.com/opencord |
| 71 | mkdir -p $GOPATH/src/protos |
| 72 | cp voltha-go/protos/*.proto $GOPATH/src/protos/ |
| 73 | cp voltha-go/protos/scripts/* $GOPATH/src/protos/ |
| 74 | mv voltha-go $GOPATH/src/github.com/opencord/voltha-go |
| 75 | |
| 76 | # get prereqs |
| 77 | go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway |
| 78 | go get -v github.com/golang/protobuf/protoc-gen-go |
| 79 | go get -v github.com/stretchr/testify |
| 80 | |
| 81 | # build protobufs |
| 82 | sh $GOPATH/src/protos/build_protos.sh $GOPATH/src/protos |
| 83 | |
| 84 | # get prereqs |
| 85 | pushd $GOPATH/src/github.com/opencord/voltha-go/rw_core |
| 86 | go get -v -d ./... |
| 87 | |
| 88 | rm -rf $GOPATH/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace |
| 89 | |
| 90 | # build |
| 91 | go build -v -o $GOPATH/src/rw_core |
| 92 | |
| 93 | # tests |
| 94 | go test -v ./... 2>&1 | go-junit-report > $WORKSPACE/junit-report.xml |
| 95 | |
| 96 | go test -coverprofile=coverage.txt -covermode=count ./... |
| 97 | gocover-cobertura < coverage.txt > $WORKSPACE/coverage.xml |
| 98 | |
| 99 | popd |
| 100 | |
| 101 | |
| 102 | publishers: |
| 103 | - junit: |
| 104 | results: "junit-report.xml" |
| 105 | - cobertura: |
| 106 | report-file: "coverage.xml" |
| 107 | targets: |
| 108 | - files: |
| 109 | healthy: 80 |
| 110 | unhealthy: 0 |
| 111 | failing: 0 |
| 112 | - method: |
| 113 | healthy: 50 |
| 114 | unhealthy: 0 |
| 115 | failing: 0 |