2
0

azure-pipelines.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. - dev
  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.6:
  29. PYTHON_VERSION: '3.6'
  30. py3.7:
  31. PYTHON_VERSION: '3.7'
  32. py3.8:
  33. PYTHON_VERSION: '3.8'
  34. py3.9:
  35. PYTHON_VERSION: '3.9'
  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: linters
  66. displayName: Linters
  67. pool:
  68. vmImage: 'ubuntu-latest'
  69. steps:
  70. - task: UsePythonVersion@0
  71. displayName: 'Use Python version'
  72. inputs:
  73. versionSpec: '3.9'
  74. architecture: 'x64'
  75. - script: python -m pip install -r requirements-ci.txt
  76. displayName: 'CR-QC: Install coderedcms from local repo'
  77. - pwsh: ./ci/spellcheck.ps1
  78. displayName: 'CR-QC: Spelling'
  79. - script: coderedcms start testproject
  80. displayName: 'CR-QC: Generate a test project'
  81. - pwsh: ./ci/run-flake8.ps1
  82. displayName: 'CR-QC: Flake8'
  83. - job: codecov
  84. displayName: Code Coverage
  85. pool:
  86. vmImage: 'ubuntu-latest'
  87. steps:
  88. - task: DownloadBuildArtifacts@0
  89. displayName: 'Download code coverage from current build'
  90. inputs:
  91. buildType: 'current'
  92. project: '$(System.TeamProjectId)'
  93. pipeline: '$(System.DefinitionId)'
  94. downloadType: 'specific'
  95. downloadPath: '$(Agent.WorkFolder)/current-artifacts'
  96. - pwsh: ./ci/compare-codecov.ps1 -wd $Env:WorkDir
  97. displayName: 'CR-QC: Compare code coverage'
  98. failOnStderr: false
  99. env:
  100. WorkDir: $(Agent.WorkFolder)
  101. - job: docs
  102. displayName: Documentation
  103. pool:
  104. vmImage: 'ubuntu-latest'
  105. steps:
  106. - task: UsePythonVersion@0
  107. displayName: 'Use Python version'
  108. inputs:
  109. versionSpec: '3.9'
  110. architecture: 'x64'
  111. - script: python -m pip install -r requirements-ci.txt
  112. displayName: 'CR-QC: Install coderedcms from local repo'
  113. - pwsh: ./ci/make-docs.ps1
  114. displayName: 'CR-QC: Build documentation'