You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.1 KiB

  1. trigger:
  2. - master
  3. pool:
  4. vmImage: 'ubuntu-latest'
  5. steps:
  6. - script: docker build --tag=doccano --target=builder .
  7. displayName: 'Run tests'
  8. - script: docker run doccano tar Ccf /doccano/app - junitxml | tar Cxf "$(Build.ArtifactStagingDirectory)" -
  9. displayName: 'Export test results'
  10. - task: PublishTestResults@2
  11. inputs:
  12. testResultsFormat: 'JUnit'
  13. testResultsFiles: 'TEST-*.xml'
  14. searchFolder: '$(Build.ArtifactStagingDirectory)/junitxml'
  15. mergeTestResults: true
  16. testRunTitle: 'server.tests'
  17. displayName: 'Publish test results'
  18. # To publish docker images to a container registry, set the following pipeline variables:
  19. # - docker_password
  20. # - docker_username
  21. # - docker_registry (optional, set this to publish to a registry other than Docker Hub)
  22. #
  23. - script: DOCKER_PASSWORD="$(docker_password)" tools/cd.sh "azdo-$(Build.BuildId)"
  24. displayName: 'Push docker image'
  25. condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(variables['docker_password'], ''))
  26. # To automatically deploy to Azure, create a service principal and set the following pipeline variables:
  27. # - auth_username (app ID)
  28. # - auth_tenant (tenant ID
  29. # - auth_password (secret)
  30. #
  31. # Additionally, to configure the deployment, set the following pipeline variables:
  32. # - doccano_admin_username
  33. # - doccano_admin_password
  34. # - doccano_admin_contact_email
  35. # - doccano_app_name (globally unique name for the app)
  36. # - doccano_secret_key (pass-through secret for Django)
  37. # - doccano_resource_group (group for all resources, will be created if it doesn't yet exist)
  38. # - doccano_location (name of the Azure region to which to deploy all resources)
  39. #
  40. - script: |
  41. az login --service-principal --password "$(auth_password)" --tenant "$(auth_tenant)" --username "$(auth_username)"
  42. DOCCANO_ADMIN_PASSWORD="$(doccano_admin_password)" \
  43. DOCCANO_SECRET_KEY="$(doccano_secret_key)" \
  44. DOCKER_PASSWORD="$(docker_password)" \
  45. tools/azure.sh "azdo-$(Build.BuildId)"
  46. displayName: 'Deploy to Azure'
  47. condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(variables['auth_password'], ''))