Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Commit 96bc4bf

Browse files
authored
Add GitHub actions for CI (#12)
1 parent e58c0dc commit 96bc4bf

File tree

6 files changed

+38
-9
lines changed

6 files changed

+38
-9
lines changed

.env

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ APP_SECRET=29ac4a5187930cd4b689aa0f3ee7cbc0
88
#--------------------------------#
99
# MySql
1010
MOOC_DATABASE_DRIVER=pdo_mysql
11-
MOOC_DATABASE_HOST=localhost
11+
MOOC_DATABASE_HOST=codelytv-php_ddd_skeleton-mooc-mysql
1212
MOOC_DATABASE_PORT=3306
1313
MOOC_DATABASE_NAME=mooc
1414
MOOC_DATABASE_USER=root
@@ -18,7 +18,7 @@ MOOC_DATABASE_PASSWORD=
1818
#--------------------------------#
1919
# MySql
2020
BACKOFFICE_DATABASE_DRIVER=pdo_mysql
21-
BACKOFFICE_DATABASE_HOST=localhost
21+
BACKOFFICE_DATABASE_HOST=codelytv-php_ddd_skeleton-mooc-mysql
2222
BACKOFFICE_DATABASE_PORT=3306
2323
BACKOFFICE_DATABASE_NAME=mooc
2424
BACKOFFICE_DATABASE_USER=root

.github/workflows/ci.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v1
12+
13+
- name: Install dependencies
14+
run: make composer-install
15+
16+
- name: Start all the environment
17+
run: make start
18+
19+
- name: Wait for the environment to get up
20+
run: |
21+
while ! docker exec codelytv-php_ddd_skeleton-mooc-mysql mysqladmin --user=root --password= --host "127.0.0.1" ping --silent &> /dev/null ; do
22+
echo "Waiting for database connection..."
23+
sleep 2
24+
done
25+
26+
- name: Run the tests
27+
run: make test

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88

99
/vendor/
1010
.phpunit.result.cache
11+
12+
/build

Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ deps: composer-install
1010
composer-install: CMD=install
1111
composer-update: CMD=update
1212
composer composer-install composer-update:
13-
@docker run --rm --interactive --tty --volume $(current-dir):/app --user $(id -u):$(id -g) \
13+
@docker run --rm --interactive --volume $(current-dir):/app --user $(id -u):$(id -g) \
1414
clevyr/prestissimo $(CMD) \
1515
--ignore-platform-reqs \
1616
--no-ansi \
@@ -21,11 +21,10 @@ reload:
2121
@docker-compose exec nginx nginx -s reload
2222

2323
test:
24-
@docker exec -it codelytv-cqrs_ddd_php_example-php make run-tests
24+
@docker exec codelytv-php_ddd_skeleton-php make run-tests
2525

2626
run-tests:
2727
mkdir -p build/test_results/phpunit
28-
./vendor/bin/phpstan analyse -l 7 -c etc/phpstan/phpstan.neon applications/mooc_backend/src
2928
./vendor/bin/phpunit --exclude-group='disabled' --log-junit build/test_results/phpunit/junit.xml tests
3029
./vendor/bin/behat -p mooc_backend --format=progress -v
3130

etc/infrastructure/php/php.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
date.timezone = "UTC"
22
html_errors = "On"
33
display_errors = "On"
4-
error_reporting = E_ALL
4+
error_reporting = E_ALL

tests/src/Backoffice/Courses/BackofficeCoursesModuleInfrastructureTestCase.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
namespace CodelyTv\Tests\Backoffice\Courses;
66

7-
use CodelyTv\Backoffice\Courses\Domain\BackofficeCourseRepository;
7+
use CodelyTv\Backoffice\Courses\Infrastructure\Persistence\MySqlBackofficeCourseRepository;
88
use CodelyTv\Tests\Mooc\Shared\Infrastructure\PhpUnit\MoocContextInfrastructureTestCase;
9+
use Doctrine\ORM\EntityManager;
910

1011
abstract class BackofficeCoursesModuleInfrastructureTestCase extends MoocContextInfrastructureTestCase
1112
{
12-
protected function repository(): BackofficeCourseRepository
13+
protected function repository(): MySqlBackofficeCourseRepository
1314
{
14-
return $this->service(BackofficeCourseRepository::class);
15+
return new MySqlBackofficeCourseRepository($this->service(EntityManager::class));
1516
}
1617
}

0 commit comments

Comments
 (0)