-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
99 lines (87 loc) · 2.65 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
trigger:
- master
name: bil-discord
variables:
python.version: '3.8'
docker.login: 'dockerhub'
docker.registry: 'eiriksfa'
docker.repository: 'bil-discord'
project.name: 'bil-discord'
project.package: 'bil_discord'
jobs:
- job: Debug
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Installing/Using Python version $(python.version)'
- script: |
python -m pip install -U pip
pip install poetry
pip install nox
displayName: Install dependencies
- script: |
nox
displayName: Running Nox Tests
- job: Build
pool:
vmImage: 'ubuntu-latest'
dependsOn: Debug
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master'))
variables:
- group: python-build
- name: python-build
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Installing/Using Python version $(python.version)'
- script: |
python -m pip install -U pip
pip install poetry
displayName: Install dependencies
- script: |
poetry build
displayName: Building python package
- script: |
poetry config repositories.azure https://pkgs.dev.azure.com/eiriksfagerhaug/$(project.package)/_packaging/$(project.package)/pypi/upload
poetry config http-basic.azure $(artifact-key) $(artifact-key)
poetry publish -r azure
exit 0
displayName: Publishing python package
- job: Deploy
pool:
vmImage: 'ubuntu-latest'
dependsOn: Build
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master'))
steps:
- task: Docker@2
displayName: Login to Docker-Hub
inputs:
command: login
containerRegistry: |
$(docker.login)
- task: PipAuthenticate@1
displayName: Authenticating PIP
inputs:
artifactFeeds: $(project.package)/$(project.package)
onlyAddExtraIndex: True
- task: Docker@2
displayName: Build Dockerimage
inputs:
repository: $(docker.registry)/$(docker.repository)
command: build
Dockerfile: Dockerfile
arguments: --build-arg INDEX_URL=$(PIP_EXTRA_INDEX_URL)
tags: |
$(Build.BuildId)
latest
- task: Docker@2
displayName: Push Dockerimage
inputs:
repository: $(docker.registry)/$(docker.repository)
command: push
Dockerfile: Dockerfile
tags: latest