Zack Williams | cc58c67 | 2018-10-18 19:51:06 -0700 | [diff] [blame] | 1 | --- |
| 2 | # python module unit test |
| 3 | |
| 4 | - job-template: |
| 5 | id: 'python-unit-test' |
| 6 | name: 'verify_{project}_unit-test' |
| 7 | |
| 8 | description: | |
| 9 | Created by {id} job-template from ci-management/jjb/xos-unit.yaml |
| 10 | |
| 11 | triggers: |
| 12 | - cord-infra-gerrit-trigger-patchset: |
| 13 | gerrit-server-name: '{gerrit-server-name}' |
| 14 | project-regexp: '^{project}$' |
| 15 | branch-regexp: '{branch-regexp}' |
| 16 | dependency-jobs: '{dependency-jobs}' |
| 17 | file-include-regexp: '{all-files-regexp}' |
| 18 | |
| 19 | properties: |
| 20 | - cord-infra-properties: |
| 21 | build-days-to-keep: '{build-days-to-keep}' |
| 22 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 23 | |
| 24 | wrappers: |
| 25 | - lf-infra-wrappers: |
| 26 | build-timeout: 20 |
| 27 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 28 | |
| 29 | scm: |
| 30 | - lf-infra-gerrit-scm: |
| 31 | git-url: '$GIT_URL/$GERRIT_PROJECT' |
| 32 | refspec: '$GERRIT_REFSPEC' |
| 33 | branch: '$GERRIT_BRANCH' |
| 34 | submodule-recursive: 'false' |
| 35 | choosing-strategy: gerrit |
| 36 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 37 | |
| 38 | node: '{build-node}' |
| 39 | project-type: freestyle |
| 40 | concurrent: true |
| 41 | |
| 42 | builders: |
| 43 | - shell: | |
| 44 | #!/usr/bin/env bash |
| 45 | set -eux -o pipefail |
Zack Williams | 06590b6 | 2018-10-18 22:16:27 -0700 | [diff] [blame] | 46 | |
Zack Williams | 9d93597 | 2019-03-01 14:27:46 -0700 | [diff] [blame^] | 47 | if [ -f 'Makefile' ]; then |
| 48 | echo "Makefile found, running 'make test'" |
| 49 | make test |
| 50 | |
| 51 | elif [ -f 'tox.ini' ]; then |
Zack Williams | a31016a | 2018-10-22 13:00:04 -0700 | [diff] [blame] | 52 | echo "tox.ini found, running tox for Python2/3 unit tests" |
| 53 | tox |
Zack Williams | 9d93597 | 2019-03-01 14:27:46 -0700 | [diff] [blame^] | 54 | |
Zack Williams | a31016a | 2018-10-22 13:00:04 -0700 | [diff] [blame] | 55 | else |
Zack Williams | 9d93597 | 2019-03-01 14:27:46 -0700 | [diff] [blame^] | 56 | echo "Makefile or tox.ini not found, running nose2 unit tests" |
Zack Williams | 06590b6 | 2018-10-18 22:16:27 -0700 | [diff] [blame] | 57 | |
Zack Williams | a31016a | 2018-10-22 13:00:04 -0700 | [diff] [blame] | 58 | if [ -f 'requirements.txt' ]; then |
| 59 | echo "requirements.txt found, installing locally with pip" |
| 60 | pip install -r requirements.txt |
| 61 | fi |
| 62 | |
| 63 | echo "Performing nose2 tests" |
| 64 | nose2 --verbose --coverage-report xml --coverage-report term --junit-xml |
| 65 | fi |
Zack Williams | cc58c67 | 2018-10-18 19:51:06 -0700 | [diff] [blame] | 66 | |
| 67 | publishers: |
| 68 | - junit: |
Zack Williams | c880108 | 2019-02-13 13:49:17 -0700 | [diff] [blame] | 69 | results: "**/*junit.xml,**/*results.xml,**/*report.xml" |
Zack Williams | cc58c67 | 2018-10-18 19:51:06 -0700 | [diff] [blame] | 70 | - cobertura: |
Zack Williams | c880108 | 2019-02-13 13:49:17 -0700 | [diff] [blame] | 71 | report-file: "**/*coverage.xml" |
Zack Williams | cc58c67 | 2018-10-18 19:51:06 -0700 | [diff] [blame] | 72 | targets: |
| 73 | - files: |
| 74 | healthy: 80 |
| 75 | unhealthy: 0 |
| 76 | failing: 0 |
| 77 | - method: |
| 78 | healthy: 50 |
| 79 | unhealthy: 0 |
| 80 | failing: 0 |