-
Notifications
You must be signed in to change notification settings - Fork 3
/
build-pipeline.yml
114 lines (109 loc) · 3.35 KB
/
build-pipeline.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
trigger:
branches:
include:
- main
paths:
exclude:
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- LICENSE
- README.md
- SECURITY.md
pr:
branches:
include:
- main
paths:
exclude:
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- LICENSE
- README.md
- SECURITY.md
resources:
- repo: self
variables:
dockerRegistryServiceConnection: '5b196e82-84a2-4819-9605-a94dae8a565c'
containerRegistry: 'joshcacr.azurecr.io'
feedName: 'pipeline_feed_test'
setupFile: 'setup_batchkit.py'
vmImageName: 'ubuntu-20.04'
stages:
- stage: BuildTestRelease
displayName: Build, Test, and Release Python packages and Docker image in single stage
jobs:
- job: BuildTestRelease
displayName: Build, Test, and Release Python packages and Docker image in single job
pool:
vmImage: $(vmImageName)
steps:
# BUILD AND TEST PIPELINE TASKS
- task: CmdLine@2
displayName: Setup Python virtual environment and install required packages Python package
inputs:
script: |
sudo apt-get install dos2unix
sudo apt-get install -y python3-venv
python -m venv my_venv
source my_venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install twine wheel
- task: CmdLine@2
displayName: Build Python package
inputs:
script: |
chmod 755 ci/parse_package_versions
dos2unix ci/parse_package_versions
./ci/parse_package_versions
chmod 755 $(setupFile)
python $(setupFile) sdist bdist_wheel
- task: CmdLine@2
displayName: Execute Python package unit and stress tests
condition: always()
inputs:
script: |
chmod 755 run-stress-tests.py run-tests
dos2unix run-tests
./run-tests
python run-stress-tests.py
# - task: Docker@2
# displayName: Build Docker image
# condition: always()
# inputs:
# command: build
# repository: $(imageName)
# Dockerfile: joshc_repo_examples/speech_sdk/Dockerfile
# containerRegistry: $(dockerRegistryServiceConnection)
# tags: |
# latest
# - task: CmdLine@2
# displayName: Execute Speech Batch Kit sanity test
# inputs:
# script: |
# pushd ci
# chmod 755 speech_batch_kit_sanity_test
# dos2unix speech_batch_kit_sanity_test
# ./speech_batch_kit_sanity_test
# popd
# RELEASE PIPELINE TASKS
- task: CmdLine@2
displayName: Publish Python package
condition: eq(variables['Build.Reason'], 'PullRequest')
inputs:
# Package will not publish if version has not been changed
# add dependency on build and test steps
script: |
source my_venv/bin/activate
python -m pip install --upgrade pip
twine check dist/*
# twine upload dist/* -u __token__ -p $(PYPI_API_TOKEN)
- task: Docker@2
displayName: Push Docker image
condition: eq(variables['Build.Reason'], 'PullRequest')
inputs:
command: push
repository: $(imageName)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
latest