Skip to content

Commit 945b271

Browse files
authored
Merge pull request #3528 from morozov/travis-sqlsrv
Reworked SQL Server installer on Travis CI
2 parents 2124cd7 + a3a8bd4 commit 945b271

File tree

3 files changed

+18
-22
lines changed

3 files changed

+18
-22
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ jobs:
100100
services:
101101
- docker
102102
before_script:
103+
- bash ./tests/travis/install-sqlsrv-dependencies.sh
103104
- bash ./tests/travis/install-mssql-sqlsrv.sh
104105
- bash ./tests/travis/install-mssql.sh
105106
- stage: Test
@@ -109,6 +110,7 @@ jobs:
109110
services:
110111
- docker
111112
before_script:
113+
- bash ./tests/travis/install-sqlsrv-dependencies.sh
112114
- bash ./tests/travis/install-mssql-pdo_sqlsrv.sh
113115
- bash ./tests/travis/install-mssql.sh
114116
- stage: Test
@@ -245,6 +247,7 @@ jobs:
245247
services:
246248
- docker
247249
before_script:
250+
- bash ./tests/travis/install-sqlsrv-dependencies.sh
248251
- bash ./tests/travis/install-mssql-sqlsrv.sh
249252
- bash ./tests/travis/install-mssql.sh
250253
- stage: Test
@@ -254,6 +257,7 @@ jobs:
254257
services:
255258
- docker
256259
before_script:
260+
- bash ./tests/travis/install-sqlsrv-dependencies.sh
257261
- bash ./tests/travis/install-mssql-pdo_sqlsrv.sh
258262
- bash ./tests/travis/install-mssql.sh
259263
- stage: Test
@@ -314,6 +318,7 @@ jobs:
314318
services:
315319
- docker
316320
before_script:
321+
- bash ./tests/travis/install-sqlsrv-dependencies.sh
317322
- bash ./tests/travis/install-mssql-sqlsrv.sh
318323
- bash ./tests/travis/install-mssql.sh
319324
- stage: Test
@@ -323,6 +328,7 @@ jobs:
323328
services:
324329
- docker
325330
before_script:
331+
- bash ./tests/travis/install-sqlsrv-dependencies.sh
326332
- bash ./tests/travis/install-mssql-pdo_sqlsrv.sh
327333
- bash ./tests/travis/install-mssql.sh
328334

tests/travis/install-mssql.sh

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,17 @@
22

33
set -ex
44

5-
echo Installing drivers
6-
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
7-
curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql.list
8-
sudo apt-get update
9-
ACCEPT_EULA=Y sudo apt-get install -qy msodbcsql17 mssql-tools unixodbc libssl1.0.0
10-
115
echo Setting up Microsoft SQL Server
126

137
sudo docker pull microsoft/mssql-server-linux:2017-latest
148
sudo docker run \
159
-e 'ACCEPT_EULA=Y' \
1610
-e 'SA_PASSWORD=Doctrine2018' \
1711
-p 127.0.0.1:1433:1433 \
18-
--name db \
12+
--name mssql \
1913
-d \
2014
microsoft/mssql-server-linux:2017-latest
2115

22-
23-
retries=10
24-
until (echo quit | /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -l 1 -U sa -P Doctrine2018 &> /dev/null)
25-
do
26-
if [[ "$retries" -le 0 ]]; then
27-
echo SQL Server did not start
28-
exit 1
29-
fi
30-
31-
retries=$((retries - 1))
32-
33-
echo Waiting for SQL Server to start...
34-
35-
sleep 2s
36-
done
16+
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'
3717

3818
echo SQL Server started
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
echo Installing driver dependencies
6+
7+
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
8+
curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql.list
9+
sudo apt-get update
10+
ACCEPT_EULA=Y sudo apt-get install -qy msodbcsql17 unixodbc unixodbc-dev libssl1.0.0

0 commit comments

Comments
 (0)