blob: 0331e67feb357eeb13a3b4ccc51f94ff919183a4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# https://aka.ms/yaml
jobs:
- job: test
displayName: 'Test & Lint'
pool:
vmImage: ubuntu-16.04
variables:
PIP_CACHE_DIR: .cache/pip
steps:
- task: UsePythonVersion@0
displayName: 'Set Python Version'
inputs:
versionSpec: '3.7.x'
addToPath: true
- task: DockerCompose@0
displayName: 'Setup Database'
inputs:
action: Run a specific service
dockerComposeFile: docker-compose.yml
projectName: pydis_web
serviceName: postgres
ports: '7777:5432'
- script: |
pip install pipenv
pipenv install --dev --system
pip install flake8-formatter-junit-xml
displayName: 'Install Project Environment'
- script: flake8 --format junit-xml --output-file TEST-lint.xml
displayName: 'Run Linter'
- script: |
python3 manage.py makemigrations --check
python3 manage.py migrate
coverage run \
manage.py test \
--testrunner xmlrunner.extra.djangotestrunner.XMLTestRunner \
--no-input
env:
CI: azure
DATABASE_URL: postgres://pysite:pysite@localhost:7777/pysite
displayName: 'Run Tests'
- script: coverage report -m && coverage xml
displayName: 'Generate Coverage Reports'
- task: PublishTestResults@2
condition: succeededOrFailed()
displayName: 'Publish Test & Linting Results'
inputs:
testResultsFiles: '**/TEST-*.xml'
testRunTitle: 'Site Test Results'
- task: PublishCodeCoverageResults@1
displayName: 'Publish Coverage Results'
condition: succeededOrFailed()
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '**/coverage.xml'
- job: build
displayName: 'Build & Push Container'
dependsOn: test
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
steps:
- task: Docker@2
displayName: 'Build & Push Container'
inputs:
containerRegistry: 'DockerHub'
repository: 'pythondiscord/site'
command: 'buildAndPush'
Dockerfile: 'docker/Dockerfile'
buildContext: '.'
tags: 'latest'
|