2
0

azure-pipelines.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. - main
  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.8_wag5.0:
  29. PYTHON_VERSION: '3.8'
  30. WAGTAIL_VERSION: '5.0.*'
  31. TEMPLATE: 'basic'
  32. py3.9_wag5.0:
  33. PYTHON_VERSION: '3.9'
  34. WAGTAIL_VERSION: '5.0.*'
  35. TEMPLATE: 'basic'
  36. py3.10_wag5.0:
  37. PYTHON_VERSION: '3.10'
  38. WAGTAIL_VERSION: '5.0.*'
  39. TEMPLATE: 'basic'
  40. py3.11_wag5.1:
  41. PYTHON_VERSION: '3.11'
  42. WAGTAIL_VERSION: '5.1.*'
  43. TEMPLATE: 'basic'
  44. py3.12_wag5.2_basic:
  45. PYTHON_VERSION: '3.12'
  46. WAGTAIL_VERSION: '5.2.*'
  47. TEMPLATE: 'basic'
  48. py3.12_wag5.2_pro:
  49. PYTHON_VERSION: '3.12'
  50. WAGTAIL_VERSION: '5.2.*'
  51. TEMPLATE: 'pro'
  52. steps:
  53. - task: UsePythonVersion@0
  54. displayName: 'Use Python version'
  55. inputs:
  56. versionSpec: '$(PYTHON_VERSION)'
  57. architecture: 'x64'
  58. - script: python -m pip install -r requirements-ci.txt wagtail==$(WAGTAIL_VERSION)
  59. displayName: 'CR-QC: Install coderedcms from local repo'
  60. - script: coderedcms start testproject --template $(TEMPLATE)
  61. displayName: 'CR-QC: Create starter project from template'
  62. - script: |
  63. cd testproject/
  64. touch requirements-dev.txt
  65. python -m pip install -r requirements-dev.txt
  66. python manage.py makemigrations --check
  67. displayName: 'CR-QC: Check migrations'
  68. - pwsh: ./ci/run-tests.ps1
  69. displayName: 'CR-QC: Run unit tests'
  70. - task: PublishTestResults@2
  71. displayName: 'Publish unit test report'
  72. condition: succeededOrFailed()
  73. inputs:
  74. testResultsFiles: '**/test-*.xml'
  75. testRunTitle: 'Publish test results for Python $(python.version)'
  76. - task: PublishCodeCoverageResults@1
  77. displayName: 'Publish code coverage report'
  78. condition: succeededOrFailed()
  79. inputs:
  80. codeCoverageTool: Cobertura
  81. summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
  82. - stage: Static_Analysis
  83. displayName: Static Analysis
  84. dependsOn: Unit_Tests
  85. condition: succeeded('Unit_Tests')
  86. jobs:
  87. - job: linters
  88. displayName: Linters
  89. pool:
  90. vmImage: 'ubuntu-latest'
  91. steps:
  92. - task: UsePythonVersion@0
  93. displayName: 'Use Python version'
  94. inputs:
  95. versionSpec: '3.12'
  96. architecture: 'x64'
  97. - script: python -m pip install -r requirements-ci.txt
  98. displayName: 'CR-QC: Install coderedcms from local repo'
  99. - pwsh: ./ci/spellcheck.ps1
  100. displayName: 'CR-QC: Spelling'
  101. - script: black --check .
  102. displayName: 'CR-QC: Black'
  103. - script: flake8 .
  104. displayName: 'CR-QC: Flake8'
  105. - job: codecov
  106. displayName: Code Coverage
  107. pool:
  108. vmImage: 'ubuntu-latest'
  109. steps:
  110. - task: DownloadBuildArtifacts@0
  111. displayName: 'Download code coverage from current build'
  112. inputs:
  113. buildType: 'current'
  114. project: '$(System.TeamProjectId)'
  115. pipeline: '$(System.DefinitionId)'
  116. downloadType: 'specific'
  117. downloadPath: '$(Agent.WorkFolder)/current-artifacts'
  118. - pwsh: ./ci/compare-codecov.ps1 -wd $Env:WorkDir
  119. displayName: 'CR-QC: Compare code coverage'
  120. failOnStderr: false
  121. env:
  122. WorkDir: $(Agent.WorkFolder)
  123. - job: docs
  124. displayName: Documentation
  125. pool:
  126. vmImage: 'ubuntu-latest'
  127. steps:
  128. - task: UsePythonVersion@0
  129. displayName: 'Use Python version'
  130. inputs:
  131. versionSpec: '3.11'
  132. architecture: 'x64'
  133. - script: python -m pip install -r requirements-ci.txt
  134. displayName: 'CR-QC: Install coderedcms from local repo'
  135. - pwsh: ./ci/make-docs.ps1
  136. displayName: 'CR-QC: Build documentation'