He estado buscando durante mucho tiempo para probar en Travis mi aplicación symfony utilizando la extensión postgis.
He leído el Documentación de Travis para habilitar Postgis y mi .travis.yml
fue este:
# Project language (I use php)
language: php
# To start postgresql
services:
- postgresql
php:
# aliased to a recent 7.0.x version
- 7.1
# aliased to a nightly version
- nightly
# Matrix to test in every php version
matrix:
# Fast finish allows to set the build as "finished" even if the "allow_failures" matrix elements are not finished yet.
fast_finish: true
allow_failures:
- php: nightly
# Define an environment variable
env:
- SYMFONY_VERSION="3.3.*" DB=postgresql
# Update composer
before-install:
- composer self-update
before_script:
# Testing to reinstall it
- sudo apt-get install postgresql-9.6-postgis-2.3 postgis -y -q
# Parameters are copied
- cp app/config/parameters.yml.travis app/config/parameters.yml
# Database creation
- psql -c 'create database symfony;' -U postgres
# Postgis extension creation
- psql -U postgres -c "create extension postgis" -d symfony
# - psql -c 'CREATE EXTENSION postgis_topology;' -U postgres -d symfony
# excution de composer
- composer install
# Database migration to current version
- php bin/console doctrine:migrations:migrate --no-interaction
# loading data for phpunit and codecept tests
- php bin/console doctrine:fixtures:load --fixtures ./src/AppBundle/DataFixtures -n --env=test
script:
# Tests de versions
- psql --version
- psql -d symfony -c 'SELECT PostGIS_version();' -U postgres
# Phpunit
- if [ "$TRAVIS_PHP_VERSION" == "7.1" ]; then travis_wait 40 php vendor/phpunit/phpunit/phpunit --coverage-clover build/logs/clover.xml; fi
- if [ "$TRAVIS_PHP_VERSION" != "7.1" ]; then php vendor/phpunit/phpunit/phpunit; fi
Pero se ha producido un error al crear la extensión postgis. El error se produjo en esta línea:
$ psql -U postgres -c "create extension postgis" -d symfony
ERROR: no se ha podido acceder al archivo "$libdir/postgis-2.3": No such file or directory