forked from utay/rust-mysql-simple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
297 lines (281 loc) · 14.7 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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
trigger:
- master
- ci-*
jobs:
- job: "TestBasicLinux"
pool:
vmImage: "ubuntu-latest"
strategy:
maxParallel: 10
matrix:
stable:
RUST_TOOLCHAIN: stable
beta:
RUST_TOOLCHAIN: beta
nightly:
RUST_TOOLCHAIN: nightly
steps:
- bash: |
sudo apt-get update
sudo apt-get -y install mysql-server libmysqlclient-dev curl
sudo service mysql start
mysql -e "SET GLOBAL max_allowed_packet = 36700160;" -uroot -proot
mysql -e "SET GLOBAL local_infile = 1;" -uroot -proot
mysql -e "SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = WARN;" -uroot -proot
mysql -e "SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = ON;" -uroot -proot
mysql -e "SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;" -uroot -proot
mysql -e "SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;" -uroot -proot
mysql -e "SET @@GLOBAL.GTID_MODE = ON;" -uroot -proot
mysql -e "PURGE BINARY LOGS BEFORE now();" -uroot -proot
displayName: Install MySql
- bash: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $(RUST_TOOLCHAIN)
echo '##vso[task.setvariable variable=toolchain;isOutput=true]$(RUST_TOOLCHAIN)'
displayName: Install Rust
name: installRust
- bash: |
rustup component add rustfmt
cargo fmt -- --check
condition: and(succeeded(), eq(variables['installRust.toolchain'], 'stable'))
displayName: cargo fmt
- bash: |
SSL=false COMPRESS=false cargo test
SSL=true COMPRESS=false cargo test
SSL=false COMPRESS=true cargo test
SSL=true COMPRESS=true cargo test
SSL=true COMPRESS=false cargo test --no-default-features --features rustls-tls,flate2/zlib,mysql_common/time03,mysql_common/frunk
SSL=true COMPRESS=true cargo test --no-default-features --features rustls-tls,flate2/zlib,mysql_common/time03,mysql_common/frunk
SSL=false COMPRESS=true cargo test --no-default-features --features flate2/zlib,mysql_common/time03,mysql_common/frunk
SSL=false COMPRESS=false cargo test --no-default-features --features flate2/zlib,mysql_common/time03,mysql_common/frunk
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://root:root@localhost:3306/mysql
displayName: Run tests
- job: "TestBasicMacOs"
pool:
vmImage: "macOS-10.15"
strategy:
maxParallel: 10
matrix:
stable:
RUST_TOOLCHAIN: stable
steps:
- bash: |
brew update
brew install mysql
brew services start mysql
brew services stop mysql
sleep 3
echo 'local_infile=1' >> /usr/local/etc/my.cnf
echo 'socket=/tmp/mysql.sock' >> /usr/local/etc/my.cnf
brew services start mysql
mysql --version
sleep 5
/usr/local/Cellar/mysql/*/bin/mysql -e "SET GLOBAL max_allowed_packet = 36700160;" -uroot
/usr/local/Cellar/mysql/*/bin/mysql -e "SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = WARN;" -uroot
/usr/local/Cellar/mysql/*/bin/mysql -e "SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = ON;" -uroot
/usr/local/Cellar/mysql/*/bin/mysql -e "SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;" -uroot
/usr/local/Cellar/mysql/*/bin/mysql -e "SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;" -uroot
/usr/local/Cellar/mysql/*/bin/mysql -e "SET @@GLOBAL.GTID_MODE = ON;" -uroot
displayName: Install MySql
- bash: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUST_TOOLCHAIN
displayName: Install rust (MacOs)
- bash: |
SSL=false COMPRESS=false cargo test
SSL=true COMPRESS=false cargo test
SSL=false COMPRESS=true cargo test
SSL=true COMPRESS=true cargo test
SSL=true COMPRESS=false cargo test --no-default-features --features rustls-tls,flate2/zlib,mysql_common/time03,mysql_common/frunk
SSL=true COMPRESS=true cargo test --no-default-features --features rustls-tls,flate2/zlib,mysql_common/time03,mysql_common/frunk
SSL=false COMPRESS=true cargo test --no-default-features --features flate2/zlib,mysql_common/time03,mysql_common/frunk
SSL=false COMPRESS=false cargo test --no-default-features --features flate2/zlib,mysql_common/time03,mysql_common/frunk
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://root@localhost/mysql
displayName: Run tests
- job: "TestBasicWindows"
pool:
vmImage: "windows-2019"
strategy:
maxParallel: 10
matrix:
stable:
RUST_TOOLCHAIN: stable
steps:
- script: |
choco install 7zip
mkdir C:\mysql
CD /D C:\mysql
curl -fsS --retry 3 --retry-connrefused -o mysql.msi https://cdn.mysql.com/archives/mysql-installer/mysql-installer-community-8.0.11.0.msi
msiexec /q /log install.txt /i mysql.msi datadir=C:\mysql installdir=C:\mysql
call "C:\Program Files (x86)\MySQL\MySQL Installer for Windows\MySQLInstallerConsole.exe" community install server;8.0.11;x64:*:port=3306;enable_named_pipe=true;rootpasswd=password;servicename=MySQL -silent
netsh advfirewall firewall add rule name="Allow mysql" dir=in action=allow edge=yes remoteip=any protocol=TCP localport=80,8080,3306
net stop MySQL
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld" --remove
echo [mysqld] >> C:\my.cnf
echo enable-named-pipe >> C:\my.cnf
echo socket=MYSQL >> C:\my.cnf
echo datadir=C:\\ProgramData\\MySQL\\MySQL Server 8.0\\Data\\ >> C:\my.cnf
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld" --install MySQL --defaults-file=C:\my.cnf
net start MySQL
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql" -e "SET GLOBAL max_allowed_packet = 36700160;" -uroot -ppassword
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql" -e "SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = WARN;" -uroot -ppassword
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql" -e "SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = ON;" -uroot -ppassword
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql" -e "SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;" -uroot -ppassword
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql" -e "SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;" -uroot -ppassword
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql" -e "SET @@GLOBAL.GTID_MODE = ON;" -uroot -ppassword
displayName: Install MySql
- bash: |
rustup install $RUST_TOOLCHAIN
displayName: Install Rust (Windows)
- bash: |
SSL=false COMPRESS=false cargo test
SSL=true COMPRESS=false cargo test
SSL=false COMPRESS=true cargo test
SSL=true COMPRESS=true cargo test
SSL=true COMPRESS=false cargo test --no-default-features --features rustls-tls,flate2/zlib,mysql_common/time03,mysql_common/frunk
SSL=true COMPRESS=true cargo test --no-default-features --features rustls-tls,flate2/zlib,mysql_common/time03,mysql_common/frunk
SSL=false COMPRESS=true cargo test --no-default-features --features flate2/zlib,mysql_common/time03,mysql_common/frunk
SSL=false COMPRESS=false cargo test --no-default-features --features flate2/zlib,mysql_common/time03,mysql_common/frunk
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://root:password@localhost/mysql
displayName: Run tests
- job: "TestTiDB"
pool:
vmImage: "ubuntu-latest"
strategy:
matrix:
v5.3.0:
DB_VERSION: "v5.3.0"
v5.0.6:
DB_VERSION: "v5.0.6"
steps:
- bash: |
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
source ~/.profile
tiup playground $(DB_VERSION) --db 1 --pd 1 --kv 1 &
while ! nc -W 1 localhost 4000 | grep -q -P '.+'; do sleep 1; done
displayName: Install and run TiDB
- bash: cargo test should_reuse_connections -- --nocapture
displayName: Run tests
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://[email protected]:4000/mysql
- job: "TestMySql"
pool:
vmImage: "ubuntu-latest"
strategy:
maxParallel: 10
matrix:
v80:
DB_VERSION: "8-debian"
v57:
DB_VERSION: "5-debian"
v56:
DB_VERSION: "5.6"
steps:
- bash: |
sudo apt-get update
sudo apt-get install docker.io netcat grep
sudo systemctl unmask docker
sudo systemctl start docker
docker --version
displayName: Install docker
- bash: |
if [[ "5.6" == "$(DB_VERSION)" ]]; then ARG="--secure-auth=OFF"; fi
docker run -d --name container -v `pwd`:/root -p 3307:3306 -e MYSQL_ROOT_PASSWORD=password mysql:$(DB_VERSION) --max-allowed-packet=36700160 --local-infile --log-bin=mysql-bin --log-slave-updates --gtid_mode=ON --enforce_gtid_consistency=ON --server-id=1 $ARG
while ! nc -W 1 localhost 3307 | grep -q -P '.+'; do sleep 1; done
displayName: Run MySql in Docker
- bash: |
docker exec container bash -l -c "mysql -uroot -ppassword -e \"SET old_passwords = 1; GRANT ALL PRIVILEGES ON *.* TO 'root2'@'%' IDENTIFIED WITH mysql_old_password AS 'password'; SET PASSWORD FOR 'root2'@'%' = OLD_PASSWORD('password')\"";
condition: eq(variables['DB_VERSION'], '5.6')
- bash: |
docker exec container bash -l -c "apt-get update"
docker exec container bash -l -c "apt-get install -y curl clang libssl-dev pkg-config build-essential"
docker exec container bash -l -c "curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable"
displayName: Install Rust in docker
- bash: |
if [[ "5.6" != "$(DB_VERSION)" ]]; then SSL=true; else DATABASE_URL="mysql://root2:password@localhost/mysql?secure_auth=false"; fi
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL cargo test"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL COMPRESS=true cargo test"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=$SSL cargo test"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=$SSL COMPRESS=true cargo test"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=true COMPRESS=false cargo test --no-default-features --features rustls-tls,flate2/zlib,mysql_common/time03,mysql_common/frunk"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=true COMPRESS=true cargo test --no-default-features --features rustls-tls,flate2/zlib,mysql_common/time03,mysql_common/frunk"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=false COMPRESS=true cargo test --no-default-features --features flate2/zlib,mysql_common/time03,mysql_common/frunk"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=false COMPRESS=false cargo test --no-default-features --features flate2/zlib,mysql_common/time03,mysql_common/frunk"
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://root:password@localhost/mysql
displayName: Run tests in Docker
- job: "TestMariaDb"
pool:
vmImage: "ubuntu-latest"
strategy:
maxParallel: 10
matrix:
v108:
DB_VERSION: "10.8"
v107:
DB_VERSION: "10.7"
v106:
DB_VERSION: "10.6"
v105:
DB_VERSION: "10.5"
v104:
DB_VERSION: "10.4"
v103:
DB_VERSION: "10.3"
v102:
DB_VERSION: "10.2"
v101:
DB_VERSION: "10.1"
steps:
- bash: |
sudo apt-get update
sudo apt-get install docker.io netcat grep
sudo systemctl unmask docker
sudo systemctl start docker
docker --version
displayName: Install docker
- bash: |
docker run --rm -d \
--name container \
-v `pwd`:/root \
-p 3307:3306 \
-e MYSQL_ROOT_PASSWORD=password \
mariadb:$(DB_VERSION) \
--max-allowed-packet=36700160 \
--local-infile \
--performance-schema=on \
--log-bin=mysql-bin --gtid-domain-id=1 \
--ssl \
--ssl-ca=/root/tests/ca.crt \
--ssl-cert=/root/tests/server.crt \
--ssl-key=/root/tests/server-key.pem &
while ! nc -W 1 localhost 3307 | grep -q -P '.+'; do sleep 1; done
docker logs container
docker exec container bash -l -c "mysql -uroot -ppassword -e 'SHOW VARIABLES LIKE \"%ssl%\"'"
docker exec container bash -l -c "mysql -uroot -ppassword -e 'SET GLOBAL server_id = 1;'"
docker exec container bash -l -c "ls -la /root/tests"
displayName: Run MariaDb in Docker
- bash: |
docker exec container bash -l -c "apt-get update"
docker exec container bash -l -c "apt-get install -y curl clang libssl-dev pkg-config"
docker exec container bash -l -c "curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable"
displayName: Install Rust in docker
- bash: |
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL cargo test"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL COMPRESS=true cargo test"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=true cargo test"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=true COMPRESS=true cargo test"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=true COMPRESS=false cargo test --no-default-features --features rustls-tls,flate2/zlib,mysql_common/time03,mysql_common/frunk"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=true COMPRESS=true cargo test --no-default-features --features rustls-tls,flate2/zlib,mysql_common/time03,mysql_common/frunk"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=false COMPRESS=true cargo test --no-default-features --features flate2/zlib,mysql_common/time03,mysql_common/frunk"
docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=false COMPRESS=false cargo test --no-default-features --features flate2/zlib,mysql_common/time03,mysql_common/frunk"
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://root:password@localhost/mysql
displayName: Run tests in Docker