azure-pipelines.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 utility scripts so they are re-usable across
  14. # Windows, macOS, and Linux.
  15. #
  16. trigger:
  17. - master
  18. stages:
  19. - stage: Unit_Tests
  20. displayName: Unit Tests
  21. jobs:
  22. - job: pytest
  23. displayName: pytest
  24. pool:
  25. vmImage: 'ubuntu-latest'
  26. strategy:
  27. matrix:
  28. py3.5:
  29. PYTHON_VERSION: '3.5'
  30. py3.6:
  31. PYTHON_VERSION: '3.6'
  32. py3.7:
  33. PYTHON_VERSION: '3.7'
  34. py3.8:
  35. PYTHON_VERSION: '3.8'
  36. steps:
  37. - task: UsePythonVersion@0
  38. displayName: 'Use Python version'
  39. inputs:
  40. versionSpec: '$(PYTHON_VERSION)'
  41. architecture: 'x64'
  42. - script: python -m pip install -r requirements-ci.txt
  43. displayName: 'CR-QC: Install coderedcms from local repo'
  44. - script: coderedcms start testproject
  45. displayName: 'CR-QC: Create starter project from template'
  46. - pwsh: ./ci/run-tests.ps1
  47. displayName: 'CR-QC: Run unit tests'
  48. - task: PublishTestResults@2
  49. displayName: 'Publish unit test report'
  50. condition: succeededOrFailed()
  51. inputs:
  52. testResultsFiles: '**/test-*.xml'
  53. testRunTitle: 'Publish test results for Python $(python.version)'
  54. - task: PublishCodeCoverageResults@1
  55. displayName: 'Publish code coverage report'
  56. condition: succeededOrFailed()
  57. inputs:
  58. codeCoverageTool: Cobertura
  59. summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
  60. - stage: Static_Analysis
  61. displayName: Static Analysis
  62. dependsOn: Unit_Tests
  63. condition: succeeded('Unit_Tests')
  64. jobs:
  65. - job: flake8
  66. displayName: flake8
  67. pool:
  68. vmImage: 'ubuntu-latest'
  69. steps:
  70. - task: UsePythonVersion@0
  71. displayName: 'Use Python version'
  72. inputs:
  73. versionSpec: '3.8'
  74. architecture: 'x64'
  75. - script: python -m pip install -r requirements-ci.txt
  76. displayName: 'CR-QC: Install coderedcms from local repo'
  77. - script: coderedcms start testproject
  78. displayName: 'CR-QC: Generate a test project'
  79. - pwsh: ./ci/run-flake8.ps1
  80. displayName: 'CR-QC: Static analysis (flake8)'
  81. - job: codecov
  82. displayName: Code Coverage
  83. pool:
  84. vmImage: 'ubuntu-latest'
  85. steps:
  86. - task: DownloadPipelineArtifact@2
  87. displayName: 'Download code coverage from current build'
  88. inputs:
  89. source: 'current'
  90. path: '$(Agent.WorkFolder)/current-artifacts'
  91. project: '$(System.TeamProjectId)'
  92. pipeline: '$(System.DefinitionId)'
  93. - pwsh: ./ci/compare-codecov.ps1 -wd $Env:WorkDir
  94. displayName: 'CR-QC: Compare code coverage'
  95. env:
  96. WorkDir: $(Agent.WorkFolder)
  97. - job: docs
  98. displayName: Documentation
  99. pool:
  100. vmImage: 'ubuntu-latest'
  101. steps:
  102. - task: UsePythonVersion@0
  103. displayName: 'Use Python version'
  104. inputs:
  105. versionSpec: '3.8'
  106. architecture: 'x64'
  107. - script: python -m pip install -r requirements-ci.txt
  108. displayName: 'CR-QC: Install coderedcms from local repo'
  109. - pwsh: ./ci/make-docs.ps1
  110. displayName: 'CR-QC: Build documentation'