| --- |
| # python module unit test |
| |
| - job-template: |
| id: 'python-unit-test' |
| name: 'verify_{project}_unit-test' |
| |
| description: | |
| Created by {id} job-template from ci-management/jjb/python-unit.yaml<br/> |
| Unit tests for Python (or Go w/Makefile) projects |
| |
| triggers: |
| - cord-infra-gerrit-trigger-patchset: |
| gerrit-server-name: '{gerrit-server-name}' |
| project-regexp: '^{project}$' |
| branch-regexp: '{branch-regexp}' |
| dependency-jobs: '{dependency-jobs}' |
| file-include-regexp: '{all-files-regexp}' |
| |
| properties: |
| - cord-infra-properties: |
| build-days-to-keep: '{build-days-to-keep}' |
| artifact-num-to-keep: '{artifact-num-to-keep}' |
| |
| wrappers: |
| - lf-infra-wrappers: |
| build-timeout: '{build-timeout}' |
| jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| |
| scm: |
| - lf-infra-gerrit-scm: |
| git-url: '$GIT_URL/$GERRIT_PROJECT' |
| refspec: '$GERRIT_REFSPEC' |
| branch: '$GERRIT_BRANCH' |
| submodule-recursive: 'false' |
| choosing-strategy: gerrit |
| jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| |
| node: '{build-node}' |
| project-type: freestyle |
| concurrent: true |
| |
| builders: |
| - shell: | |
| #!/usr/bin/env bash |
| set -eux -o pipefail |
| |
| # setup for go-based testing |
| mkdir -p ~/go/src |
| export GOPATH=~/go |
| export PATH=$PATH:/usr/lib/go-1.12/bin:/usr/local/go/bin:~/go/bin |
| |
| if [ -f 'Makefile' ]; then |
| echo "Makefile found, running 'make test'" |
| make test |
| |
| elif [ -f 'tox.ini' ]; then |
| echo "tox.ini found, running tox for Python2/3 unit tests" |
| tox |
| |
| else |
| echo "Makefile or tox.ini not found, running nose2 unit tests" |
| |
| if [ -f 'requirements.txt' ]; then |
| echo "requirements.txt found, installing locally with pip" |
| pip install -r requirements.txt |
| fi |
| |
| echo "Performing nose2 tests" |
| nose2 --verbose --coverage-report xml --coverage-report term --junit-xml |
| fi |
| |
| publishers: |
| - junit: |
| results: "**/*junit.xml,**/*results.xml,**/*report.xml" |
| allow-empty-results: '{junit-allow-empty-results}' |
| - cobertura: |
| report-file: "**/*coverage.xml" |
| targets: |
| - files: |
| healthy: 80 |
| unhealthy: 0 |
| failing: 0 |
| - method: |
| healthy: 50 |
| unhealthy: 0 |
| failing: 0 |