blob: 18bdb96eb1943cb0c0dc6fa79be6ff9918640e73 [file] [log] [blame]
Zack Williamscc58c672018-10-18 19:51:06 -07001---
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 Williams06590b62018-10-18 22:16:27 -070046
Zack Williamsa31016a2018-10-22 13:00:04 -070047 if [ -f 'tox.ini' ]; then
48 echo "tox.ini found, running tox for Python2/3 unit tests"
49 tox
50 else
51 echo "tox.ini not found, running nose2 unit tests"
Zack Williams06590b62018-10-18 22:16:27 -070052
Zack Williamsa31016a2018-10-22 13:00:04 -070053 if [ -f 'requirements.txt' ]; then
54 echo "requirements.txt found, installing locally with pip"
55 pip install -r requirements.txt
56 fi
57
58 echo "Performing nose2 tests"
59 nose2 --verbose --coverage-report xml --coverage-report term --junit-xml
60 fi
Zack Williamscc58c672018-10-18 19:51:06 -070061
62 publishers:
63 - junit:
Zack Williamsc8801082019-02-13 13:49:17 -070064 results: "**/*junit.xml,**/*results.xml,**/*report.xml"
Zack Williamscc58c672018-10-18 19:51:06 -070065 - cobertura:
Zack Williamsc8801082019-02-13 13:49:17 -070066 report-file: "**/*coverage.xml"
Zack Williamscc58c672018-10-18 19:51:06 -070067 targets:
68 - files:
69 healthy: 80
70 unhealthy: 0
71 failing: 0
72 - method:
73 healthy: 50
74 unhealthy: 0
75 failing: 0