-
Notifications
You must be signed in to change notification settings - Fork 38
/
azure-pipelines.yml
192 lines (164 loc) · 5.16 KB
/
azure-pipelines.yml
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
trigger:
- master
- gh-readonly-queue/master/*
pool:
vmImage: 'ubuntu-latest'
jobs:
- job: tracker_backend_tests
dependsOn: []
displayName: Tracker Backend
strategy:
matrix:
Oldest:
PYTHON_VERSION: '3.8'
DJANGO_VERSION: '4.2'
Django42:
PYTHON_VERSION: '3.12'
DJANGO_VERSION: '4.2'
Django50:
PYTHON_VERSION: '3.12'
DJANGO_VERSION: '5.0'
Python38:
PYTHON_VERSION: '3.8'
DJANGO_VERSION: '4.2'
Python39:
PYTHON_VERSION: '3.9'
DJANGO_VERSION: '4.2'
Python3A:
PYTHON_VERSION: '3.10'
DJANGO_VERSION: '5.1'
Python3B:
PYTHON_VERSION: '3.11'
DJANGO_VERSION: '5.1'
Latest:
PYTHON_VERSION: '3.12'
DJANGO_VERSION: '5.1'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(PYTHON_VERSION)'
architecture: 'x64'
- task: NodeTool@0
inputs:
versionSpec: '22'
- task: Cache@2
inputs:
key: pip | $(Agent.OS) | "$(DJANGO_VERSION)" | tests/requirements.txt | setup.py
path: $(Pipeline.Workspace)/../../.cache/pip
displayName: 'Cache pip'
- task: Cache@2
inputs:
key: yarn | $(Agent.OS) | production | yarn.lock
path: $(Build.SourcesDirectory)/.yarn
displayName: 'Cache yarn'
- script: |
python -m pip install --upgrade pip setuptools wheel
displayName: 'Install Python base packages'
- script: |
pip install . -r tests/requirements.txt django~=${DJANGO_VERSION}
displayName: 'Install Python prerequisites'
- script: |
python check_migrations.py
displayName: 'Check for bad or missing migrations'
- script: |
python listperms.py --validate
displayName: 'Check for changed permissions list'
- script: |
python runtests.py --no-input --parallel 8
displayName: 'Run Django tests'
- task: PublishTestResults@2
inputs:
testResultsFiles: 'test-results/TEST-*.xml'
testRunTitle: 'Python $(PYTHON_VERSION)'
condition: succeededOrFailed()
- job: build_package
displayName: Tracker Package
condition: >
not(
or(
eq(variables['Build.SourceBranch'], 'refs/heads/master'),
startsWith(variables['Build.SourceBranchName'], 'spike'),
eq(variables['System.PullRequest.IsFork'], 'True')
)
)
steps:
- task: NodeTool@0
inputs:
versionSpec: '22'
- task: Cache@2
inputs:
key: pip | $(Agent.OS) | setup.py
path: $(Pipeline.Workspace)/../../.cache/pip
displayName: 'Cache pip'
- task: Cache@2
inputs:
key: yarn | $(Agent.OS) | production | yarn.lock
path: $(Build.SourcesDirectory)/.yarn
displayName: 'Cache yarn'
- script: |
python -m pip install --upgrade pip setuptools wheel twine
python setup.py package
displayName: 'Build Package'
env:
PACKAGE_NAME_SUFFIX: $(Build.SourceVersion)
- task: TwineAuthenticate@1
inputs:
artifactFeed: donation-tracker/donation-tracker-packages
- script: |
python -m twine upload -r donation-tracker-packages --config-file $(PYPIRC_PATH) dist/*.whl
displayName: Upload Package Artifact
- job: precommit_check
displayName: Run pre-commit hooks
steps:
- task: Cache@2
inputs:
key: pip | $(Agent.OS) | precommit | setup.py
path: $(Pipeline.Workspace)/../../.cache/pip
displayName: 'Cache pip'
- task: Cache@2
inputs:
key: pre-commit | .pre-commit-config.yaml
path: $(Pipeline.Workspace)/../../.cache/pre-commit
displayName: 'Cache pre-commit'
- task: Cache@2
inputs:
key: yarn | $(Agent.OS) | development | yarn.lock
path: $(Build.SourcesDirectory)/.yarn
displayName: 'Cache yarn'
- script: |
python -m pip install --upgrade pip setuptools wheel pre-commit
ss=0
yarn --immutable || ss=1
pre-commit run --all || ss=1
pre-commit run --hook-stage push --all || ss=1
exit $ss
displayName: 'Run pre-commit hooks'
- job: tracker_frontend_tests
dependsOn: []
displayName: Tracker Frontend
continueOnError: true
variables:
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
strategy:
matrix:
Node18:
NODE_VERSION: 18
Node20:
NODE_VERSION: 20
Node22:
NODE_VERSION: 22
steps:
- task: NodeTool@0
inputs:
versionSpec: '$(NODE_VERSION)'
- task: Cache@2
inputs:
key: yarn | $(Agent.OS) | "$(NODE_VERSION)" | development | yarn.lock
path: $(YARN_CACHE_FOLDER)
displayName: 'Cache yarn'
- script: yarn --immutable
displayName: 'yarn install'
- script: yarn build
displayName: 'build'
- script: yarn test
displayName: 'tests (Karma)'