-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathazure-pipelines.yml
54 lines (43 loc) · 1.55 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
# Docker image
# Build a Docker image to deploy, run, or push to a container registry.
# Add steps that use Docker Compose, tag images, push to a registry, run an image, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
- master
pool:
vmImage: "Ubuntu-16.04"
variables:
imageName: "$(dockerId)/districtr-api:$(build.buildId)"
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "3.6"
architecture: "x64"
- script: |
pip install pipenv
pipenv install --dev --pre
displayName: "Install dependencies from Pipfile"
- script: |
pipenv run flake8 api --max-line-length 88
displayName: "Run lint tests"
- script: |
pipenv run pytest tests --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
displayName: "Test with pytest"
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: "**/test-*.xml"
testRunTitle: "Publish test results"
- script: docker build -f Dockerfile -t $(imageName) .
displayName: "Build Docker image"
- script: |
echo $(dockerPassword) | docker login -u $(dockerId) --password-stdin
docker push $(imageName)
condition:
and(succeeded(), eq(variables['Build.SourceBranch'],
'refs/heads/master'))
displayName: "Push Docker image"
- task: PublishPipelineArtifact@0
inputs:
artifactName: "Source"
targetPath: "."