Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 40 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Lint with Hadolint
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: ${{ matrix.dockerfile }}
failure-threshold: warning

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Validate Dockerfile syntax
run: |
docker buildx build \
Expand All @@ -47,32 +47,32 @@ jobs:
name: Analyze
runs-on: ubuntu-latest
container:
image: php:8.3-alpine
image: php:8.4-alpine
options: >-
--tmpfs /tmp:exec
--tmpfs /var/tmp:exec
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install GD / ZIP PHP extension
run: |
apk add $PHPIZE_DEPS libpng-dev libzip-dev
docker-php-ext-configure gd
docker-php-ext-configure zip
docker-php-ext-install gd zip

- name: Install Composer
run: wget -qO - https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet

- name: Validate Composer
run: composer validate

- name: Update to highest dependencies with Composer
run: composer update --no-interaction --no-progress --ansi
run: composer install --no-interaction --no-progress --ansi

- name: Analyze
run: PHP_CS_FIXER_IGNORE_ENV=True vendor/bin/php-cs-fixer fix --ansi
run: vendor/bin/php-cs-fixer fix --ansi

phpunit:
name: PHPUnit (PHP ${{ matrix.php }})
Expand All @@ -98,33 +98,34 @@ jobs:
--health-retries 5
ports:
- 3306:3306

strategy:
matrix:
php:
- '8.2'
- '8.3'
- '8.4'
- '8.5'
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install MySQL / GD / ZIP PHP extensions
run: |
apk add $PHPIZE_DEPS icu-libs icu-dev libpng-dev libzip-dev
docker-php-ext-configure intl
docker-php-ext-configure gd
docker-php-ext-configure zip
docker-php-ext-install pdo pdo_mysql intl gd zip

- name: Install Composer
run: wget -qO - https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet

- name: Install dependencies with Composer
run: composer install --no-progress --no-interaction --ansi

- name: Run tests with PHPUnit
env:
DATABASE_URL: mysql://davis:davis@mysql:3306/davis_test
Expand All @@ -134,11 +135,11 @@ jobs:
name: Migrations (${{ matrix.database }})
runs-on: ubuntu-latest
container:
image: php:8.3-alpine
image: php:8.4-alpine
options: >-
--tmpfs /tmp:exec
--tmpfs /var/tmp:exec

services:
mysql:
image: mariadb:10.11
Expand All @@ -152,7 +153,7 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5

postgres:
image: postgres:15-alpine
env:
Expand All @@ -164,33 +165,33 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5

strategy:
matrix:
database:
- mysql
- postgresql
- sqlite
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install database extensions
run: |
apk add $PHPIZE_DEPS icu-libs icu-dev libpng-dev libzip-dev postgresql-dev sqlite-dev
docker-php-ext-configure intl
docker-php-ext-configure gd
docker-php-ext-configure zip
docker-php-ext-install pdo pdo_mysql pdo_pgsql pdo_sqlite intl gd zip

- name: Install Composer
run: wget -qO - https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet

- name: Install dependencies with Composer
run: composer install --no-progress --no-interaction --ansi

- name: Run migrations (MySQL)
if: matrix.database == 'mysql'
env:
Expand All @@ -199,7 +200,7 @@ jobs:
php bin/console doctrine:database:create --if-not-exists --env=test
php bin/console doctrine:migrations:migrate --no-interaction --env=test
php bin/console doctrine:schema:validate --env=test

- name: Run migrations (PostgreSQL)
if: matrix.database == 'postgresql'
env:
Expand All @@ -208,7 +209,7 @@ jobs:
php bin/console doctrine:database:create --if-not-exists --env=test
php bin/console doctrine:migrations:migrate --no-interaction --env=test
php bin/console doctrine:schema:validate --skip-sync --env=test

- name: Run migrations (SQLite)
if: matrix.database == 'sqlite'
env:
Expand All @@ -221,11 +222,11 @@ jobs:
name: Application Smoke Test
runs-on: ubuntu-latest
container:
image: php:8.3-alpine
image: php:8.4-alpine
options: >-
--tmpfs /tmp:exec
--tmpfs /var/tmp:exec

services:
mysql:
image: mariadb:10.11
Expand All @@ -239,25 +240,25 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install extensions and curl
run: |
apk add $PHPIZE_DEPS icu-libs icu-dev libpng-dev libzip-dev curl
docker-php-ext-configure intl
docker-php-ext-configure gd
docker-php-ext-configure zip
docker-php-ext-install pdo pdo_mysql intl gd zip

- name: Install Composer
run: wget -qO - https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet

- name: Install dependencies with Composer
run: composer install --no-progress --no-interaction --ansi --optimize-autoloader

- name: Prepare application
env:
DATABASE_URL: mysql://davis:davis@mysql:3306/davis_test
Expand All @@ -266,7 +267,7 @@ jobs:
php bin/console doctrine:database:create --if-not-exists --env=test
php bin/console doctrine:migrations:migrate --no-interaction --env=test
php bin/console cache:clear --env=test

- name: Start Symfony server in background
env:
DATABASE_URL: mysql://davis:davis@mysql:3306/davis_test
Expand All @@ -275,7 +276,7 @@ jobs:
php -S 127.0.0.1:8000 -t public/ &
echo $! > server.pid
sleep 3

- name: Test application responds
run: |
# Test that the app responds with a successful HTTP status
Expand All @@ -287,12 +288,12 @@ jobs:
echo "❌ Application returned unexpected status code: $RESPONSE"
exit 1
fi

- name: Test dashboard
continue-on-error: true
run: |
curl -f http://127.0.0.1:8000/dashboard || echo "No health endpoint available"

- name: Stop server
if: always()
run: |
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'phpdoc_add_missing_param_annotation' => true,
'single_trait_insert_per_statement' => false
])
->setUnsupportedPhpVersionAllowed(true)
->setUsingCache(false)
->setFinder($finder)
;
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Comes with already built Docker images in two flavours: [standalone](https://git

# 🔩 Requirements

- PHP > 8.2 (with `pdo_mysql` [or `pdo_pgsql`, `pdo_sqlite`], `gd` and `intl` extensions), compatible up to PHP 8.3 (_See dependencies table below_)
- PHP > 8.2 (with `pdo_mysql` [or `pdo_pgsql`, `pdo_sqlite`], `gd` and `intl` extensions), compatible up to PHP 8.5 (_See dependencies table below_)
- A compatible database layer, such as MySQL or MariaDB (recommended), PostgreSQL (not extensively tested yet) or SQLite (not extensively tested yet)
- Composer > 2 (_The last release compatible with Composer 1 is [v1.6.2](https://github.com/tchapi/davis/releases/tag/v1.6.2)_)
- The [`imap`](https://www.php.net/manual/en/imap.installation.php) and [`ldap`](https://www.php.net/manual/en/ldap.installation.php) PHP extensions if you want to use either authentication methods (_these are not enabled / compiled by default except in the Docker image_)
Expand Down Expand Up @@ -112,7 +112,7 @@ Create your own `.env.local` file to change the necessary variables, if you plan
> In a production environnement, the `APP_ENV` variable MUST be set to `prod` to prevent leaking sensitive data.

**a. The database driver and url** (_you should already have it configured since you created the database previously_)

```shell
DATABASE_DRIVER=mysql # or postgresql, or sqlite
DATABASE_URL=mysql://db_user:db_pass@host:3306/db_name?serverVersion=10.9.3-MariaDB&charset=utf8mb4
Expand Down Expand Up @@ -155,7 +155,7 @@ PUBLIC_CALENDARS_ENABLED=true
**e. Mailer configuration**

It includes:
- the mailer uri (`MAILER_DSN`)
- the mailer uri (`MAILER_DSN`)
- The email address that your invites are going to be sent from

```shell
Expand Down Expand Up @@ -225,7 +225,7 @@ APP_TIMEZONE=Australia/Lord_Howe
> ```shell
> APP_TIMEZONE=
> ```
> in your environment file if you wish to use the **actual default timezone of the server**, and not enforcing it.
> in your environment file if you wish to use the **actual default timezone of the server**, and not enforcing it.

**j. Trusting forwarded headers**

Expand Down Expand Up @@ -466,7 +466,7 @@ To build the checked out version, just run:
docker build --pull --file docker/Dockerfile --tag davis:latest --build-arg fpm_user=82:82 .

> [!TIP]
>
>
> The `fpm_user` build arg allows to set:
> - the uid FPM will run with
> - the owner of the app folder
Expand All @@ -479,7 +479,7 @@ This will build a `davis:latest` image that you can directly use. Do not forget
You can use `--platform` to specify the platform to build for. Currently, `arm64` (ARMv8) and `amd64` (x86) are supported.

> [!IMPORTANT]
>
>
> ⚠ Do not forget to run all the database migrations the first time you run the container :
>
> docker exec -it davis sh -c "APP_ENV=prod bin/console doctrine:migrations:migrate --no-interaction"
Expand Down Expand Up @@ -509,7 +509,7 @@ docker pull ghcr.io/tchapi/davis:edge
```

> [!WARNING]
>
>
> The `edge` image must not be considered stable. **Use only release images for production setups**.

## Full stack
Expand All @@ -525,13 +525,13 @@ You can start the containers with :
> The default recipe above uses MariaDB.

> [!IMPORTANT]
>
>
> ⚠ Do not forget to run all the database migrations the first time you run the container :
>
> docker exec -it davis sh -c "APP_ENV=prod bin/console doctrine:migrations:migrate --no-interaction"

> [!WARNING]
>
>
> For SQLite, you must also make sure that the folder the database will reside in AND the database file in itself have the right permissions! You can do for instance:
> `chown -R www-data: /data` if `/data` is the folder your SQLite database will be in, just after you have run the migrations

Expand Down