Skip to content

Commit

Permalink
Merge branch 'master' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgmyr committed Nov 17, 2021
2 parents 0f25489 + 473ded6 commit fa79ad2
Show file tree
Hide file tree
Showing 29 changed files with 819 additions and 569 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check & fix styling

on: [push]

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.php --allow-risky=yes

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
80 changes: 80 additions & 0 deletions .github/workflows/run-tests-mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Laravel Messenger - MySQL Tests
on:
push:
branches:
- master
- develop
- feature/**
pull_request:
branches:
- master
- develop

jobs:
laravel-tests:
runs-on: ubuntu-latest
# Service container Mysql mysql
services:
# Label used to access the service container
mysql:
# Docker Hub image (also with version)
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: db_test_laravel
## map the "external" 33306 port with the "internal" 3306
ports:
- 33306:3306
# Set health checks to wait until mysql database has started (it takes some seconds to start)
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '8.0' ]
dependency-stability: [ prefer-stable ]

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

name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}

steps:
- uses: actions/checkout@v2
- name: Install PHP versions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Get Composer Cache Directory 2
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
id: actions-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Laravel Dependencies
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
# Code quality
- name: Execute tests (Unit and Feature tests) via PHPUnit
# Set environment
env:
DB_CONNECTION: mysql
DB_DATABASE: db_test_laravel
DB_PORT: 33306
DB_USERNAME: root

run: vendor/bin/phpunit --testdox
94 changes: 94 additions & 0 deletions .github/workflows/run-tests-postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Laravel Messenger - PostgreSQL Tests
on:
push:
branches:
- master
- develop
- feature/**
pull_request:
branches:
- master
- develop

jobs:
laravel-tests:
runs-on: ubuntu-latest
# Service container Postgresql postgresql
services:
# Label used to access the service container
postgres:
# Docker Hub image (also with version)
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: db_test_laravel
## map the "external" 55432 port with the "internal" 5432
ports:
- 55432:5432
# Set health checks to wait until postgresql database has started (it takes some seconds to start)
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '8.0' ]
dependency-stability: [ prefer-stable ]

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

name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}

steps:
- uses: actions/checkout@v2
- name: Install PHP versions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Get Composer Cache Directory 2
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
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
uses: actions/cache@v2
id: vendor-cache
with:
path: vendor
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}
- name: Install Laravel Dependencies
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: Show dir
run: pwd
- name: PHP Version
run: php --version

# Code quality
- name: Execute tests (Unit and Feature tests) via PHPUnit
# Set environment
env:
DB_CONNECTION: pgsql
DB_DATABASE: db_test_laravel
DB_PORT: 55432
DB_USERNAME: postgres
DB_PASSWORD: postgres

run: vendor/bin/phpunit --testdox
76 changes: 76 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Laravel Messenger - Tests
on:
push:
branches:
- master
- develop
- feature/**
pull_request:
branches:
- master
- develop

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

strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '8.0','7.4','7.3','7.2' ]
dependency-stability: [ prefer-stable ]
laravel: [ '8.*','7.*','6.*' ]

include:
- laravel: 8.*
testbench: 6.*
dbal: ^3.1.2|^2.13.3
- laravel: 7.*
testbench: 5.*
dbal: ^2.6
- laravel: 6.*
testbench: 4.*
dbal: ^2.6
exclude:
- laravel: 8.*
php-versions: 7.3
- laravel: 8.*
php-versions: 7.2
- laravel: 7.*
php-versions: 8.0
- laravel: 6.*
php-versions: 8.0

name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}

steps:
- uses: actions/checkout@v2
- name: Install PHP versions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Get Composer Cache Directory 2
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
id: actions-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Laravel Dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "doctrine/dbal:${{ matrix.dbal }}" --no-interaction --no-update
composer update --${{ matrix.dependency-stability }} --prefer-dist --no-interaction --no-suggest
# Code quality
- name: Execute tests (Unit and Feature tests) via PHPUnit
# Set environment
env:
DB_CONNECTION: sqlite
DB_DATABASE: ":memory:"

run: vendor/bin/phpunit --testdox
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.php_cs.cache
.php-cs-fixer.cache
.phpunit.result.cache
build
composer.lock
Expand Down
31 changes: 16 additions & 15 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
<?php

return PhpCsFixer\Config::create()
$finder = PhpCsFixer\Finder::create()
->exclude('files')
->exclude('vendor')
->in(__DIR__)
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new PhpCsFixer\Config)
->setRiskyAllowed(true)
->setRules([
'@PSR1' => false,
'@PSR2' => true,

/**
Expand All @@ -13,7 +22,7 @@
// Remove duplicated semicolons.
'no_empty_statement' => true,
// PHP multi-line arrays should have a trailing comma.
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => true,
// There should be no empty lines after class opening brace.
'no_blank_lines_after_class_opening' => true,
// There should not be blank lines between docblock and the documented element.
Expand All @@ -23,19 +32,19 @@
// Phpdocs should start and end with content, excluding the very first and last line of the docblocks.
'phpdoc_trim' => true,
// Removes line breaks between use statements.
'no_extra_consecutive_blank_lines' => ['use'],
'no_extra_blank_lines' => ['tokens' => ['use']],
// An empty line feed should precede a return statement.
'blank_line_before_return' => true,
'blank_line_before_statement' => true,
// There should be exactly one blank line before a namespace declaration.
'single_blank_line_before_namespace' => true,
// Convert double quotes to single quotes for simple strings.
'single_quote' => true,
// Unused use statements must be removed.
'no_unused_imports' => true,
// Methods must be separated with one blank line.
'method_separation' => true,
'class_attributes_separation' => true,
// Binary operators should be surrounded by at least one space.
'binary_operator_spaces' => ['align_double_arrow' => false],
'binary_operator_spaces' => ['operators' => ['=>' => 'single_space']],
// A single space should be between cast and variable.
'cast_spaces' => true,

Expand All @@ -49,13 +58,5 @@
// PHP arrays should be declared using the configured syntax.
'array_syntax' => ['syntax' => 'short']
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('files')
->exclude('vendor')
->in(__DIR__)
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true)
)
->setFinder($finder)
->setUsingCache(true);
34 changes: 0 additions & 34 deletions .scrutinizer.yml

This file was deleted.

Loading

0 comments on commit fa79ad2

Please sign in to comment.