-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-template-tox-job.yml
184 lines (181 loc) · 7.1 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
# 9-Sep-2019 jdw set unlimited timeout
#
##
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'
#
- script: brew install mmseqs2
displayName: 'Install mmseqs2'
- script: which mmseqs
displayName: 'Check mmseqs2'
#
- script: brew install mariadb
displayName: 'Install mariadb'
# ----------------------------------------------
- ${{ if startsWith(parameters.os, 'linux') }}:
- 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 install flex
displayName: 'Install flex'
- script: sudo apt-get install bison
displayName: 'Install bison'
#
- ${{ if and(contains(parameters.fixtures, 'mmseqs2'), startsWith(parameters.os, 'linux')) }}:
- bash: |
[ $(uname -m) = "x86_64" ] && echo "64bit: Yes" || echo "64bit: No"
grep -q sse4_1 /proc/cpuinfo && echo "SSE4.1: Yes" || echo "SSE4.1: No"
grep -q avx2 /proc/cpuinfo && echo "AVX2: Yes" || echo "AVX2: No"
displayName: 'Check architecture'
- bash: |
echo "Downloading latest MMseqs2 static build"
attempt=1
while [[ $attempt -le 5 ]]; do
wget https://mmseqs.com/latest/mmseqs-linux-avx2.tar.gz
if [[ $? -eq 0 ]]; then
echo "Download successful."
break
else
echo "Download failed. Retrying in 5 seconds..."
sleep 5
attempt=$((attempt + 1))
fi
done
tar xvzf mmseqs-linux-avx2.tar.gz
sudo cp mmseqs/bin/mmseqs /usr/local/bin/mmseqs
displayName: 'Install mmseqs2 binary'
#
# Mongo install
- ${{ if and(contains(parameters.fixtures, 'mongodb'), startsWith(parameters.os, 'linux')) }}:
- 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"
#
- ${{ if and(contains(parameters.fixtures, 'mongodb'), startsWith(parameters.os, 'macos')) }}:
- script: |
brew tap mongodb/brew
brew update
brew install mongodb-community@5.0
displayName: "Installing mongodb"
#
- script: brew services start mongodb-community@5.0
displayName: "Start Mongo service"
#
- script: brew services list
displayName: "Check mongodb 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) }}
#