-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-template-tox-job.yml
184 lines (179 loc) · 7.89 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File: azure-template-tox-job.yml
# Date: 8-Jul-2019 jdw split out from original pipeline
# Supports: fixtures=mysql,mongodb (linux)
#
# 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
#
##
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-13"
${{ if eq(parameters.os, 'linux') }}:
vmImage: "ubuntu-22.04"
variables:
- group: py-shared-variables
- name: DECODE_PERCENTS
value: false
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_12.2.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"
- script: brew install mariadb
displayName: "Install mariadb"
# ----------------------------------------------
- ${{ 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 upgrade
# displayName: 'upgrade apt'
#- 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"
#
- ? ${{ if and(contains(parameters.fixtures, 'mysql'), startsWith(parameters.os, 'linux')) }}
: - bash: |
sudo apt-get install python3-dev mysql-server
sudo apt-get install default-libmysqlclient-dev
sudo apt-get install python-mysqldb
sudo apt list --installed | grep -i mysql
displayName: "Install mysql development libraries"
- bash: |
echo "Retarting mysql service"
sudo systemctl restart mysql.service
mysql -V
mysql --user=root --password=root -e "use mysql; select * from user;"
#
echo "Try resetting password"
mysqladmin --user=root --password=root password 'ChangeMeSoon'
#
# mysql -u root -p root -e "SET PASSWORD FOR root@'localhost' = PASSWORD(‘ChangeMeSoon’);"
# mysql -u root -p root -e "FLUSH PRIVILEGES; update mysql.user set password=password('ChangeMeSoon') where user='root'; FLUSH PRIVILEGES;"
# UPDATE mysql.user SET Password=PASSWORD('ChangeMeSoon') WHERE User='root';
echo "Running preliminary mysql setup"
mysql --user=root --password=ChangeMeSoon <<_EOF_
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
FLUSH PRIVILEGES;
_EOF_
ps -ef | grep -i my
mysql --user=root --password=ChangeMeSoon -e "show databases;"
#
displayName: "Start and configure mysql ..."
# -----
- ? ${{ if and(contains(parameters.fixtures, 'mongodb'), startsWith(parameters.os, 'linux')) }}
: # Mongo install
- script: |
sudo apt-get install gnupg wget
wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo apt-key add -
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
sudo apt list --installed | grep mongodb
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
# echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt list --installed | grep mongo
displayName: "Installing mongodb"
#
- script: |
sudo service mongod start
sudo ss -tulpn
displayName: "Start Mongo service"
#
#
- 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"
#
- ${{ if startsWith(parameters.tox, 'py') }}:
- script: |
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 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 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) }}
#