Skip to content

fix test

fix test #26

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Symfony
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
symfony-tests:
runs-on: ubuntu-latest
services:
postgres:
# Docker Hub image
image: postgres:16.3-alpine
# Provide the password for postgres
env:
POSTGRES_USER: app_user
POSTGRES_PASSWORD: secret
POSTGRES_DB: app_db
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
# To automatically get bug fixes and new Php versions for shivammathur/setup-php,
# change this to (see https://github.com/shivammathur/setup-php#bookmark-versioning):
# uses: shivammathur/setup-php@v2
- uses: shivammathur/setup-php@2cb9b829437ee246e9b3cac53555a39208ca6d28
with:
php-version: '8.3'
- uses: actions/checkout@v4
- name: Copy .env.test.local
run: php -r "file_exists('.env.test.local') || copy('.env.test', '.env.test.local');"
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Install assets
run: |
php bin/console importmap:install
- name: Generate the SSL keys
run: |
php bin/console lexik:jwt:generate-keypair
- name: Create Database
env:
DATABASE_URL: postgresql://app_user:secret@localhost:5432/app_db
run: |
php bin/console doctrine:migrations:migrate --no-interaction --env=test
php bin/console doctrine:fixtures:load --no-interaction --env=test
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DATABASE_URL: postgresql://app_user:secret@localhost:5432/app_db
run: vendor/bin/phpunit