azure-pipelines.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # Python Django
  2. # Test a Django project on multiple versions of Python.
  3. # Add steps that analyze code, save build artifacts, deploy, and more:
  4. # https://docs.microsoft.com/azure/devops/pipelines/languages/python
  5. # NOTES:
  6. #
  7. # Display name of each step should be prefixed with one of the following:
  8. # CR-QC: for quality control measures.
  9. # CR-BUILD: for build-related tasks.
  10. # CR-DEPLOY: for publication or deployment.
  11. # [no prefix]: for unrelated CI setup/tooling.
  12. #
  13. # Use PowerShell Core for any scripts so they are re-usable across windows/mac/linux.
  14. #
  15. trigger:
  16. - master
  17. jobs:
  18. - job: tests
  19. displayName: Unit Tests
  20. pool:
  21. vmImage: 'ubuntu-latest'
  22. strategy:
  23. matrix:
  24. py3.5:
  25. PYTHON_VERSION: '3.5'
  26. py3.6:
  27. PYTHON_VERSION: '3.6'
  28. py3.7:
  29. PYTHON_VERSION: '3.7'
  30. steps:
  31. - task: UsePythonVersion@0
  32. displayName: 'Use Python version'
  33. inputs:
  34. versionSpec: '$(PYTHON_VERSION)'
  35. architecture: 'x64'
  36. - script: |
  37. python -m pip install -e ./[ci_tests]
  38. displayName: 'CR-QC: Install coderedcms from local repo'
  39. - script: |
  40. coderedcms start testproject --name="Test Project" --domain="www.example.com"
  41. displayName: 'CR-QC: Create starter project from template'
  42. - script: |
  43. pytest coderedcms/ --ds=coderedcms.tests.settings --junitxml=junit/test-results.xml --cov=coderedcms --cov-report=xml --cov-report=html
  44. displayName: 'CR-QC: Run unit tests'
  45. - task: PublishTestResults@2
  46. displayName: 'Publish unit test report'
  47. condition: succeededOrFailed()
  48. inputs:
  49. testResultsFiles: '**/test-*.xml'
  50. testRunTitle: 'Publish test results for Python $(python.version)'
  51. - task: PublishCodeCoverageResults@1
  52. displayName: 'Publish code coverage report'
  53. condition: succeededOrFailed()
  54. inputs:
  55. codeCoverageTool: Cobertura
  56. summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
  57. - task: DownloadPipelineArtifact@2
  58. displayName: 'Download code coverage from latest build'
  59. inputs:
  60. source: 'specific'
  61. path: '$(Agent.WorkFolder)/artifacts'
  62. project: 'cc52b8d8-3ae5-466e-b771-56f3b4749f1f'
  63. pipeline: 1
  64. runVersion: 'latestFromBranch'
  65. runBranch: 'refs/heads/master'
  66. - pwsh: |
  67. & ci/run_artifacts.ps1
  68. displayName: 'Compare code coverage to master'
  69. - job: style
  70. displayName: Static Analysis
  71. pool:
  72. vmImage: 'ubuntu-latest'
  73. steps:
  74. - task: UsePythonVersion@0
  75. displayName: 'Use Python version'
  76. inputs:
  77. versionSpec: '3.7'
  78. architecture: 'x64'
  79. - script: |
  80. python -m pip install -e ./[ci_style]
  81. displayName: 'CR-QC: Install coderedcms from local repo'
  82. - script: |
  83. coderedcms start testproject
  84. displayName: 'CR-QC: Generate a test project'
  85. - pwsh: |
  86. & ci/run_flake8.ps1
  87. displayName: 'CR-QC: Static analysis (flake8)'