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
205 changes: 197 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,101 @@ on:
- develop

jobs:
laravel-tests:
laravel9-tests:
runs-on: ubuntu-latest

strategy:
matrix:
operating-system: [ ubuntu-latest ]
php: [ '8.1', '8.2' ]
dependency-stability: [ 'prefer-stable' ]

laravel: [ '9.*' ]
include:
- laravel: 9.*
testbench: 8.*

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Cache node_modules directory
uses: actions/cache@v4
id: node_modules-cache
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}

- name: Install NPM packages
if: steps.node_modules-cache.outputs.cache-hit != 'true'
run: npm ci --include=dev

- name: Install PHP versions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v4
id: actions-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Cache PHP dependencies (vendor)
uses: actions/cache@v4
id: vendor-cache
with:
path: vendor
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}

- name: Install Laravel Dependencies
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-stability }} --prefer-dist --no-interaction --no-suggest

- name: Update Dependencies with latest stable
if: matrix.dependency-stability == 'prefer-stable'
run: composer update --prefer-stable

- name: Update Dependencies with lowest stable
if: matrix.dependency-stability == 'prefer-lowest'
run: composer update --prefer-stable --prefer-lowest

- name: Set up Git User
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"

# Code quality
- name: Execute tests (Unit and Feature tests) via PestPHP
shell: 'script -q -e -c "bash {0}"'
# Set environment
env:
SESSION_DRIVER: array
TTY: true

run: vendor/bin/pest

- name: Execute Code Sniffer via Laravel Pint
run: vendor/bin/pint --test src config

laravel10-tests:
runs-on: ubuntu-latest

strategy:
Expand All @@ -32,15 +126,15 @@ jobs:

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

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'

- name: Cache node_modules directory
uses: actions/cache@v3
uses: actions/cache@v4
id: node_modules-cache
with:
path: node_modules
Expand All @@ -58,10 +152,10 @@ jobs:
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
id: actions-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
Expand All @@ -70,7 +164,7 @@ jobs:
${{ runner.os }}-composer-

- name: Cache PHP dependencies (vendor)
uses: actions/cache@v3
uses: actions/cache@v4
id: vendor-cache
with:
path: vendor
Expand Down Expand Up @@ -107,3 +201,98 @@ jobs:

- name: Execute Code Sniffer via Laravel Pint
run: vendor/bin/pint --test src config

laravel11-tests:
runs-on: ubuntu-latest

strategy:
matrix:
operating-system: [ ubuntu-latest ]
php: [ '8.2', '8.3' ]
dependency-stability: [ 'prefer-stable' ]

laravel: [ '11.*' ]
include:
- laravel: 11.*
testbench: 9.*

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Cache node_modules directory
uses: actions/cache@v4
id: node_modules-cache
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}

- name: Install NPM packages
if: steps.node_modules-cache.outputs.cache-hit != 'true'
run: npm ci --include=dev

- name: Install PHP versions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v4
id: actions-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Cache PHP dependencies (vendor)
uses: actions/cache@v4
id: vendor-cache
with:
path: vendor
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}

- name: Install Laravel Dependencies
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-stability }} --prefer-dist --no-interaction --no-suggest

- name: Update Dependencies with latest stable
if: matrix.dependency-stability == 'prefer-stable'
run: composer update --prefer-stable

- name: Update Dependencies with lowest stable
if: matrix.dependency-stability == 'prefer-lowest'
run: composer update --prefer-stable --prefer-lowest

- name: Set up Git User
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"

# Code quality
- name: Execute tests (Unit and Feature tests) via PestPHP
shell: 'script -q -e -c "bash {0}"'
# Set environment
env:
SESSION_DRIVER: array
TTY: true

run: vendor/bin/pest

- name: Execute Code Sniffer via Laravel Pint
run: vendor/bin/pint --test src config

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
vendor/
node_modules/
composer.lock
yarn.lock
.phpunit.cache
.phpunit.result.cache
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
"enlightn/enlightn": "^2.3",
"laravel/pint": "^1.2",
"mockery/mockery": "^1.5.1",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^v8.0.0",
"larastan/larastan": "^2.9",
"orchestra/testbench": "^v8.0.0|^v9.0.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-mock": "^2.0",
"squizlabs/php_codesniffer": "^3.7"
},
"autoload": {
Expand Down
71 changes: 70 additions & 1 deletion config/git-hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@
| The following variables are used to store the paths to bin executables for
| various code analyzer dependencies used in your Laravel application.
| This configuration node allows you to set up the paths for these executables.
| Here you can also specify the path to the configuration files they use to customize their behavior
| Here you can also specify the path to the configuration files they use to customize their behavior.
| Each analyzer can be configured to run inside Docker on a specific container.
|
*/
'code_analyzers' => [
Expand All @@ -173,34 +174,46 @@
'config' => env('LARAVEL_PINT_CONFIG'),
'preset' => env('LARAVEL_PINT_PRESET', 'laravel'),
'file_extensions' => env('LARAVEL_PINT_FILE_EXTENSIONS', '/\.php$/'),
'run_in_docker' => env('LARAVEL_PINT_RUN_IN_DOCKER', false),
'docker_container' => env('LARAVEL_PINT_DOCKER_CONTAINER', ''),
],
'php_code_sniffer' => [
'phpcs_path' => env('PHPCS_PATH', 'vendor/bin/phpcs'),
'phpcbf_path' => env('PHPCBF_PATH', 'vendor/bin/phpcbf'),
'config' => env('PHPCS_STANDARD_CONFIG', 'phpcs.xml'),
'file_extensions' => env('PHPCS_FILE_EXTENSIONS', '/\.php$/'),
'run_in_docker' => env('LARAVEL_PHPCS_RUN_IN_DOCKER', false),
'docker_container' => env('LARAVEL_PHPCS_DOCKER_CONTAINER', ''),
],
'larastan' => [
'path' => env('LARASTAN_PATH', 'vendor/bin/phpstan'),
'config' => env('LARASTAN_CONFIG', 'phpstan.neon'),
'additional_params' => env('LARASTAN_ADDITIONAL_PARAMS', '--xdebug'),
'run_in_docker' => env('LARAVEL_LARASTAN_RUN_IN_DOCKER', false),
'docker_container' => env('LARAVEL_LARASTAN_DOCKER_CONTAINER', ''),
],
'blade_formatter' => [
'path' => env('BLADE_FORMATTER_PATH', 'node_modules/.bin/blade-formatter'),
'config' => env('BLADE_FORMATTER_CONFIG', '.bladeformatterrc.json'),
'file_extensions' => env('BLADE_FORMATTER_FILE_EXTENSIONS', '/\.blade\.php$/'),
'run_in_docker' => env('BLADE_FORMATTER_RUN_IN_DOCKER', false),
'docker_container' => env('BLADE_FORMATTER_DOCKER_CONTAINER', ''),
],
'prettier' => [
'path' => env('PRETTIER_PATH', 'node_modules/.bin/prettier'),
'config' => env('PRETTIER_CONFIG', '.prettierrc.json'),
'additional_params' => env('PRETTIER_ADDITIONAL_PARAMS', ''),
'file_extensions' => env('PRETTIER_FILE_EXTENSIONS', '/\.(jsx?|tsx?|vue)$/'),
'run_in_docker' => env('PRETTIER_RUN_IN_DOCKER', false),
'docker_container' => env('PRETTIER_DOCKER_CONTAINER', ''),
],
'eslint' => [
'path' => env('ESLINT_PATH', 'node_modules/.bin/eslint'),
'config' => env('ESLINT_CONFIG', '.eslintrc.js'),
'additional_params' => env('ESLINT_ADDITIONAL_PARAMS', ''),
'file_extensions' => env('ESLINT_FILE_EXTENSIONS', '/\.(jsx?|tsx?|vue)$/'),
'run_in_docker' => env('ESLINT_RUN_IN_DOCKER', false),
'docker_container' => env('ESLINT_DOCKER_CONTAINER', ''),
],
],

Expand All @@ -221,4 +234,60 @@
|
*/
'artisan_path' => base_path('artisan'),

/*
|--------------------------------------------------------------------------
| Output errors
|--------------------------------------------------------------------------
|
| This configuration option allows you output any errors encountered
| during execution directly for easy debug.
|
*/
'output_errors' => false,

/*
|--------------------------------------------------------------------------
| Automatically fix errors
|--------------------------------------------------------------------------
|
| This configuration option allows you to configure the git hooks to
| automatically run the fixer without any CLI prompt.
|
*/
'automatically_fix_errors' => false,

/*
|--------------------------------------------------------------------------
| Automatically re-run analyzer after autofix
|--------------------------------------------------------------------------
|
| This configuration option allows you to configure the git hooks to
| automatically re-run the analyzer command after autofix.
| The git hooks will not fail in case the re-run is succesful.
|
*/
'rerun_analyzer_after_autofix' => false,

/*
|--------------------------------------------------------------------------
| Stop at first analyzer failure
|--------------------------------------------------------------------------
|
| This configuration option allows you to configure the git hooks to
| stop (or not) at the first analyzer failure encountered.
|
*/
'stop_at_first_analyzer_failure' => true,

/*
|--------------------------------------------------------------------------
| Debug commands
|--------------------------------------------------------------------------
|
| This configuration option allows you to configure the git hooks to
| display the commands that are executed (usually for debug purpose).
|
*/
'debug_commands' => false,
];
Loading