chilio/laravel-dusk-ci

Laravel 11

Closed this issue · 8 comments

Hi there,

Are you planning on release a new version for laravel 11?

By the way, thanks for this repo!

I have done some digging and change a bit for my reality:
https://github.com/diogobratti/laravel-dusk-ci/tree/php-8.3-laravel-11

I pushed into my fork project because I was not able to PR into yours. Actually, I have never done it on open source projects.
It is important to mention that I change from debian to ubuntu:noble.
I also (in another project) included oci8 to read Oracle databases. I can push as well if you want.

@diogobratti there are php 8.3 versions already as in the docs.
As per requirements Laravel 11 needs at least php 8.2.
Is there anything not working with your Laravel 11 installation?

@diogobratti there are php 8.3 versions already as in the docs. As per requirements Laravel 11 needs at least php 8.2. Is there anything not working with your Laravel 11 installation?

You are right. I was based on compability table that does not show Laravel 11. I could've tested which I haven't did much.
As I have some problems installing oci8 I have decided upgrade to ubuntu:noble. Later, I realize it would matter a thing.

@chilio There actually is an incompatibility with Laravel 11 right now: the sqlite minimum has been raised to 3.35.0 (https://laravel.com/docs/11.x/upgrade#sqlite-minimum-version), and as far as I can tell, this image is using 3.31.1

I've tried using apt-get install-y sqlite3 to update sqlite to no avail, does anyone more conversant with this side of things know a workaround?

@tentus @diogobratti I can confirm Laravel 11 works with php-8.3 image and mysql:latest. So far I didn't try sqlite, but you can enable any docker image you want in your .yml. Therefore it should work out of the box if you choose the right one. The only needed workaround for now is to call php artisan dusk:installbefore configure-laravel

I may be misunderstanding something here. As far as I can tell, this docker image uses ubuntu:focal for both the 8.2 and 8.3 branches, and https://packages.ubuntu.com/focal/sqlite3 seems to indicate to me that the version of sqlite available on focal is 3.31.1

It seems like the fix would be to bump this repo to use ubuntu:jammy, but I'm not aware of a way to do that from the yml file?

@tentus I think what @chilio is trying to say is that you can "sail up" a sqlite container. For example, mine is with MySQL and something like this:

# For more information: https://laravel.com/docs/sail
version: '3'
services:
    laravel.test:
        build:
            context: ./docker/8.3
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.1/app
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        ports:
            - '${APP_PORT:-80}:80'
        environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
        volumes:
            - '.:/var/www/html'
        networks:
            - sail
        depends_on:
            - mysql
            - selenium
    mysql:
        image: 'mysql/mysql-server:8.0'
        ports:
            - '${FORWARD_DB_PORT:-3306}:3306'
        environment:
            MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
            MYSQL_ROOT_HOST: "%"
            MYSQL_DATABASE: '${DB_DATABASE}'
            MYSQL_USER: '${DB_USERNAME}'
            MYSQL_PASSWORD: '${DB_PASSWORD}'
            MYSQL_ALLOW_EMPTY_PASSWORD: 1
            TZ: 'America/Sao_Paulo'
        volumes:
            - 'sail-mysql:/var/lib/mysql'
            - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
        networks:
            - sail
        healthcheck:
            test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
            retries: 3
            timeout: 5s
    mailhog:
        image: 'mailhog/mailhog:latest'
        ports:
            - '${FORWARD_MAILHOG_PORT:-1025}:1025'
            - '${FORWARD_MAILHOG_DASHBOARD_PORT:-8025}:8025'
        networks:
            - sail
    selenium:
        image: 'selenium/standalone-chrome'
        environment:
            VNC_NO_PASSWORD: 1
            SE_VNC_NO_PASSWORD: 1
        ports:
            - '${FORWARD_SELENIUM_PORT:-5900}:5900'
        volumes:
            - '/dev/shm:/dev/shm'
        networks:
            - sail
networks:
    sail:
        driver: bridge
volumes:
    sail-mysql:
        driver: local
    sail-redis:
        driver: local

In my case, laravel.test container depends on selenium and mysql and this is the one with laravel code.

Another way for you @tentus , is to use my fork. It is basically all @chilio work, with ubuntu:noble and with fewer tests. I am using on locally planning on go to production in about 2 mounths.
https://github.com/diogobratti/laravel-dusk-ci/tree/php-8.3-laravel-11

@diogobratti @tentus Below is an example of .yml part that works with L11 and php-8.3:

php-8.3:
  stage: browser-tests
  image: chilio/laravel-dusk-ci:php-8.3

  services:
    - name: mysql:latest

  script:
    - cp .env.example .env
    - php artisan dusk:install
    - configure-laravel
    - start-nginx-ci-project
    - php artisan dusk --colors

The idea here is to use separate remote services, and not the one originally inbuilt into the main image.
To do this just change in services from mysql to sqlite docker image of your choosing, and set up all needed vars for this image. This approach is more flexible and enables you to test other db engines, even in the same pipeline.