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:root@127.0.0.1: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:password@127.0.0.1/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:password@127.0.0.1/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:password@127.0.0.1/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:password@127.0.0.1/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://root@127.0.0.1:4000/mysql