-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
120 lines (107 loc) · 4.25 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
language: php
sudo: required
dist: trusty
cache:
directories:
- vendor
- $HOME/.composer/cache
before_install:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
before_script:
- if [[ "$SET_INNODB_CONF" == "yes" ]]; then echo -e "[server]\ninnodb_file_per_table=1\ninnodb_file_format=barracuda\ninnodb_large_prefix=1" | sudo tee -a /etc/mysql/my.cnf; sudo service mysql restart; fi;
# Create two test databases
- mysql -e "DROP DATABASE IF EXISTS openstore_test_utf8_compat;" -u root
- mysql -e "CREATE DATABASE openstore_test_utf8_compat;" -u root
- mysql -e "DROP DATABASE IF EXISTS openstore_test_utf8mb4;" -u root
- mysql -e "CREATE DATABASE openstore_test_utf8mb4;" -u root
- cp ./.travis/openstore-schema-core.config.travis.php ./config/openstore-schema-core.config.php
install:
- travis_retry composer -n install
script:
# Test 1.
# Build generated SQL and check they work by pushing them to the db
- composer build
# - Create a database from generated SQL (utf8)
- cat resources/sql/mysql-utf8-compat/create_schema_utf8_compat.sql | mysql -u root openstore_test_utf8_compat
- cat resources/sql/mysql-utf8-compat/create_schema_extra_utf8_compat.sql | mysql -u root openstore_test_utf8_compat
# - Create a database from generated SQL (utf8mb4)
- cat resources/sql/create_schema_utf8mb4.sql | mysql -u root openstore_test_utf8mb4
- cat resources/sql/create_schema_extra_utf8mb4.sql | mysql -u root openstore_test_utf8mb4
# Running a diff should not generate migrations (--dump-sql for debug it always return 0 exit code)
- php vendor/bin/doctrine orm:schema-tool:update --dump-sql
- php vendor/bin/doctrine orm:schema-tool:update
# Test 2.
# Recreate test database from doctrine
- mysql -e "DROP DATABASE IF EXISTS openstore_test_utf8mb4;" -u root
- mysql -e "CREATE DATABASE openstore_test_utf8mb4;" -u root
- php vendor/bin/doctrine orm:schema-tool:create
# Running a diff should not generate migrations (--dump-sql for debug it always return 0 exit code)
- php vendor/bin/doctrine orm:schema-tool:update --dump-sql
- php vendor/bin/doctrine orm:schema-tool:update
# Test 3.
# Adding a new entity should generate a new diff
- cp tests/entity/Question.php src/OpenstoreSchema/Core/Entity/Question.php
- php vendor/bin/doctrine orm:schema-tool:update --dump-sql
# Updating schema
- php vendor/bin/doctrine orm:schema-tool:update --force
# This one should not give new migrations (--dump-sql for debug it always return 0 exit code)
- php vendor/bin/doctrine orm:schema-tool:update --dump-sql
- php vendor/bin/doctrine orm:schema-tool:update
jobs:
include:
# PHP 7.1
- stage: Test
php: 7.1
env: MYSQL_VERSION=5.7 SET_INNODB_CONF=yes
sudo: required
- stage: Test
php: 7.1
env: MARIADB_VERSION=10.1 SET_INNODB_CONF=yes
addons:
mariadb: 10.1
- stage: Test
php: 7.1
env: MARIADB_VERSION=10.2 SET_INNODB_CONF=yes
addons:
mariadb: 10.2
# PHP 7.2
- stage: Test
php: 7.2
env: MYSQL_VERSION=5.7 SET_INNODB_CONF=yes
sudo: required
- stage: Test
php: 7.2
env: MARIADB_VERSION=10.1 SET_INNODB_CONF=yes
addons:
mariadb: 10.1
- stage: Test
php: 7.2
env: MARIADB_VERSION=10.2 SET_INNODB_CONF=yes
addons:
mariadb: 10.2
- stage: Test
php: 7.2
env: MARIADB_VERSION=10.3 SET_INNODB_CONF=no
addons:
mariadb: 10.3
# PHPstan
- stage: PHPStan
php: 7.2
script:
- vendor/bin/phpstan analyse -l max -c phpstan.neon src tests bin
# Coding standards
- stage: Coding standard
php: 7.2
script:
- ./vendor/bin/php-cs-fixer --diff --dry-run -v fix
# Coverage
- stage: Coverage
php: 7.2
before_script:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
script:
- ./vendor/bin/phpunit -v --coverage-clover coverage.xml
after_script:
#- wget https://scrutinizer-ci.com/ocular.phar
#- php ocular.phar code-coverage:upload --format=php-clover clover.xml