forked from blackbeam/rust-mysql-simple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
207 lines (202 loc) · 7.89 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
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
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
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://root:[email protected]: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
sleep 5
/usr/local/Cellar/mysql/*/bin/mysql -e "SET GLOBAL max_allowed_packet = 36700160;" -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
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://[email protected]/mysql
displayName: Run tests
- job: "TestBasicWindows"
pool:
vmImage: "vs2017-win2016"
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
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"
v57:
DB_VERSION: "5.7"
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: |
docker run --rm --name container -v `pwd`:/root -p 3307:3306 -d -e MYSQL_ROOT_PASSWORD=password mysql:$(DB_VERSION) --max-allowed-packet=36700160 --local-infile
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 "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: |
if [[ "5.6" != "$(DB_VERSION)" ]]; then SSL=true; 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"
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:
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 \
--ssl \
--ssl-ca=/root/tests/ca-cert.pem \
--ssl-cert=/root/tests/server-cert.pem \
--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 "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"
env:
RUST_BACKTRACE: 1
DATABASE_URL: mysql://root:[email protected]/mysql
displayName: Run tests in Docker