-
Notifications
You must be signed in to change notification settings - Fork 54
55 lines (55 loc) · 2.29 KB
/
postgres.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
name: Testing with PostgreSQL
on: [push, pull_request]
jobs:
symfony:
name: Symfony (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432/tcp
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
strategy:
fail-fast: false
matrix:
php-versions: ['8.1', '8.2']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, gd, iconv, intl, pdo_sqlite, pgsql
coverage: xdebug #optional
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: |
composer update symfony/flex --no-plugins --no-scripts
composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run Migration
run: |
php bin/console doctrine:database:create --if-not-exists --no-interaction
php bin/console doctrine:migrations:migrate --no-interaction || php bin/console doctrine:migrations:version --add --all -n
php bin/console make:migration -n
php bin/console doctrine:migrations:migrate --no-interaction
php bin/console doctrine:fixtures:load --no-interaction
env:
DATABASE_URL: postgres://postgres:[email protected]:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
- name: Run Tests
env:
DATABASE_URL: postgres://postgres:[email protected]:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
run: php bin/phpunit --testsuite=main