Skip to content

Commit

Permalink
[minor] run test suite on PostgreSQL (#51)
Browse files Browse the repository at this point in the history
Does not run with DAMADoctrineTestBundle enabled
  • Loading branch information
kbond authored Oct 29, 2020
1 parent 8db03c8 commit 77a3583
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 1 deletion.
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ jobs:
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 1234
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
matrix:
php: [7.2, 7.3, 7.4]
Expand All @@ -33,6 +41,7 @@ jobs:
uses: shivammathur/setup-php@2.7.0
with:
php-version: ${{ matrix.php }}
extensions: pgsql
coverage: none

- name: Cache dependencies
Expand Down Expand Up @@ -66,6 +75,28 @@ jobs:
USE_FOUNDRY_BUNDLE: 1
DATABASE_URL: mysql://root:1234@127.0.0.1:3306/zenstruck_foundry?serverVersion=5.7

- name: 'Test: PostgreSQL'
run: vendor/bin/phpunit -v
env:
DATABASE_URL: postgresql://postgres:1234@127.0.0.1:5432/zenstruck_foundry?charset=utf8

- name: 'Test: PostgreSQL, FoundryBundle'
run: vendor/bin/phpunit -v
env:
USE_FOUNDRY_BUNDLE: 1
DATABASE_URL: postgresql://postgres:1234@127.0.0.1:5432/zenstruck_foundry?charset=utf8

# - name: 'Test: PostgreSQL, DAMABundle'
# run: vendor/bin/phpunit -v --configuration phpunit-dama-doctrine.xml.dist
# env:
# DATABASE_URL: postgresql://postgres:1234@127.0.0.1:5432/zenstruck_foundry?charset=utf8

# - name: 'Test: PostgreSQL, FoundryBundle, DAMABundle'
# run: vendor/bin/phpunit -v --configuration phpunit-dama-doctrine.xml.dist
# env:
# USE_FOUNDRY_BUNDLE: 1
# DATABASE_URL: postgresql://postgres:1234@127.0.0.1:5432/zenstruck_foundry?charset=utf8

- name: 'Test: SQLite'
run: vendor/bin/phpunit -v
env:
Expand Down Expand Up @@ -99,6 +130,14 @@ jobs:
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 1234
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v2.3.3
Expand All @@ -110,6 +149,7 @@ jobs:
uses: shivammathur/setup-php@2.7.0
with:
php-version: 7.4
extensions: pgsql
coverage: xdebug

- name: Cache dependencies
Expand Down Expand Up @@ -143,6 +183,28 @@ jobs:
USE_FOUNDRY_BUNDLE: 1
DATABASE_URL: mysql://root:1234@127.0.0.1:3306/zenstruck_foundry?serverVersion=5.7

- name: 'Coverage: PostgreSQL'
run: vendor/bin/phpunit -v --coverage-text --coverage-clover=postgres.clover
env:
DATABASE_URL: postgresql://postgres:1234@127.0.0.1:5432/zenstruck_foundry?charset=utf8

- name: 'Coverage: PostgreSQL, FoundryBundle'
run: vendor/bin/phpunit -v --coverage-text --coverage-clover=postgres-foundry.clover
env:
USE_FOUNDRY_BUNDLE: 1
DATABASE_URL: postgresql://postgres:1234@127.0.0.1:5432/zenstruck_foundry?charset=utf8

# - name: 'Coverage: PostgreSQL, DAMABundle'
# run: vendor/bin/phpunit -v --coverage-text --coverage-clover=postgres-dama.clover --configuration phpunit-dama-doctrine.xml.dist
# env:
# DATABASE_URL: postgresql://postgres:1234@127.0.0.1:5432/zenstruck_foundry?charset=utf8

# - name: 'Coverage: PostgreSQL, FoundryBundle, DAMABundle'
# run: vendor/bin/phpunit -v --coverage-text --coverage-clover=postgres-foundry-dama.clover --configuration phpunit-dama-doctrine.xml.dist
# env:
# USE_FOUNDRY_BUNDLE: 1
# DATABASE_URL: postgresql://postgres:1234@127.0.0.1:5432/zenstruck_foundry?charset=utf8

- name: 'Coverage: SQLite'
run: vendor/bin/phpunit -v --coverage-text --coverage-clover=sqlite.clover
env:
Expand Down Expand Up @@ -172,6 +234,8 @@ jobs:
php ocular.phar code-coverage:upload --format=php-clover mysql-foundry.clover
php ocular.phar code-coverage:upload --format=php-clover mysql-dama.clover
php ocular.phar code-coverage:upload --format=php-clover mysql-foundry-dama.clover
php ocular.phar code-coverage:upload --format=php-clover postgres.clover
php ocular.phar code-coverage:upload --format=php-clover postgres-foundry.clover
php ocular.phar code-coverage:upload --format=php-clover sqlite.clover
php ocular.phar code-coverage:upload --format=php-clover sqlite-foundry.clover
php ocular.phar code-coverage:upload --format=php-clover sqlite-dama.clover
Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ checks:
tools:
external_code_coverage:
timeout: 900
runs: 8
runs: 10
build:
nodes:
analysis:
Expand Down
1 change: 1 addition & 0 deletions tests/Fixtures/Entity/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

/**
* @ORM\Entity
* @ORM\Table(name="categories")
*/
class Category
{
Expand Down
1 change: 1 addition & 0 deletions tests/Fixtures/Entity/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/**
* @ORM\Entity
* @ORM\Table(name="comments")
*/
class Comment
{
Expand Down
1 change: 1 addition & 0 deletions tests/Fixtures/Entity/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

/**
* @ORM\Entity(repositoryClass="Zenstruck\Foundry\Tests\Fixtures\Repository\PostRepository")
* @ORM\Table(name="posts")
*/
class Post
{
Expand Down
1 change: 1 addition & 0 deletions tests/Fixtures/Entity/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

/**
* @ORM\Entity
* @ORM\Table(name="tags")
*/
class Tag
{
Expand Down
1 change: 1 addition & 0 deletions tests/Fixtures/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/**
* @ORM\Entity
* @ORM\Table(name="users")
*/
class User
{
Expand Down

0 comments on commit 77a3583

Please sign in to comment.