-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
75 lines (62 loc) · 1.61 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
trigger:
branches:
include:
- main
pr:
branches:
include:
- main
jobs:
- job: Lint
displayName: Lint Code
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12.4'
- script: |
python -m pip install --upgrade pip
pip install pylint
displayName: 'Install dependencies'
- script: pylint calculator.py
displayName: 'Run Pylint'
- job: Test
displayName: Run Tests
dependsOn: Lint
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12.4'
- script: |
python -m pip install --upgrade pip
pip install -r requirements.txt
displayName: 'Install dependencies'
- script: |
pytest --cov=calculator --cov-report=html test_calculator.py
mv htmlcov coverage_report
displayName: 'Run tests and generate coverage report'
- task: PublishPipelineArtifact@1
inputs:
targetPath: 'coverage_report'
artifact: 'coverage-report'
- job: BuildAndPush
displayName: Build and Push Docker Image
dependsOn: Test
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
- task: DockerInstaller@0
displayName: 'Install Docker'
- task: Bash@3
inputs:
targetType: 'inline'
script: |
echo $(DOCKER_TOKEN) | docker login -u $(DOCKER_USERNAME) --password-stdin
docker build . --file Dockerfile --tag omaaartamer/python-calculator:latest
docker push omaaartamer/python-calculator:latest