ci: publish unittest results and coverage

This commit is contained in:
Jens Langhammer 2020-07-03 09:54:25 +02:00
parent abea85b635
commit ceb0793bc9
1 changed files with 22 additions and 6 deletions

View File

@ -135,28 +135,44 @@ stages:
script: | script: |
sudo pip install -U wheel pipenv sudo pip install -U wheel pipenv
pipenv install --dev pipenv install --dev
- task: CmdLine@2 - task: DockerCompose@0
displayName: Run ChromeDriver
inputs: inputs:
script: | dockerComposeFile: 'e2e/docker-compose.yml'
cd e2e action: 'Run a specific service'
docker-compose pull -q chrome serviceName: 'chrome'
docker-compose up -d chrome
- task: CmdLine@2 - task: CmdLine@2
displayName: Build static files for e2e
inputs: inputs:
script: | script: |
cd passbook/static/static cd passbook/static/static
yarn yarn
- task: CmdLine@2 - task: CmdLine@2
displayName: Run full test suite
inputs: inputs:
script: pipenv run coverage run ./manage.py test --failfast script: pipenv run coverage run ./manage.py test --failfast
- task: PublishBuildArtifacts@1 - task: PublishBuildArtifacts@1
condition: failed()
displayName: Upload screenshots if selenium tests fail
inputs: inputs:
PathtoPublish: 'selenium_screenshots/' PathtoPublish: 'selenium_screenshots/'
ArtifactName: 'drop' ArtifactName: 'drop'
publishLocation: 'Container' publishLocation: 'Container'
- task: CmdLine@2 - task: CmdLine@2
inputs: inputs:
script: pipenv run coverage xml script: |
pipenv run coverage xml
pipenv run coverage html
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: 'coverage.xml'
reportDirectory: 'htmlcov'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: 'unittest.xml'
testRunTitle: 'Publish test results for Python $(python.version)'
- task: CmdLine@2 - task: CmdLine@2
env: env:
CODECOV_TOKEN: $(CODECOV_TOKEN) CODECOV_TOKEN: $(CODECOV_TOKEN)