From 495fe566057393cc0af8ab4f90c2a0b514a619b5 Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Fri, 17 May 2019 00:54:10 -0400 Subject: [PATCH] Publish test results --- .gitignore | 1 + app/app/settings.py | 2 ++ azure-pipelines.yaml | 14 +++++++++++++- requirements.txt | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9077a274..1a9bd283 100644 --- a/.gitignore +++ b/.gitignore @@ -74,6 +74,7 @@ nosetests.xml coverage.xml *.cover .hypothesis/ +junitxml/ # Translations *.mo diff --git a/app/app/settings.py b/app/app/settings.py index 2bd86126..7963b5b6 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -185,6 +185,8 @@ USE_L10N = True USE_TZ = True +TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner' +TEST_OUTPUT_DIR = path.join(BASE_DIR, 'junitxml') # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.0/howto/static-files/ diff --git a/azure-pipelines.yaml b/azure-pipelines.yaml index 42b0ca7c..8cda230a 100644 --- a/azure-pipelines.yaml +++ b/azure-pipelines.yaml @@ -5,9 +5,21 @@ pool: vmImage: 'ubuntu-latest' steps: -- script: docker build --target=builder . +- script: docker build --tag=doccano --target=builder . displayName: 'Run tests' +- script: docker run doccano tar Ccf /doccano/app - junitxml | tar Cxf "$(Build.ArtifactStagingDirectory)" - + displayName: 'Export test results' + +- task: PublishTestResults@2 + inputs: + testResultsFormat: 'JUnit' + testResultsFiles: 'TEST-*.xml' + searchFolder: '$(Build.ArtifactStagingDirectory)/junitxml' + mergeTestResults: true + testRunTitle: 'server.tests' + displayName: 'Publish test results' + - script: DOCKER_PASSWORD="$(docker_password)" tools/cd.sh "azdo-$(Build.BuildId)" displayName: 'Push docker image' condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(variables['docker_password'], '')) diff --git a/requirements.txt b/requirements.txt index 2c16a05c..177033a4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,4 +27,5 @@ social-auth-app-django==3.1.0 social-auth-core[azuread]==3.0.0 text-unidecode==1.2 tornado==5.0.2 +unittest-xml-reporting==2.5.1 whitenoise[brotli]==4.1.2