blob: 2e7bbfbbbf407eaa2f3313fb54cbae2d37644bd7 [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 Williams9d935972019-03-01 14:27:46 -070047 if [ -f 'Makefile' ]; then
48 echo "Makefile found, running 'make test'"
49 make test
50
51 elif [ -f 'tox.ini' ]; then
Zack Williamsa31016a2018-10-22 13:00:04 -070052 echo "tox.ini found, running tox for Python2/3 unit tests"
53 tox
Zack Williams9d935972019-03-01 14:27:46 -070054
Zack Williamsa31016a2018-10-22 13:00:04 -070055 else
Zack Williams9d935972019-03-01 14:27:46 -070056 echo "Makefile or tox.ini not found, running nose2 unit tests"
Zack Williams06590b62018-10-18 22:16:27 -070057
Zack Williamsa31016a2018-10-22 13:00:04 -070058 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 Williamscc58c672018-10-18 19:51:06 -070066
67 publishers:
68 - junit:
Zack Williamsc8801082019-02-13 13:49:17 -070069 results: "**/*junit.xml,**/*results.xml,**/*report.xml"
Zack Williamscc58c672018-10-18 19:51:06 -070070 - cobertura:
Zack Williamsc8801082019-02-13 13:49:17 -070071 report-file: "**/*coverage.xml"
Zack Williamscc58c672018-10-18 19:51:06 -070072 targets:
73 - files:
74 healthy: 80
75 unhealthy: 0
76 failing: 0
77 - method:
78 healthy: 50
79 unhealthy: 0
80 failing: 0