Zack Williams | 29df438 | 2018-10-24 08:21:02 -0700 | [diff] [blame] | 1 | --- |
| 2 | # verification jobs for 'kafka-topic-exporter' repo |
| 3 | |
| 4 | - project: |
| 5 | name: kafka-topic-exporter |
| 6 | project: '{name}' |
| 7 | |
| 8 | jobs: |
| 9 | - 'verify-kafka-topic-exporter-jobs': |
| 10 | branch-regexp: '{supported-branches-regexp}' |
| 11 | |
| 12 | - job-group: |
| 13 | name: 'verify-kafka-topic-exporter-jobs' |
| 14 | jobs: |
| 15 | - 'verify-licensed' |
| 16 | - 'tag-collision-reject': |
| 17 | dependency-jobs: 'verify_kafka-topic-exporter_licensed' |
| 18 | - 'verify-sonarqube': |
| 19 | dependency-jobs: 'verify_kafka-topic-exporter_tag-collision' |
| 20 | - 'kafka-topic-exporter-tests': |
| 21 | dependency-jobs: 'verify_kafka-topic-exporter_sonarqube' |
| 22 | |
| 23 | - job-template: |
| 24 | id: 'kafka-topic-exporter-tests' |
| 25 | name: 'verify_{project}_tests' |
| 26 | |
| 27 | description: | |
| 28 | Created by {id} job-template from ci-management/jjb/verify/kafka-topic-exporter.yaml |
| 29 | |
| 30 | triggers: |
| 31 | - cord-infra-gerrit-trigger-patchset: |
| 32 | gerrit-server-name: '{gerrit-server-name}' |
| 33 | project-regexp: '^{project}$' |
| 34 | branch-regexp: '{branch-regexp}' |
| 35 | dependency-jobs: '{dependency-jobs}' |
| 36 | file-include-regexp: '{all-files-regexp}' |
| 37 | |
| 38 | properties: |
| 39 | - cord-infra-properties: |
| 40 | build-days-to-keep: '{build-days-to-keep}' |
| 41 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 42 | |
| 43 | wrappers: |
| 44 | - lf-infra-wrappers: |
| 45 | build-timeout: 20 |
| 46 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 47 | |
| 48 | scm: |
| 49 | - cord-infra-gerrit-scm: |
| 50 | git-url: '$GIT_URL/$GERRIT_PROJECT' |
| 51 | refspec: '$GERRIT_REFSPEC' |
| 52 | branch: '$GERRIT_BRANCH' |
| 53 | submodule-recursive: 'false' |
| 54 | choosing-strategy: 'gerrit' |
| 55 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 56 | basedir: '{project}' |
| 57 | |
| 58 | node: 'ubuntu16.04-basebuild-1c-2g' |
| 59 | project-type: freestyle |
| 60 | concurrent: true |
| 61 | |
| 62 | builders: |
| 63 | - shell: | |
| 64 | #!/usr/bin/env bash |
| 65 | set -eux -o pipefail |
| 66 | |
| 67 | export GOPATH=~/go |
Zack Williams | c9abcdc | 2019-05-09 21:23:38 -0700 | [diff] [blame] | 68 | export PATH=$PATH:/usr/lib/go-1.12/bin:/usr/local/go/bin:~/go/bin |
Zack Williams | 29df438 | 2018-10-24 08:21:02 -0700 | [diff] [blame] | 69 | |
| 70 | # move code the proper location |
| 71 | mkdir -p $GOPATH/src/gerrit.opencord.org |
| 72 | mv kafka-topic-exporter $GOPATH/src/gerrit.opencord.org/kafka-topic-exporter |
| 73 | |
Zack Williams | 29df438 | 2018-10-24 08:21:02 -0700 | [diff] [blame] | 74 | pushd $GOPATH/src/gerrit.opencord.org/kafka-topic-exporter |
| 75 | |
Matteo Scandolo | 235ac33 | 2019-06-12 17:01:39 -0700 | [diff] [blame] | 76 | # get prereqs |
| 77 | dep ensure --vendor-only |
| 78 | |
Zack Williams | 29df438 | 2018-10-24 08:21:02 -0700 | [diff] [blame] | 79 | go test -v ./... |
| 80 | |
| 81 | # generate Jenkins report |
| 82 | go test -v ./... 2>&1 | go-junit-report > $WORKSPACE/junit-report.xml |
| 83 | |
| 84 | # generate Jenkins coverage |
| 85 | go test -coverprofile=coverage.txt -covermode=count ./... |
| 86 | gocover-cobertura < coverage.txt > $WORKSPACE/coverage.xml |
| 87 | |
| 88 | popd |
| 89 | |
| 90 | |
| 91 | publishers: |
| 92 | - junit: |
| 93 | results: "junit-report.xml" |
| 94 | allow-empty-results: true |
| 95 | - cobertura: |
| 96 | report-file: "coverage.xml" |
| 97 | targets: |
| 98 | - files: |
| 99 | healthy: 80 |
| 100 | unhealthy: 0 |
| 101 | failing: 0 |
| 102 | - method: |
| 103 | healthy: 50 |
| 104 | unhealthy: 0 |
| 105 | failing: 0 |