Skip to content

Commit 24adecc

Browse files
authored
Merge pull request #3050 from Majkl578/travis-mssql
Test SQL Server 17 on Travis
2 parents 9e68c3c + 150a55b commit 24adecc

File tree

6 files changed

+173
-0
lines changed

6 files changed

+173
-0
lines changed

.travis.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,43 @@ jobs:
277277
before_script:
278278
- bash ./tests/travis/install-postgres-10.sh
279279

280+
- stage: Test
281+
env: DB=sqlsrv
282+
sudo: required
283+
services:
284+
- docker
285+
before_script:
286+
- bash ./tests/travis/install-mssql-$DB.sh
287+
- bash ./tests/travis/install-mssql.sh
288+
- stage: Test
289+
php: 7.2
290+
env: DB=sqlsrv
291+
sudo: required
292+
services:
293+
- docker
294+
before_script:
295+
- bash ./tests/travis/install-mssql-$DB.sh
296+
- bash ./tests/travis/install-mssql.sh
297+
298+
- stage: Test
299+
php: 7.1
300+
env: DB=pdo_sqlsrv
301+
sudo: required
302+
services:
303+
- docker
304+
before_script:
305+
- bash ./tests/travis/install-mssql-$DB.sh
306+
- bash ./tests/travis/install-mssql.sh
307+
- stage: Test
308+
php: 7.2
309+
env: DB=pdo_sqlsrv
310+
sudo: required
311+
services:
312+
- docker
313+
before_script:
314+
- bash ./tests/travis/install-mssql-$DB.sh
315+
- bash ./tests/travis/install-mssql.sh
316+
280317
- stage: Test
281318
php: 7.1
282319
env: DB=sqlite DEPENDENCIES=low
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
echo "Installing extension"
6+
pecl install pdo_sqlsrv-5.2.0RC1

tests/travis/install-mssql-sqlsrv.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
echo "Installing extension"
6+
pecl install sqlsrv-5.2.0RC1

tests/travis/install-mssql.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
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+
11+
echo Setting up Microsoft SQL Server
12+
13+
sudo docker pull microsoft/mssql-server-linux:2017-latest
14+
sudo docker run \
15+
-e 'ACCEPT_EULA=Y' \
16+
-e 'SA_PASSWORD=Doctrine2018' \
17+
-p 127.0.0.1:1433:1433 \
18+
--name db \
19+
-d \
20+
microsoft/mssql-server-linux:2017-latest
21+
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
37+
38+
echo SQL Server started

tests/travis/pdo_sqlsrv.travis.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
4+
colors="true"
5+
verbose="true"
6+
beStrictAboutOutputDuringTests="true"
7+
beStrictAboutTodoAnnotatedTests="true"
8+
failOnRisky="true"
9+
>
10+
<php>
11+
<ini name="error_reporting" value="-1" />
12+
13+
<var name="db_type" value="pdo_sqlsrv"/>
14+
<var name="db_host" value="127.0.0.1" />
15+
<var name="db_username" value="sa" />
16+
<var name="db_password" value="Doctrine2018" />
17+
<var name="db_name" value="doctrine" />
18+
<var name="db_port" value="1433"/>
19+
20+
<var name="tmpdb_type" value="pdo_sqlsrv"/>
21+
<var name="tmpdb_host" value="127.0.0.1" />
22+
<var name="tmpdb_username" value="sa" />
23+
<var name="tmpdb_password" value="Doctrine2018" />
24+
<var name="tmpdb_port" value="1433"/>
25+
</php>
26+
27+
<testsuites>
28+
<testsuite name="Doctrine DBAL Test Suite">
29+
<directory>../Doctrine/Tests/DBAL</directory>
30+
</testsuite>
31+
</testsuites>
32+
33+
<listeners>
34+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
35+
</listeners>
36+
37+
<groups>
38+
<exclude>
39+
<group>performance</group>
40+
<group>locking_functional</group>
41+
</exclude>
42+
</groups>
43+
</phpunit>

tests/travis/sqlsrv.travis.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
4+
colors="true"
5+
verbose="true"
6+
beStrictAboutOutputDuringTests="true"
7+
beStrictAboutTodoAnnotatedTests="true"
8+
failOnRisky="true"
9+
>
10+
<php>
11+
<ini name="error_reporting" value="-1" />
12+
13+
<var name="db_type" value="sqlsrv"/>
14+
<var name="db_host" value="127.0.0.1" />
15+
<var name="db_username" value="sa" />
16+
<var name="db_password" value="Doctrine2018" />
17+
<var name="db_name" value="doctrine" />
18+
<var name="db_port" value="1433"/>
19+
20+
<var name="tmpdb_type" value="sqlsrv"/>
21+
<var name="tmpdb_host" value="127.0.0.1" />
22+
<var name="tmpdb_username" value="sa" />
23+
<var name="tmpdb_password" value="Doctrine2018" />
24+
<var name="tmpdb_port" value="1433"/>
25+
</php>
26+
27+
<testsuites>
28+
<testsuite name="Doctrine DBAL Test Suite">
29+
<directory>../Doctrine/Tests/DBAL</directory>
30+
</testsuite>
31+
</testsuites>
32+
33+
<listeners>
34+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
35+
</listeners>
36+
37+
<groups>
38+
<exclude>
39+
<group>performance</group>
40+
<group>locking_functional</group>
41+
</exclude>
42+
</groups>
43+
</phpunit>

0 commit comments

Comments
 (0)