diff --git a/.docker/nginx/app.laravel-ownership.80.conf b/.docker/nginx/app.laravel-ownership.80.conf deleted file mode 100644 index af9edea..0000000 --- a/.docker/nginx/app.laravel-ownership.80.conf +++ /dev/null @@ -1,40 +0,0 @@ -server { - listen 80; - listen [::]:80; - server_name app.laravel-ownership.localhost; - - root /app/public; - index index.php index.html; - access_log /dev/stdout; - error_log /dev/stderr info; - - charset utf-8; - - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $server_name; - - add_header Strict-Transport-Security "max-age=31536000" always; - add_header X-Frame-Options "SAMEORIGIN" always; - add_header X-Content-Type-Options "nosniff" always; - add_header Referrer-Policy "strict-origin-when-cross-origin" always; - - server_tokens off; - client_max_body_size 100M; - - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass app:9000; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - } - - location / { - try_files $uri $uri/ /index.php?$query_string; - gzip_static on; - } -} diff --git a/.docker/php/Dockerfile b/.docker/php/php81/Dockerfile similarity index 80% rename from .docker/php/Dockerfile rename to .docker/php/php81/Dockerfile index fa9f794..886291b 100644 --- a/.docker/php/Dockerfile +++ b/.docker/php/php81/Dockerfile @@ -1,7 +1,10 @@ # ---------------------- # The FPM base container # ---------------------- -FROM php:8.1-fpm-alpine AS dev +FROM php:8.1-cli-alpine AS dev + +RUN apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS # Cleanup apk cache and temp files RUN rm -rf /var/cache/apk/* /tmp/* diff --git a/.docker/php/php82/Dockerfile b/.docker/php/php82/Dockerfile new file mode 100644 index 0000000..1067d5c --- /dev/null +++ b/.docker/php/php82/Dockerfile @@ -0,0 +1,22 @@ +# ---------------------- +# The FPM base container +# ---------------------- +FROM php:8.2-cli-alpine AS dev + +RUN apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS + +# Cleanup apk cache and temp files +RUN rm -rf /var/cache/apk/* /tmp/* + +# ---------------------- +# Composer install step +# ---------------------- + +# Get latest Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# ---------------------- +# The FPM production container +# ---------------------- +FROM dev diff --git a/.docker/php/php83/Dockerfile b/.docker/php/php83/Dockerfile new file mode 100644 index 0000000..4d8d02e --- /dev/null +++ b/.docker/php/php83/Dockerfile @@ -0,0 +1,22 @@ +# ---------------------- +# The FPM base container +# ---------------------- +FROM php:8.3-cli-alpine AS dev + +RUN apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS + +# Cleanup apk cache and temp files +RUN rm -rf /var/cache/apk/* /tmp/* + +# ---------------------- +# Composer install step +# ---------------------- + +# Get latest Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# ---------------------- +# The FPM production container +# ---------------------- +FROM dev diff --git a/.docker/php/www.conf b/.docker/php/www.conf deleted file mode 100644 index 39bef0c..0000000 --- a/.docker/php/www.conf +++ /dev/null @@ -1,85 +0,0 @@ -; Start a new pool named 'www'. -; the variable $pool can be used in any directive and will be replaced by the -; pool name ('www' here) -[www] - -; Unix user/group of processes -; Note: The user is mandatory. If the group is not set, the default user's group -; will be used. -user = www-data -group = www-data - -; The address on which to accept FastCGI requests. -; Valid syntaxes are: -; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on -; a specific port; -; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on -; a specific port; -; 'port' - to listen on a TCP socket to all addresses -; (IPv6 and IPv4-mapped) on a specific port; -; '/path/to/unix/socket' - to listen on a unix socket. -; Note: This value is mandatory. -listen = 9000 - -; Choose how the process manager will control the number of child processes. -; Possible Values: -; static - a fixed number (pm.max_children) of child processes; -; dynamic - the number of child processes are set dynamically based on the -; following directives. With this process management, there will be -; always at least 1 children. -; pm.max_children - the maximum number of children that can -; be alive at the same time. -; pm.start_servers - the number of children created on startup. -; pm.min_spare_servers - the minimum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is less than this -; number then some children will be created. -; pm.max_spare_servers - the maximum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is greater than this -; number then some children will be killed. -; ondemand - no children are created at startup. Children will be forked when -; new requests will connect. The following parameter are used: -; pm.max_children - the maximum number of children that -; can be alive at the same time. -; pm.process_idle_timeout - The number of seconds after which -; an idle process will be killed. -; Note: This value is mandatory. -pm = dynamic - -; The number of child processes to be created when pm is set to 'static' and the -; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. -; This value sets the limit on the number of simultaneous requests that will be -; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. -; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP -; CGI. The below defaults are based on a server without much resources. Don't -; forget to tweak pm.* to fit your needs. -; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' -; Note: This value is mandatory. -pm.max_children = 5 - -; The number of child processes created on startup. -; Note: Used only when pm is set to 'dynamic' -; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -pm.start_servers = 2 - -; The desired minimum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.min_spare_servers = 1 - -; The desired maximum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.max_spare_servers = 3 - -; The number of seconds after which an idle process will be killed. -; Note: Used only when pm is set to 'ondemand' -; Default Value: 10s -;pm.process_idle_timeout = 10s; - -; The number of requests each child process should execute before respawning. -; This can be useful to work around memory leaks in 3rd party libraries. For -; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. -; Default Value: 0 -;pm.max_requests = 500 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 47b8eb1..a002540 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,27 +1,38 @@ name: tests -on: [ push, pull_request ] +on: + - push + - pull_request jobs: test: runs-on: ${{ matrix.os }} + strategy: fail-fast: true matrix: - os: [ ubuntu-latest ] - php: [ 8.0, 8.1, 8.2 ] - laravel: [ 9.*, 10.* ] - dependency-version: [ prefer-lowest, prefer-stable ] + os: [ubuntu-latest] + php: [8.0, 8.1, 8.2, 8.3] + laravel: ['9.*', '10.*', '11.*'] + dependency-version: [prefer-lowest, prefer-stable] exclude: - laravel: 9.* php: 8.2 + - laravel: 9.* + php: 8.3 - laravel: 10.* php: 8.0 + - laravel: 11.* + php: 8.0 + - laravel: 11.* + php: 8.1 include: - laravel: 9.* testbench: 7.* - laravel: 10.* testbench: 8.* + - laravel: 11.* + testbench: 9.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e4cb87..88bd11b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to `cybercog/laravel-ownership` will be documented in this f ## [Unreleased] +## [5.6.0] - 2024-03-09 + +### Added + +- ([#32]) Added Laravel 11 support + ## [5.5.0] - 2023-02-24 ### Added @@ -129,7 +135,8 @@ All notable changes to `cybercog/laravel-ownership` will be documented in this f - Initial release -[Unreleased]: https://github.com/cybercog/laravel-ownership/compare/5.5.0...master +[Unreleased]: https://github.com/cybercog/laravel-ownership/compare/5.6.0...master +[5.6.0]: https://github.com/cybercog/laravel-ownership/compare/5.4.0...5.6.0 [5.5.0]: https://github.com/cybercog/laravel-ownership/compare/5.4.0...5.5.0 [5.4.0]: https://github.com/cybercog/laravel-ownership/compare/5.3.0...5.4.0 [5.3.0]: https://github.com/cybercog/laravel-ownership/compare/5.2.0...5.3.0 @@ -144,6 +151,7 @@ All notable changes to `cybercog/laravel-ownership` will be documented in this f [2.0.0]: https://github.com/cybercog/laravel-ownership/compare/1.0.0...2.0.0 [Upgrade instructions]: UPGRADING.md +[#32]: https://github.com/cybercog/laravel-ownership/pull/32 [#28]: https://github.com/cybercog/laravel-ownership/pull/28 [#27]: https://github.com/cybercog/laravel-ownership/pull/27 [#25]: https://github.com/cybercog/laravel-ownership/pull/25 diff --git a/composer.json b/composer.json index a22a9fd..24b23b8 100644 --- a/composer.json +++ b/composer.json @@ -41,13 +41,13 @@ }, "require": { "php": "^8.0", - "illuminate/database": "^9.0|^10.0", - "illuminate/support": "^9.0|^10.0" + "illuminate/database": "^9.0|^10.0|^11.0", + "illuminate/support": "^9.0|^10.0|^11.0" }, "require-dev": { "mockery/mockery": "^1.0", - "orchestra/testbench": "^7.0|^8.0", - "phpunit/phpunit": "^9.6" + "orchestra/testbench": "^7.0|^8.0|^9.0", + "phpunit/phpunit": "^9.6|^10.5" }, "autoload": { "psr-4": { @@ -75,5 +75,5 @@ } }, "minimum-stability": "dev", - "prefer-stable" : true + "prefer-stable": true } diff --git a/docker-compose.yaml b/docker-compose.yaml index 4e8f438..4c8ab8a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,35 +1,34 @@ version: "3.9" services: - app: - container_name: laravel-ownership-app - image: laravel-ownership-app + php81: + container_name: laravel-ownership-lib-81 + image: laravel-ownership-lib-81 build: context: ./ - dockerfile: ./.docker/php/Dockerfile - restart: unless-stopped + dockerfile: ./.docker/php/php81/Dockerfile + tty: true working_dir: /app volumes: - ./:/app - - ./.docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro - networks: - - laravel-ownership - nginx: - container_name: laravel-ownership-nginx - image: nginx:1.21-alpine - restart: unless-stopped - depends_on: - - app - ports: - - "80:80" - environment: - VIRTUAL_HOST: app.laravel-ownership.localhost + php82: + container_name: laravel-ownership-lib-82 + image: laravel-ownership-lib-82 + build: + context: ./ + dockerfile: ./.docker/php/php82/Dockerfile + tty: true + working_dir: /app volumes: - - ./.docker/nginx/app.laravel-ownership.80.conf:/etc/nginx/conf.d/app.laravel-ownership.80.conf:ro - - ./public:/app/public:ro - networks: - - laravel-ownership + - ./:/app -networks: - laravel-ownership: - driver: bridge + php83: + container_name: laravel-ownership-lib-83 + image: laravel-ownership-lib-83 + build: + context: ./ + dockerfile: ./.docker/php/php83/Dockerfile + tty: true + working_dir: /app + volumes: + - ./:/app diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ab4f777..2e5bd0e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,8 +12,7 @@ > - tests/ - tests/database/factories/ + tests/Unit/