Eric Ball | 3f0cec3 | 2024-10-10 17:16:03 -0700 | [diff] [blame] | 1 | --- |
| 2 | # Makefile based unit test |
| 3 | |
| 4 | - job-template: |
| 5 | id: 'onf-make-unit-test' |
| 6 | name: 'onf-make-unit-test-{test-repo}' |
| 7 | test-repo: '{test-repo}' |
| 8 | |
| 9 | description: | |
| 10 | Created by {id} job-template from ci-management/jjb/onf-make-unit-test.yaml<br/> |
| 11 | Runs make with the following unit tests targets - '{unit-test-targets}' |
| 12 | |
| 13 | triggers: |
| 14 | - cord-infra-gerrit-trigger-patchset: |
| 15 | gerrit-server-name: '{gerrit-server-name}' |
| 16 | project-regexp: '^{project}$' |
| 17 | branch-regexp: '{branch-regexp}' |
| 18 | dependency-jobs: '{dependency-jobs}' |
| 19 | file-include-regexp: '{all-files-regexp}' |
| 20 | |
| 21 | properties: |
| 22 | - cord-infra-properties: |
| 23 | build-days-to-keep: '{build-days-to-keep}' |
| 24 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 25 | |
| 26 | wrappers: |
| 27 | - lf-infra-wrappers: |
| 28 | build-timeout: '{build-timeout}' |
| 29 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 30 | |
| 31 | scm: |
| 32 | - cord-infra-gerrit-scm: |
| 33 | git-url: '$GIT_URL/$GERRIT_PROJECT' |
| 34 | refspec: '$GERRIT_REFSPEC' |
| 35 | branch: '$GERRIT_BRANCH' |
| 36 | submodule-recursive: 'false' |
| 37 | choosing-strategy: gerrit |
| 38 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 39 | basedir: '{project}' |
| 40 | |
| 41 | node: '{build-node}' |
| 42 | project-type: freestyle |
| 43 | concurrent: true |
| 44 | |
| 45 | builders: |
| 46 | - inject: |
| 47 | properties-content: | |
| 48 | DEST_GOPATH={dest-gopath} |
| 49 | UNIT_TEST_TARGETS={unit-test-targets} |
| 50 | UNIT_TEST_KEEP_GOING={unit-test-keep-going} |
| 51 | GOPROXY=https://proxy.golang.org |
| 52 | TEST_PROJECT={test-repo} |
| 53 | - shell: !include-raw-verbatim: shell/get-onf-make-patch.sh |
| 54 | - shell: !include-raw-verbatim: shell/make-unit.sh |
| 55 | |
| 56 | publishers: |
| 57 | - junit: |
| 58 | results: "**/*results.xml,**/*report.xml" |
| 59 | allow-empty-results: '{junit-allow-empty-results}' |
| 60 | # NOTE: circa 2020-04-11, the Jenkins xUnit plugin version 3.x.x changed the |
| 61 | # config XML to not be JJB compatible, replacing the previous XML <types> tag |
| 62 | # with a <tools> tag. |
| 63 | # |
| 64 | # Temporarily switch to using raw XML to configure xUnit. |
| 65 | # |
| 66 | # The following xunit and XML should be equivalent, except that the variable |
| 67 | # `xunit-skip-if-no-test-files` is assumed to always be true. |
| 68 | # |
| 69 | # - xunit: |
| 70 | # types: |
| 71 | # - gtest: |
| 72 | # pattern: "**/*xunit.xml" |
| 73 | # deleteoutput: false |
| 74 | # skip-if-no-test-files: '{xunit-skip-if-no-test-files}' |
| 75 | # |
| 76 | - raw: |
| 77 | xml: | |
| 78 | <xunit plugin="xunit"> |
| 79 | <tools> |
| 80 | <GoogleTestType> |
| 81 | <pattern>**/*xunit.xml</pattern> |
| 82 | <failIfNotNew>true</failIfNotNew> |
| 83 | <deleteOutputFiles>false</deleteOutputFiles> |
| 84 | <skipNoTestFiles>True</skipNoTestFiles> |
| 85 | <stopProcessingIfError>true</stopProcessingIfError> |
| 86 | </GoogleTestType> |
| 87 | </tools> |
| 88 | <thresholds/> |
| 89 | <thresholdMode>1</thresholdMode> |
| 90 | <extraConfiguration> |
| 91 | <testTimeMargin>3000</testTimeMargin> |
| 92 | </extraConfiguration> |
| 93 | </xunit> |
| 94 | - cobertura: |
| 95 | report-file: "**/*coverage.xml" |
| 96 | targets: |
| 97 | - files: |
| 98 | healthy: 80 |
| 99 | unhealthy: 0 |
| 100 | failing: 0 |
| 101 | - method: |
| 102 | healthy: 50 |
| 103 | unhealthy: 0 |
| 104 | failing: 0 |
| 105 | |
| 106 | # [EOF] |