diff options
author | 2019-06-22 14:12:44 -0700 | |
---|---|---|
committer | 2019-06-22 14:12:44 -0700 | |
commit | 6cab499ec57b10081b79bff25aa9c0792b7d8fe7 (patch) | |
tree | 97cb282f8efc1ce0f28996d1313063ecb5119338 | |
parent | Fix venv being included in coverage when testing in a container (diff) |
Add CI steps for running & publishing tests
-rw-r--r-- | Pipfile | 1 | ||||
-rw-r--r-- | Pipfile.lock | 28 | ||||
-rw-r--r-- | azure-pipelines.yml | 37 |
3 files changed, 49 insertions, 17 deletions
@@ -20,6 +20,7 @@ flake8-todo = "*" flake8-string-format = "*" flake8-formatter-junit-xml = "*" flake8-quotes = "*" +unittest-xml-reporting = "*" [requires] python_version = "3.7" diff --git a/Pipfile.lock b/Pipfile.lock index 440875f..4f6bef8 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "7c2cd8205368e32e4c485bd39099da91a61de586639ccafc5cc393ab6bc38ac0" + "sha256": "421cdae80970f990af48506e38464e4e2b99e20291070943027b86bd7ca29c5b" }, "pipfile-spec": 6, "requires": { @@ -218,17 +218,17 @@ }, "identify": { "hashes": [ - "sha256:432c548d6138cb57a3d8f62f079a025a29b8ae34a50dd3b496bbf661818f2bc0", - "sha256:d4401d60bf1938aa3074a352a5cc9044107edf11a6fedd3a1db172c141619b81" + "sha256:0a11379b46d06529795442742a043dc2fa14cd8c995ae81d1febbc5f1c014c87", + "sha256:43a5d24ffdb07bc7e21faf68b08e9f526a1f41f0056073f480291539ef961dfd" ], - "version": "==1.4.3" + "version": "==1.4.5" }, "importlib-metadata": { "hashes": [ - "sha256:a9f185022cfa69e9ca5f7eabfd5a58b689894cb78a11e3c8c89398a8ccbb8e7f", - "sha256:df1403cd3aebeb2b1dcd3515ca062eecb5bd3ea7611f18cba81130c68707e879" + "sha256:6dfd58dfe281e8d240937776065dd3624ad5469c835248219bd16cf2e12dbeb7", + "sha256:cb6ee23b46173539939964df59d3d72c3e0c1b5d54b84f1d8a7e912fe43612db" ], - "version": "==0.17" + "version": "==0.18" }, "junit-xml": { "hashes": [ @@ -316,12 +316,20 @@ ], "version": "==0.10.0" }, + "unittest-xml-reporting": { + "hashes": [ + "sha256:140982e4b58e4052d9ecb775525b246a96bfc1fc26097806e05ea06e9166dd6c", + "sha256:d1fbc7a1b6c6680ccfe75b5e9701e5431c646970de049e687b4bb35ba4325d72" + ], + "index": "pypi", + "version": "==2.5.1" + }, "virtualenv": { "hashes": [ - "sha256:99acaf1e35c7ccf9763db9ba2accbca2f4254d61d1912c5ee364f9cc4a8942a0", - "sha256:fe51cdbf04e5d8152af06c075404745a7419de27495a83f0d72518ad50be3ce8" + "sha256:b7335cddd9260a3dd214b73a2521ffc09647bde3e9457fcca31dc3be3999d04a", + "sha256:d28ca64c0f3f125f59cabf13e0a150e1c68e5eea60983cc4395d88c584495783" ], - "version": "==16.6.0" + "version": "==16.6.1" }, "zipp": { "hashes": [ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bd916a4..de6827a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,32 +2,55 @@ jobs: - job: test - displayName: 'Lint' + displayName: 'Lint & Test' pool: vmImage: 'Ubuntu-16.04' steps: - task: UsePythonVersion@0 - displayName: 'Set Python version' + displayName: 'Set Python Version' inputs: versionSpec: '3.7.x' addToPath: true - script: pip3 install pipenv - displayName: 'Install pipenv' + displayName: 'Install Pipenv' - script: pipenv install --dev --deploy --system - displayName: 'Install project using pipenv' + displayName: 'Install Dependencies with Pipenv' - script: python3 -m flake8 --format junit-xml --output-file test-lint.xml - displayName: 'Run linter' + displayName: 'Run Linter' - task: PublishTestResults@2 condition: succeededOrFailed() + displayName: 'Publish Lint Results' inputs: - testResultsFiles: '**/test-*.xml' - testRunTitle: 'Snekbox Flake8 Lint Results' + testResultsFiles: 'test-lint.xml' + testRunTitle: 'Lint Results' + + - script: coverage run -m xmlrunner + displayName: 'Run Unit Tests' + + - task: PublishTestResults@2 + condition: succeededOrFailed() + displayName: 'Publish Test Results' + inputs: + testResultsFiles: '**/TEST-*.xml' + testRunTitle: 'Lint Results' + + - script: | + coverage xml + coverage report + displayName: 'Generate Coverage Report' + + - task: PublishCodeCoverageResults@1 + displayName: 'Publish Coverage Results' + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: '**/coverage.xml' + reportDirectory: '**/htmlcov' - job: build displayName: 'Build' |