-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-template-tox-job.yml
132 lines (128 loc) · 5.14 KB
/
azure-template-tox-job.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File: azure-template-tox-job.yml
# Date: 8-Jul-2019 jdw split out from original pipeline
#
# Updates:
# 6-Aug-2019 jdw build source and binary wheels by default.
# 13-Aug-2019 jdw export config support token prior to launching tox runner
# 4-Oct-2022 dwp clean up template
#
##
parameters:
tox: ""
python: ""
os: "linux"
fixtures: ""
jobs:
- job: ${{ format('build_test_{0}_{1}', parameters.tox, parameters.os) }}
timeoutInMinutes: 0
pool:
${{ if eq(parameters.os, 'macos') }}:
vmImage: "macOS-latest"
${{ if eq(parameters.os, 'linux') }}:
vmImage: "ubuntu-latest"
variables:
- group: py-shared-variables
steps:
#
# ensure the required Python versions are available
- task: UsePythonVersion@0
inputs:
versionSpec: ${{ parameters.python }}
addToPath: true
displayName: setup python
#
- checkout: self
submodules: true
#
- ${{ if startsWith(parameters.os, 'macos') }}:
- bash: |
set -e
ls -la /Applications/Xcode*
sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
which g++
c++ --version
displayName: "setup Xcode"
#
- script: which brew
displayName: "Check package manager"
- script: brew install flex
displayName: "Install flex"
- script: which flex
displayName: "Check flex"
- script: brew install bison
displayName: "Install bison"
- script: which bison
displayName: "Check bison"
# ----------------------------------------------
- ${{ if startsWith(parameters.os, 'linux') }}:
- script: lsb_release -a
displayName: "Ubuntu kernal version"
- script: which apt
displayName: "Installing OS dependencies"
- script: apt-cache policy | grep http | awk '{print $2 $3}' | sort -u
displayName: "Checking for repos"
#
- script: sudo apt-get update
displayName: "update apt"
- script: sudo apt-get install flex
displayName: "Install flex"
- script: sudo apt-get install bison
displayName: "Install bison"
# -----
- script: 'python -c "import sys; print(sys.version); print(sys.executable)"'
displayName: show python information
#
- script: python -m pip install --upgrade pip tox
displayName: "Install tools"
#
- script: pip install -r requirements.txt
displayName: "Install dependencies"
#
#
- task: DownloadSecureFile@1
name: googlecloudkey
displayName: "Download Google Cloud key"
inputs:
secureFile: "googlecloudkey.json"
- ${{ if startsWith(parameters.tox, 'py') }}:
- script: |
export GOOGLE_APPLICATION_CREDENTIALS=$(googlecloudkey.secureFilePath)
export CONFIG_SUPPORT_TOKEN_ENV=$(VAR_CONFIG_SUPPORT_TOKEN_ENV)
${{ format('python -m tox -e {0}', parameters.tox) }}
displayName: "Running tox task"
- ? ${{ if and(not(startsWith(parameters.tox, 'py')), startsWith(parameters.python, '3.10')) }}
: - script: |
export GOOGLE_APPLICATION_CREDENTIALS=$(googlecloudkey.secureFilePath)
export CONFIG_SUPPORT_TOKEN_ENV=$(VAR_CONFIG_SUPPORT_TOKEN_ENV)
${{ format('python -m tox -e {0}-py310', parameters.tox) }}
displayName: "Running tox task"
- ? ${{ if and(not(startsWith(parameters.tox, 'py')), startsWith(parameters.python, '3.9')) }}
: - script: |
export GOOGLE_APPLICATION_CREDENTIALS=$(googlecloudkey.secureFilePath)
export CONFIG_SUPPORT_TOKEN_ENV=$(VAR_CONFIG_SUPPORT_TOKEN_ENV)
${{ format('python -m tox -e {0}-py39', parameters.tox) }}
displayName: "Running tox task"
#
# Build artifacts if this is a test target (i.e. labeled as py##)
#
- ${{ if startsWith(parameters.tox, 'py') }}:
- script: pip install --upgrade pip twine setuptools wheel
displayName: "Acquire build tools"
- script: python setup.py sdist --dist-dir "$(System.DefaultWorkingDirectory)/dist"
displayName: "Build source dist"
- script: python setup.py bdist_wheel --dist-dir "$(System.DefaultWorkingDirectory)/dist"
displayName: "Build wheel"
#
- script: python setup.py sdist --dist-dir "$(System.DefaultWorkingDirectory)/udist"
displayName: "Build source dist"
#
# Check the install artifacts
- script: ls -lR "$(System.DefaultWorkingDirectory)/dist" "$(System.DefaultWorkingDirectory)/udist"
displayName: "Listing of installed software"
#
- publish: $(System.DefaultWorkingDirectory)/dist
artifact: ${{ format('sw_{0}_{1}', parameters.tox, parameters.os) }}
#
- publish: $(System.DefaultWorkingDirectory)/udist
artifact: ${{ format('sw_u_{0}_{1}', parameters.tox, parameters.os) }}
#