Skip to content

Commit

Permalink
Add new github actions, and appy fixes style-ci and ECS PERCS20 sty…
Browse files Browse the repository at this point in the history
…le. (#66)
  • Loading branch information
terabytesoftw authored Jan 26, 2024
1 parent 16da67d commit 5c66ab7
Show file tree
Hide file tree
Showing 27 changed files with 461 additions and 175 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.php]
ij_php_space_before_short_closure_left_parenthesis = false
ij_php_space_after_type_cast = true

[*.md]
trim_trailing_whitespace = false

Expand Down
49 changes: 39 additions & 10 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,39 @@
# Ignore all test and documentation for archive
/.editorconfig export-ignore
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/tests export-ignore
/docs export-ignore
# Autodetect text files
* text=auto eol=lf

# ...Unless the name matches the following overriding patterns

# Definitively text files
*.php text
*.css text
*.js text
*.txt text
*.md text
*.xml text
*.json text
*.bat text
*.sql text
*.yml text

# Ensure those won't be messed up with
*.png binary
*.jpg binary
*.gif binary
*.ttf binary

# Avoid merge conflicts in CHANGELOG
# https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/
/CHANGELOG.md merge=union

# Exclude files from the archive
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.styleci.yml export-ignore
/codeception.yml export-ignore
/composer-require-checker.json export-ignore
/docs export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
/rector.php export-ignore
/tests export-ignore
73 changes: 28 additions & 45 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@
name: build
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

on: [push, pull_request]
push:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

env:
DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi"
name: build

jobs:
phpunit:
name: PHP ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: ['8.1', '8.2']

steps:
- name: Install sendmail
run: sudo apt-get install -y sendmail
- name: Checkout
uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-
- name: Install dependencies
run: composer update $DEFAULT_COMPOSER_FLAGS
- name: Install logging proxy
if: ${{ matrix.php != '7.4' }}
run: composer require "yiisoft/yii2-psr-log-source"
- name: Run unit tests with coverage
run: vendor/bin/phpunit --coverage-text
- name: Static analysis (Psalm)
run: vendor/bin/psalm
- name: Static analysis (phpstan)
run: vendor/bin/phpstan
- name: Test code style
run: vendor/bin/ecs
phpunit:
uses: yiisoft/actions/.github/workflows/phpunit.yml@master
with:
composer-command: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi --ignore-platform-req=php+
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3']
33 changes: 33 additions & 0 deletions .github/workflows/dependency-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

push:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

name: dependency-check

jobs:
composer-require-checker:
uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.1']
31 changes: 31 additions & 0 deletions .github/workflows/ecs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'

push:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'

name: ecs

jobs:
easy-coding-standard:
uses: yiisoft/actions/.github/workflows/ecs.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.1']
32 changes: 32 additions & 0 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'psalm.xml'

push:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'psalm.xml'

name: mutation test

jobs:
mutation:
uses: yiisoft/actions/.github/workflows/roave-infection.yml@master
secrets:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
with:
extensions: runkit7
os: >-
['ubuntu-latest']
php: >-
['8.1']
31 changes: 31 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'

push:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'

name: static analysis

jobs:
psalm:
uses: yiisoft/actions/.github/workflows/psalm.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.1']
87 changes: 87 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
preset: psr12
risky: true

version: 8.1

finder:
exclude:
- docs
- vendor

enabled:
- alpha_ordered_traits
- array_indentation
- array_push
- combine_consecutive_issets
- combine_consecutive_unsets
- combine_nested_dirname
- declare_strict_types
- dir_constant
- empty_loop_body_braces
- fully_qualified_strict_types
- function_to_constant
- hash_to_slash_comment
- integer_literal_case
- is_null
- logical_operators
- magic_constant_casing
- magic_method_casing
- method_separation
- modernize_types_casting
- native_function_casing
- native_function_type_declaration_casing
- no_alias_functions
- no_empty_comment
- no_empty_phpdoc
- no_empty_statement
- no_extra_block_blank_lines
- no_short_bool_cast
- no_superfluous_elseif
- no_unneeded_control_parentheses
- no_unneeded_curly_braces
- no_unneeded_final_method
- no_unset_cast
- no_unused_imports
- no_unused_lambda_imports
- no_useless_else
- no_useless_return
- normalize_index_brace
- php_unit_dedicate_assert
- php_unit_dedicate_assert_internal_type
- php_unit_expectation
- php_unit_mock
- php_unit_mock_short_will_return
- php_unit_namespaced
- php_unit_no_expectation_annotation
- phpdoc_no_empty_return
- phpdoc_no_useless_inheritdoc
- phpdoc_order
- phpdoc_property
- phpdoc_scalar
- phpdoc_singular_inheritdoc
- phpdoc_trim
- phpdoc_trim_consecutive_blank_line_separation
- phpdoc_type_to_var
- phpdoc_types
- phpdoc_types_order
- print_to_echo
- regular_callable_call
- return_assignment
- self_accessor
- self_static_accessor
- set_type_to_cast
- short_array_syntax
- short_list_syntax
- simplified_if_return
- single_quote
- standardize_not_equals
- ternary_to_null_coalescing
- trailing_comma_in_multiline_array
- unalign_double_arrow
- unalign_equals
- union_type_without_spaces

disabled:
- function_declaration
- psr12_braces
- psr12_class_definition
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ For license information check the [LICENSE](LICENSE.md)-file.
[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-symfonymailer/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-symfonymailer)
[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-symfonymailer/downloads.png)](https://packagist.org/packages/yiisoft/yii2-symfonymailer)
[![Build Status](https://github.com/yiisoft/yii2-symfonymailer/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-symfonymailer/actions)
[![codecov](https://codecov.io/gh/yiisoft/yii2-symfonymailer/graph/badge.svg?token=XCj60xP699)](https://codecov.io/gh/yiisoft/yii2-symfonymailer)
[![static analysis](https://github.com/yiisoft/yii2-symfonymailer/actions/workflows/static.yml/badge.svg)](https://github.com/yiisoft/yii2-symfonymailer/actions/workflows/static.yml)
[![type-coverage](https://shepherd.dev/github/yiisoft/yii2-symfonymailer/coverage.svg)](https://shepherd.dev/github/yiisoft/yii2-symfonymailer)

Requirements
------------

- PHP 8.1 or higher.

Installation
------------
Expand Down Expand Up @@ -150,3 +158,7 @@ Security implications of the DSN
While the DSN might seem like a simple way to allow user configurable mailer settings it should be noted that the sendmail transport allows for execution of local executables.
If you need to have a user configurable DSN (which is easier to build and more powerful to use than creating a GUI) you should probably disable the sendmail transport.
Any user who has the power to configure a DSN essentially has shell access to wherever the code is running.

## Testing

[Check the documentation testing](/docs/testing.md) to learn about testing.
5 changes: 5 additions & 0 deletions composer-require-checker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"symbol-whitelist": [
"yii\\psr\\DynamicLogger"
]
}
Loading

0 comments on commit 5c66ab7

Please sign in to comment.