azure-pipelines.yml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. # Test a Django project on multiple versions of Python.
  2. # Add steps that analyze code, save build artifacts, deploy, and more:
  3. # https://docs.microsoft.com/azure/devops/pipelines/languages/python
  4. # NOTES:
  5. #
  6. # Display name of each step should be prefixed with one of the following:
  7. # CR-QC: for quality control measures.
  8. # CR-BUILD: for build-related tasks.
  9. # CR-DEPLOY: for publication or deployment.
  10. # [no prefix]: for unrelated CI setup/tooling.
  11. #
  12. # Use PowerShell Core for any utility scripts so they are re-usable across
  13. # Windows, macOS, and Linux.
  14. trigger:
  15. - main
  16. stages:
  17. - stage: Unit_Tests
  18. displayName: Unit Tests
  19. jobs:
  20. - job: pytest
  21. displayName: pytest
  22. pool:
  23. vmImage: 'ubuntu-latest'
  24. strategy:
  25. matrix:
  26. # Oldest versions of python should use the oldest versions of
  27. # wagtail we support, for testing purposes.
  28. py3.9:
  29. PYTHON_VERSION: '3.9'
  30. WAGTAIL_VERSION: '6.3.*'
  31. TEMPLATE: 'basic'
  32. py3.10:
  33. PYTHON_VERSION: '3.10'
  34. WAGTAIL_VERSION: '6.3.*'
  35. TEMPLATE: 'basic'
  36. py3.11:
  37. PYTHON_VERSION: '3.11'
  38. WAGTAIL_VERSION: '6.4.*'
  39. TEMPLATE: 'basic'
  40. py3.12:
  41. PYTHON_VERSION: '3.12'
  42. WAGTAIL_VERSION: '6.*'
  43. TEMPLATE: 'basic'
  44. py3.13_basic:
  45. PYTHON_VERSION: '3.13'
  46. WAGTAIL_VERSION: '6.*'
  47. TEMPLATE: 'basic'
  48. py3.13_pro:
  49. PYTHON_VERSION: '3.13'
  50. WAGTAIL_VERSION: '6.*'
  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. python -m pip install -r requirements-dev.txt
  65. python manage.py makemigrations --check
  66. displayName: 'CR-QC: Check migrations'
  67. - pwsh: ./ci/run-tests.ps1
  68. displayName: 'CR-QC: Run unit tests'
  69. - task: PublishTestResults@2
  70. displayName: 'Publish unit test report'
  71. condition: succeededOrFailed()
  72. inputs:
  73. testResultsFiles: '**/test-*.xml'
  74. testRunTitle: 'Publish test results for Python $(python.version)'
  75. - task: PublishCodeCoverageResults@2
  76. displayName: 'Publish code coverage report'
  77. condition: succeededOrFailed()
  78. inputs:
  79. summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
  80. - stage: Static_Analysis
  81. displayName: Static Analysis
  82. dependsOn: Unit_Tests
  83. condition: succeeded('Unit_Tests')
  84. jobs:
  85. - job: linters
  86. displayName: Linters
  87. pool:
  88. vmImage: 'ubuntu-latest'
  89. steps:
  90. - task: UsePythonVersion@0
  91. displayName: 'Use Python version'
  92. inputs:
  93. versionSpec: '3.13'
  94. architecture: 'x64'
  95. - script: python -m pip install -r requirements-ci.txt
  96. displayName: 'CR-QC: Install coderedcms from local repo'
  97. - pwsh: ./ci/spellcheck.ps1
  98. displayName: 'CR-QC: Spelling'
  99. - script: ruff format --check .
  100. displayName: 'CR-QC: Ruff Format'
  101. - script: ruff check .
  102. displayName: 'CR-QC: Ruff Check'
  103. - job: codecov
  104. displayName: Code Coverage
  105. pool:
  106. vmImage: 'ubuntu-latest'
  107. steps:
  108. - task: DownloadBuildArtifacts@0
  109. displayName: 'Download code coverage from current build'
  110. inputs:
  111. buildType: 'current'
  112. project: '$(System.TeamProjectId)'
  113. pipeline: '$(System.DefinitionId)'
  114. downloadType: 'specific'
  115. downloadPath: '$(Agent.WorkFolder)/current-artifacts'
  116. - pwsh: ./ci/compare-codecov.ps1 -wd $Env:WorkDir
  117. displayName: 'CR-QC: Compare code coverage'
  118. failOnStderr: false
  119. env:
  120. WorkDir: $(Agent.WorkFolder)
  121. - job: docs
  122. displayName: Documentation
  123. pool:
  124. vmImage: 'ubuntu-latest'
  125. steps:
  126. - task: UsePythonVersion@0
  127. displayName: 'Use Python version'
  128. inputs:
  129. versionSpec: '3.13'
  130. architecture: 'x64'
  131. - script: python -m pip install -r requirements-ci.txt
  132. displayName: 'CR-QC: Install coderedcms from local repo'
  133. - pwsh: ./ci/make-docs.ps1
  134. displayName: 'CR-QC: Build documentation'