diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5f188e66..bb0c693e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,7 +45,7 @@ jobs: mysql: image: mysql:5.7 env: - MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: acme ports: - 3306:3306 @@ -112,6 +112,9 @@ jobs: - name: Show Composer dependencies run: composer show + - name: Set up hosts file + run: echo '127.0.0.1 mariadb postgres' | sudo tee -a /etc/hosts + - name: Run tests # In phpunit.xml.dist, tests annotated with "@group mysql" are excluded, revert this # Run tests twice to ensure that tests are idempotent even if database caching is enabled diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b210a2c5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM php:8.3-fpm +WORKDIR "/application" + +RUN apt-get update \ + && apt-get -y --no-install-recommends install \ + libpq-dev \ + libsqlite3-dev \ + unzip \ + wget \ + default-mysql-client \ + && docker-php-ext-install \ + pdo_mysql \ + pdo_pgsql \ + pdo_sqlite \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* + +COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer diff --git a/README.md b/README.md index 82bb11fc..a23edc9e 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,4 @@ Documentation * [Events](doc/events.md) * [Examples](doc/examples.md) * [Caveats](doc/caveats.md) +* [Contributing](doc/contributing.md) diff --git a/doc/contributing.md b/doc/contributing.md new file mode 100644 index 00000000..35467ad2 --- /dev/null +++ b/doc/contributing.md @@ -0,0 +1,25 @@ +# Contributing +This is for people who want to contribute to the project. + +## How to get started + +First of all, you need to fork the repository and clone it locally. +After that, we've prepared a docker setup to help you get started quickly. + +Install docker and docker-compose on your machine, then run the following commands: + +```bash +docker-compose up --detach +``` + +Install the dependencies with composer: + +```bash +docker-compose exec php-fpm composer install +``` + +Now you can execute the tests with the following command: + +```bash +docker-compose exec php-fpm ./vendor/bin/phpunit --exclude-group "" +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..665919c7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,31 @@ +version: '3.1' +services: + mariadb: + image: 'mariadb:11.0' + working_dir: /application + volumes: + - '.:/application' + environment: + - MYSQL_ROOT_PASSWORD=root + - MYSQL_DATABASE=acme + ports: + - '11003:3306' + + postgres: + image: 'postgres:15-alpine' + working_dir: /application + volumes: + - '.:/application' + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=postgres + - POSTGRES_HOST=postgres + ports: + - '11004:5432' + + php-fpm: + build: . + working_dir: /application + volumes: + - '.:/application' diff --git a/tests/AppConfigMysql/config.yml b/tests/AppConfigMysql/config.yml index be87d3a9..21b15610 100644 --- a/tests/AppConfigMysql/config.yml +++ b/tests/AppConfigMysql/config.yml @@ -3,8 +3,8 @@ doctrine: dbal: driver: pdo_mysql - host: 127.0.0.1 - port: null + host: mariadb + port: 3306 dbname: acme user: root - password: "" + password: root diff --git a/tests/AppConfigMysqlUrl/config.yml b/tests/AppConfigMysqlUrl/config.yml index 0cf71ad6..2cbdd85f 100644 --- a/tests/AppConfigMysqlUrl/config.yml +++ b/tests/AppConfigMysqlUrl/config.yml @@ -2,5 +2,5 @@ doctrine: dbal: - url: 'mysql://root:@127.0.0.1:3306/foobar' + url: 'mysql://root:root@mariadb:3306/foobar' driver: pdo_mysql diff --git a/tests/AppConfigPgsql/config.yml b/tests/AppConfigPgsql/config.yml index 5ba4103f..21e362dc 100644 --- a/tests/AppConfigPgsql/config.yml +++ b/tests/AppConfigPgsql/config.yml @@ -3,7 +3,7 @@ doctrine: dbal: driver: pdo_pgsql - host: 127.0.0.1 + host: postgres port: 5432 dbname: postgres user: postgres