forked from GamesDoneQuick/donation-tracker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
125 lines (103 loc) · 3.63 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
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
jobs:
- job: tracker_backend_tests
dependsOn: []
displayName: Tracker Backend
strategy:
matrix:
Python36:
PYTHON_VERSION: '3.6'
Python37:
PYTHON_VERSION: '3.7'
variables:
TOPLEVEL_REVISION: e170b3970c805b4b0c9cb9167c57c78d62f27dd5
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(PYTHON_VERSION)'
architecture: 'x64'
- script: |
mv -v $(Build.SourcesDirectory) $(Agent.BuildDirectory)/tracker
git clone git://github.com/TipoftheHats/donation-tracker-toplevel $(Build.SourcesDirectory)
cd $(Build.SourcesDirectory)
git reset --hard $(TOPLEVEL_REVISION)
mv -v $(Agent.BuildDirectory)/tracker $(Build.SourcesDirectory)
cp -v tracker/ci/.env.ci $(Build.SourcesDirectory)/.env
displayName: 'Install toplevel around the tracker'
- task: PythonScript@0
displayName: 'Export project path'
inputs:
scriptSource: 'inline'
script: |
"""Search all subdirectories for `manage.py`."""
from glob import iglob
from os import path
manage_py = next(iglob(path.join('**', 'manage.py'), recursive=True), None)
if not manage_py:
raise SystemExit('Could not find a Django project')
project_location = path.dirname(path.abspath(manage_py))
print('Found Django project in', project_location)
print('##vso[task.setvariable variable=projectRoot]{}'.format(project_location))
- task: CacheBeta@1
inputs:
key: pip | $(Agent.OS) | tracker/requirements.txt
path: $(Pipeline.Workspace)/../../.cache/pip
displayName: 'Cache pip'
- script: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install unittest-xml-reporting tblib
displayName: 'Install python prerequisites'
- task: CacheBeta@1
inputs:
key: yarn | $(Agent.OS) | tracker/yarn.lock
path: $(Build.SourcesDirectory)/tracker/node_modules
displayName: 'Cache yarn'
- script: |
cd tracker
yarn install --frozen-lockfile
displayName: 'Install node prerequisites'
- script: |
cd tracker
python check_migrations.py
displayName: 'Check for bad or missing migrations'
- script: |
cd tracker
yarn build
displayName: 'Generate webpack manifest'
- script: |
cd tracker
python runtests.py --parallel --no-input
displayName: 'Run Django tests'
- task: PublishTestResults@2
inputs:
testResultsFiles: '**/TEST-*.xml'
testRunTitle: 'Python $(PYTHON_VERSION)'
condition: succeededOrFailed()
- job: tracker_frontend_tests
dependsOn: []
displayName: Tracker Frontend
continueOnError: true
variables:
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
steps:
- task: Cache@2
inputs:
key: yarn | $(Agent.OS) | yarn.lock
path: $(YARN_CACHE_FOLDER)
displayName: 'Cache yarn'
- script: yarn --frozen-lockfile
displayName: 'yarn install'
- script: yarn build
displayName: 'build'
- script: yarn prettier
displayName: 'Formatting (prettier)'
- script: yarn tsc
displayName: 'Typechecking (typescript)'
- script: yarn lint
displayName: 'Linting (eslint)'
- script: yarn test
displayName: 'tests (Karma)'