blob: 90232430b969ef7b3dbce1932b330f082f05c5d6 (
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
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
|
# https://aka.ms/yaml
jobs:
- job: lint_misc
displayName: Lint others
pool:
vmImage: ubuntu-16.04
steps:
- script: |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable
sudo apt-get update
sudo apt-get install docker-ce
displayName: install docker
- script: docker run -v $(pwd):/app:ro --rm ruby:alpine /bin/ash -c "gem install mdl && cd /app && mdl"
displayName: run markdownlint
- script: |
echo 'set -ex' > script.sh
echo 'for dockerfile in docker/**/**/**/Dockerfile; do' >> script.sh
echo ' docker run -i hadolint/hadolint hadolint --ignore DL3008 --ignore DL3018 - < $dockerfile' >> script.sh
echo 'done' >> script.sh
sh script.sh
displayName: run hadolint
- job: lint_python
displayName: Lint Python
pool:
vmImage: ubuntu-16.04
strategy:
matrix:
Python 3.6:
python.version: 3.6
Python 3.7:
python.version: 3.7
variables:
PIP_CACHE_DIR: .cache/pip
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(python.version)
architecture: x64
- script: >
python -m pip install $(sed -n -e "/'lint': \[/,/]/p" setup.py | tail -n +2 | head -n -1 | cut -d"'" -f2)
displayName: install lint requirements
- script: flake8
displayName: lint using flake8
- job: test
displayName: Test
pool:
vmImage: ubuntu-16.04
strategy:
matrix:
Python 3.6 with PostgreSQL 10:
python.version: 3.6
postgres.version: 10
Python 3.6 with PostgreSQL 11:
python.version: 3.6
postgres.version: 11
Python 3.7 with PostgreSQL 10:
python.version: 3.7
postgres.version: 10
Python 3.7 with PostgreSQL 11:
python.version: 3.7
postgres.version: 11
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: $(python.version)
architecture: x64
- script: |
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update -y
sudo apt-get install -y postgresql-$(postgres.version)
displayName: install postgresql
- script: |
echo "$USER_CREATE_COMMAND;" > pgscript.sql
echo "CREATE DATABASE pysite OWNER pysite;" >> pgscript.sql
sudo su postgres -c "psql < pgscript.sql"
env:
USER_CREATE_COMMAND: CREATE USER pysite WITH PASSWORD 'pysite' CREATEDB
displayName: set up the database
- script: python -m pip install -e .[test] unittest-xml-reporting
displayName: install requirements
- script: |
python manage.py migrate
coverage run --branch manage.py test --testrunner xmlrunner.extra.djangotestrunner.XMLTestRunner --no-input
env:
CI: azure
DATABASE_URL: postgres://pysite:pysite@localhost/pysite
displayName: run tests
- script: coverage report
displayName: show coverage results
- task: PublishTestResults@2
inputs:
testResultsFiles: "**/TEST-*.xml"
testRunTitle: 'Python $(python.version) with PostgreSQL $(postgres.version)'
# vim: sw=2 ts=2:
|