Skip to content

Commit

Permalink
Merge pull request #3528 from morozov/travis-sqlsrv
Browse files Browse the repository at this point in the history
Reworked SQL Server installer on Travis CI
  • Loading branch information
morozov authored Apr 23, 2019
2 parents 2124cd7 + a3a8bd4 commit 945b271
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
24 changes: 2 additions & 22 deletions tests/travis/install-mssql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,17 @@

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
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
10 changes: 10 additions & 0 deletions tests/travis/install-sqlsrv-dependencies.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 945b271

Please sign in to comment.