Skip to content

Commit

Permalink
Merge branch 'feat/php-8.0' into feat/php-8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
xvilo committed Jul 10, 2023
2 parents 1ccba4f + 0bf712e commit c204b7d
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 690 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/phpunit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Ci suite
on: [push, pull_request]
jobs:
symfony:
name: PHPUnit tests (PHP ${{ matrix.php-version }} - Postgres ${{ matrix.postgres-version }})
runs-on: ubuntu-latest

# Docs: https://docs.github.com/en/actions/using-containerized-services
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432/tcp
options: --health-cmd pg_isready --health-interval 1s --health-timeout 3s --health-retries 3
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0']
postgres-version: ['11.20-alpine', '13.11-alpine', '15.3-alpine']
steps:
- name: Checkout
uses: actions/checkout@v3

# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: phpunit-bridge
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, pgsql
coverage: xdebug

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

# Without this step `git add .` command will result in exit code 128.
# This ensures the comitter info is set, for now prefil with some exiting
# variables in GitHub actions.

- name: Set committer info
id: committer-info
run: |
git config --global user.email ${GITHUB_ACTOR_ID}[email protected]
git config --global user.name $GITHUB_ACTOR
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Run Migration
run: |
php bin/console doctrine:migrations:migrate
php bin/console messenger:setup-transports
env:
DATABASE_URL: postgres://postgres:[email protected]:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8

- name: Run tests
run: php vendor/bin/phpunit --coverage-text
env:
DATABASE_URL: postgres://postgres:[email protected]:${{ job.services.postgres.ports[5432] }}/postgres?charset=UTF-8
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@
"bin/console lint:twig templates --show-deprecations",
"rm -rf var/cache/prod",
"bin/console cache:warmup --env=prod"
]
],
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
}
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ x-restart-policy: &restart_policy
services:
database:
<< : *restart_policy
image: postgres:11.7-alpine
image: postgres:11.20-alpine
logging:
driver: none
environment:
Expand Down
Loading

0 comments on commit c204b7d

Please sign in to comment.