-
Notifications
You must be signed in to change notification settings - Fork 117
/
azure-pipelines.yml
225 lines (219 loc) · 10.6 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
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.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: |
cargo +nightly build -Zfeatures=dev_dep
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 default-rustls
SSL=true COMPRESS=false cargo check --no-default-features --features minimal
SSL=true COMPRESS=false cargo check --no-default-features --features minimal-rust
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://root:[email protected]:3306/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;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
"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
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://root:[email protected]/mysql
displayName: Run tests
- job: "TestMySql"
pool:
vmImage: "ubuntu-latest"
strategy:
maxParallel: 10
matrix:
v80:
DB_VERSION: "8.0-debian"
v57:
DB_VERSION: "5.7-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')\"";
docker exec container bash -l -c "echo 'deb [trusted=yes] http://archive.debian.org/debian/ stretch main non-free contrib' > /etc/apt/sources.list"
docker exec container bash -l -c "echo 'deb-src [trusted=yes] http://archive.debian.org/debian/ stretch main non-free contrib ' >> /etc/apt/sources.list"
docker exec container bash -l -c "echo 'deb [trusted=yes] http://archive.debian.org/debian-security/ stretch/updates main non-free contrib' >> /etc/apt/sources.list"
docker exec container bash -l -c "echo 'deb [trusted=yes] http://repo.mysql.com/apt/debian/ stretch mysql-5.6' > /etc/apt/sources.list.d/mysql.list"
condition: eq(variables['DB_VERSION'], '5.6')
- bash: |
docker exec container bash -l -c "apt-get --allow-unauthenticated -y 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:[email protected]/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=$SSL COMPRESS=true cargo test --no-default-features --features default-rustls"
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://root:[email protected]/mysql
displayName: Run tests in Docker
- job: "TestMariaDb"
pool:
vmImage: "ubuntu-latest"
strategy:
maxParallel: 10
matrix:
v113:
DB_VERSION: "11.3"
v1011:
DB_VERSION: "10.11"
v106:
DB_VERSION: "10.6"
v105:
DB_VERSION: "10.5"
v104:
DB_VERSION: "10.4"
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: |
git clone https://github.com/blackbeam/rust-mysql-simple.git
cd rust-mysql-simple
git checkout 901a7de
displayName: Clone rust-mysql-simple (for ssl certs)
- bash: |
docker run --rm -d \
--name container \
-v `pwd`:/root \
-p 3307:3306 \
-e MARIADB_ROOT_PASSWORD=password \
-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 --server-id=1 \
--ssl \
--ssl-ca=/root/rust-mysql-simple/tests/ca.crt \
--ssl-cert=/root/rust-mysql-simple/tests/server.crt \
--ssl-key=/root/rust-mysql-simple/tests/server-key.pem &
while ! nc -W 1 localhost 3307 | grep -q -P '.+'; do sleep 1; done
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"
if [[ "10.1" != "$(DB_VERSION)" ]]; then docker exec container bash -l -c "cd \$HOME && DATABASE_URL=$DATABASE_URL SSL=true cargo test --no-default-features --features default-rustls"; fi
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://root:[email protected]/mysql
displayName: Run tests in Docker
- 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