azure-pipelines.yml 4.3 KB

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