From a3a8bd4a01ae43be5548f56e51dff338bb307d10 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Mon, 22 Apr 2019 21:57:10 -0700 Subject: [PATCH] Reworked SQL Server installer on Travis CI --- .travis.yml | 6 ++++++ tests/travis/install-mssql.sh | 24 ++------------------- tests/travis/install-sqlsrv-dependencies.sh | 10 +++++++++ 3 files changed, 18 insertions(+), 22 deletions(-) create mode 100644 tests/travis/install-sqlsrv-dependencies.sh diff --git a/.travis.yml b/.travis.yml index 6b1fd5913a1..e0d87665991 100644 --- a/.travis.yml +++ b/.travis.yml @@ -100,6 +100,7 @@ jobs: services: - docker before_script: + - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-sqlsrv.sh - bash ./tests/travis/install-mssql.sh - stage: Test @@ -109,6 +110,7 @@ jobs: services: - docker before_script: + - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-pdo_sqlsrv.sh - bash ./tests/travis/install-mssql.sh - stage: Test @@ -245,6 +247,7 @@ jobs: services: - docker before_script: + - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-sqlsrv.sh - bash ./tests/travis/install-mssql.sh - stage: Test @@ -254,6 +257,7 @@ jobs: services: - docker before_script: + - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-pdo_sqlsrv.sh - bash ./tests/travis/install-mssql.sh - stage: Test @@ -314,6 +318,7 @@ jobs: services: - docker before_script: + - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-sqlsrv.sh - bash ./tests/travis/install-mssql.sh - stage: Test @@ -323,6 +328,7 @@ jobs: services: - docker before_script: + - bash ./tests/travis/install-sqlsrv-dependencies.sh - bash ./tests/travis/install-mssql-pdo_sqlsrv.sh - bash ./tests/travis/install-mssql.sh diff --git a/tests/travis/install-mssql.sh b/tests/travis/install-mssql.sh index 7a28b10065f..e4ce49b2c4a 100644 --- a/tests/travis/install-mssql.sh +++ b/tests/travis/install-mssql.sh @@ -2,12 +2,6 @@ set -ex -echo Installing drivers -curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - -curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql.list -sudo apt-get update -ACCEPT_EULA=Y sudo apt-get install -qy msodbcsql17 mssql-tools unixodbc libssl1.0.0 - echo Setting up Microsoft SQL Server sudo docker pull microsoft/mssql-server-linux:2017-latest @@ -15,24 +9,10 @@ sudo docker run \ -e 'ACCEPT_EULA=Y' \ -e 'SA_PASSWORD=Doctrine2018' \ -p 127.0.0.1:1433:1433 \ - --name db \ + --name mssql \ -d \ microsoft/mssql-server-linux:2017-latest - -retries=10 -until (echo quit | /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -l 1 -U sa -P Doctrine2018 &> /dev/null) -do - if [[ "$retries" -le 0 ]]; then - echo SQL Server did not start - exit 1 - fi - - retries=$((retries - 1)) - - echo Waiting for SQL Server to start... - - sleep 2s -done +sudo docker exec -i mssql bash <<< 'until echo quit | /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -l 1 -U sa -P Doctrine2018 > /dev/null 2>&1 ; do sleep 1; done' echo SQL Server started diff --git a/tests/travis/install-sqlsrv-dependencies.sh b/tests/travis/install-sqlsrv-dependencies.sh new file mode 100644 index 00000000000..137b2a95705 --- /dev/null +++ b/tests/travis/install-sqlsrv-dependencies.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -ex + +echo Installing driver dependencies + +curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - +curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql.list +sudo apt-get update +ACCEPT_EULA=Y sudo apt-get install -qy msodbcsql17 unixodbc unixodbc-dev libssl1.0.0