diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86439c27..53394fd8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 \ @@ -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 }}) @@ -98,19 +98,20 @@ 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 @@ -118,13 +119,13 @@ jobs: 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 @@ -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 @@ -152,7 +153,7 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - + postgres: image: postgres:15-alpine env: @@ -164,7 +165,7 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - + strategy: matrix: database: @@ -172,11 +173,11 @@ jobs: - 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 @@ -184,13 +185,13 @@ jobs: 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: @@ -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: @@ -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: @@ -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 @@ -239,11 +240,11 @@ 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 @@ -251,13 +252,13 @@ jobs: 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 @@ -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 @@ -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 @@ -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: | diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 46344004..7c66c4c4 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -17,6 +17,7 @@ 'phpdoc_add_missing_param_annotation' => true, 'single_trait_insert_per_statement' => false ]) + ->setUnsupportedPhpVersionAllowed(true) ->setUsingCache(false) ->setFinder($finder) ; diff --git a/README.md b/README.md index 8e79fe4a..fa0d90a8 100644 --- a/README.md +++ b/README.md @@ -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_) @@ -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 @@ -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 @@ -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** @@ -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 @@ -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" @@ -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 @@ -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