From ceb0793bc9f5d3b953db521c6a602134f53447e5 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 3 Jul 2020 09:54:25 +0200 Subject: [PATCH] ci: publish unittest results and coverage --- azure-pipelines.yml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e2e8a9cdc..e36928298 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -135,28 +135,44 @@ stages: script: | sudo pip install -U wheel pipenv pipenv install --dev - - task: CmdLine@2 + - task: DockerCompose@0 + displayName: Run ChromeDriver inputs: - script: | - cd e2e - docker-compose pull -q chrome - docker-compose up -d chrome + dockerComposeFile: 'e2e/docker-compose.yml' + action: 'Run a specific service' + serviceName: 'chrome' - task: CmdLine@2 + displayName: Build static files for e2e inputs: script: | cd passbook/static/static yarn - task: CmdLine@2 + displayName: Run full test suite inputs: script: pipenv run coverage run ./manage.py test --failfast - task: PublishBuildArtifacts@1 + condition: failed() + displayName: Upload screenshots if selenium tests fail inputs: PathtoPublish: 'selenium_screenshots/' ArtifactName: 'drop' publishLocation: 'Container' - task: CmdLine@2 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 env: CODECOV_TOKEN: $(CODECOV_TOKEN)