diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de0f895..32467f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,24 @@ jobs: build: runs-on: ubuntu-latest + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_DB: chess_api_test + POSTGRES_USER: app + POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }} + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + + env: + DATABASE_URL: postgresql://app:${{ secrets.DB_PASSWORD }}@127.0.0.1:5432/chess_api?serverVersion=16&charset=utf8 + steps: - uses: actions/checkout@v4 @@ -28,5 +46,11 @@ jobs: - name: Run PHPStan run: vendor/bin/phpstan analyse + - name: Create test database + run: php bin/console doctrine:database:create --env=test --no-interaction --if-not-exists + + - name: Run database migrations + run: php bin/console doctrine:migrations:migrate --no-interaction --env=test + - name: Run PHPUnit run: vendor/bin/phpunit \ No newline at end of file