Skip to content

Commit

Permalink
Merge pull request #16 from eclipxe13/maintenance-20230222
Browse files Browse the repository at this point in the history
Mantenimiento 2023-02-22
  • Loading branch information
eclipxe13 authored Feb 23, 2023
2 parents 86daaec + a34cfb8 commit e5387ed
Show file tree
Hide file tree
Showing 13 changed files with 183 additions and 66 deletions.
49 changes: 34 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,59 +12,78 @@ on:

jobs:

composer-normalize:
name: Composer normalization
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
tools: composer-normalize
env:
fail-fast: true
- name: Composer normalize
run: composer-normalize

phpcs:
name: Code style (phpcs)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: none
tools: composer:v2, cs2pr, phpcs
tools: cs2pr, phpcs
env:
fail-fast: true
- name: Code style (phpcs)
run: phpcs -q --report=checkstyle src/ tests/ | cs2pr
run: phpcs -q --report=checkstyle | cs2pr

php-cs-fixer:
name: Code style (php-cs-fixer)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: none
tools: composer:v2, cs2pr, php-cs-fixer
tools: cs2pr, php-cs-fixer
env:
fail-fast: true
- name: Code style (php-cs-fixer)
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
env:
PHP_CS_FIXER_IGNORE_ENV: 1

phpstan:
name: Code analysis (phpstan)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: none
tools: composer:v2, phpstan
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -79,10 +98,10 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0', '8.1']
php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -93,9 +112,9 @@ jobs:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: xdebug
tools: composer:v2
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Create code coverage
run: vendor/bin/phpunit --testdox --verbose --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
- name: Store code coverage
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: code-coverage
path: build/coverage
Expand All @@ -53,15 +53,15 @@ jobs:
id: check-secrets
run: |
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then
echo "::set-output name=github::yes"
echo "github=yes" >> $GITHUB_OUTPUT
else
echo "::set-output name=github::no"
echo "github=no" >> $GITHUB_OUTPUT
echo "::warning ::GITHUB_TOKEN non set"
fi
if [ -n "${{ secrets.SONAR_TOKEN }}" ]; then
echo "::set-output name=sonar::yes"
echo "sonar=yes" >> $GITHUB_OUTPUT
else
echo "::set-output name=sonar::no"
echo "sonar=no" >> $GITHUB_OUTPUT
echo "::warning ::SONAR_TOKEN non set"
fi
Expand All @@ -72,28 +72,28 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Unshallow clone to provide blame information
run: git fetch --unshallow
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: none
tools: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist
- name: Obtain code coverage
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: code-coverage
path: build/coverage
Expand Down
9 changes: 5 additions & 4 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.5.0" installed="3.5.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcs" version="^3.6.2" installed="3.6.2" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.6.2" installed="3.6.2" location="./tools/phpcbf" copy="false"/>
<phar name="phpstan" version="^1.4.4" installed="1.4.4" location="./tools/phpstan" copy="false"/>
<phar name="php-cs-fixer" version="^3.14.4" installed="3.14.4" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcs" version="^3.7.1" installed="3.7.1" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.7.1" installed="3.7.1" location="./tools/phpcbf" copy="false"/>
<phar name="phpstan" version="^1.10.1" installed="1.10.1" location="./tools/phpstan" copy="false"/>
<phar name="composer-normalize" version="^2.29.0" installed="2.29.0" location="./tools/composer-normalize" copy="false"/>
</phive>
13 changes: 7 additions & 6 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,43 @@

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setCacheFile(__DIR__ . '/build/php_cs.cache')
->setCacheFile(__DIR__ . '/build/php-cs-fixer.cache')
->setRules([
'@PSR12' => true,
'@PSR12:risky' => true,
'@PHP71Migration:risky' => true,
'@PHP73Migration' => true,
// PSR12 (remove when php-cs-fixer reaches ^3.1.1)
'class_definition' => ['space_before_parenthesis' => true],
// symfony
// 'class_attributes_separation' => true, // conflict with PSR12
'class_attributes_separation' => true,
'whitespace_after_comma_in_array' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'function_typehint_space' => true,
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays']],
'no_blank_lines_after_phpdoc' => true,
'object_operator_without_whitespace' => true,
'binary_operator_spaces' => true,
'phpdoc_scalar' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_comma_in_singleline' => true,
'single_quote' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_unused_imports' => true,
'yoda_style' => ['equal' => true, 'identical' => true, 'less_and_greater' => null],
'standardize_not_equals' => true,
'concat_space' => ['spacing' => 'one'],
'linebreak_after_opening_tag' => true,
'fully_qualified_strict_types' => true,
// symfony:risky
'no_alias_functions' => true,
'self_accessor' => true,
// contrib
'not_operator_with_successor_space' => true,
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']], // @PSR12 sort_algorithm: none
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
->append([__FILE__])
->exclude(['vendor', 'build'])
->exclude(['vendor', 'tools', 'build']),
)
;
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contribuciones

Las contribuciones son bienvenidas. Aceptamos *Pull Requests* en el [repositorio GitHub][homepage].
Las contribuciones son bienvenidas. Aceptamos *Pull Requests* en el [repositorio GitHub][project].

Este proyecto se apega al siguiente [Código de Conducta][coc].
Al participar en este proyecto y en su comunidad, deberás seguir este código.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 - 2022 PhpCfdi https://www.phpcfdi.com/
Copyright (c) 2019 - 2023 PhpCfdi https://www.phpcfdi.com/

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ and licensed for use under the MIT License (MIT). Please see [LICENSE][] for mor
[badge-php-version]: https://img.shields.io/packagist/php-v/phpcfdi/credentials?logo=php
[badge-release]: https://img.shields.io/github/release/phpcfdi/credentials?logo=git
[badge-license]: https://img.shields.io/github/license/phpcfdi/credentials?logo=open-source-initiative
[badge-build]: https://img.shields.io/github/workflow/status/phpcfdi/credentials/build/main?logo=github-actions
[badge-build]: https://img.shields.io/github/actions/workflow/status/phpcfdi/credentials/build.yml?branch=main&logo=github-actions
[badge-reliability]: https://sonarcloud.io/api/project_badges/measure?project=phpcfdi_credentials&metric=reliability_rating
[badge-maintainability]: https://sonarcloud.io/api/project_badges/measure?project=phpcfdi_credentials&metric=sqale_rating
[badge-coverage]: https://img.shields.io/sonar/coverage/phpcfdi_credentials/main?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io
Expand Down
56 changes: 34 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"name": "phpcfdi/credentials",
"description": "Library to use eFirma (fiel) and CSD (sellos) from SAT",
"keywords": ["efirma", "fiel", "sat", "cfdi", "sello", "certificado"],
"homepage": "https://github.com/phpcfdi/credentials",
"license": "MIT",
"keywords": [
"efirma",
"fiel",
"sat",
"cfdi",
"sello",
"certificado"
],
"authors": [
{
"name": "Carlos C Soto",
"email": "[email protected]"
}
],
"homepage": "https://github.com/phpcfdi/credentials",
"support": {
"source": "https://github.com/phpcfdi/credentials",
"issues": "https://github.com/phpcfdi/credentials/issues"
},
"prefer-stable": true,
"config": {
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
}
"issues": "https://github.com/phpcfdi/credentials/issues",
"source": "https://github.com/phpcfdi/credentials"
},
"require": {
"php": ">=7.3",
Expand All @@ -31,6 +31,7 @@
"ext-json": "*",
"phpunit/phpunit": "^9.5"
},
"prefer-stable": true,
"autoload": {
"psr-4": {
"PhpCfdi\\Credentials\\": "src/"
Expand All @@ -41,30 +42,41 @@
"PhpCfdi\\Credentials\\Tests\\": "tests/"
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
}
},
"scripts": {
"dev:build": ["@dev:fix-style", "@dev:test"],
"dev:build": [
"@dev:fix-style",
"@dev:check-style",
"@dev:test"
],
"dev:check-style": [
"@php tools/composer-normalize normalize --dry-run",
"@php tools/php-cs-fixer fix --dry-run --verbose",
"@php tools/phpcs --colors -sp"
],
"dev:coverage": [
"@php -dzend_extension=xdebug.so -dxdebug.mode=coverage vendor/bin/phpunit --verbose --coverage-html build/coverage/html/"
],
"dev:fix-style": [
"@php tools/composer-normalize normalize",
"@php tools/php-cs-fixer fix --verbose",
"@php tools/phpcbf --colors -sp"
],
"dev:test": [
"@dev:check-style",
"@php vendor/bin/phpunit --testdox --verbose --stop-on-failure",
"@php tools/phpstan analyse --no-progress"
],
"dev:coverage": [
"@php -dzend_extension=xdebug.so -dxdebug.mode=coverage vendor/bin/phpunit --verbose --coverage-html build/coverage/html/"
"@php tools/phpstan analyse --no-progress --verbose"
]
},
"scripts-descriptions": {
"dev:build": "DEV: run dev:fix-style and dev:tests, run before pull request",
"dev:check-style": "DEV: search for code style errors using php-cs-fixer and phpcs",
"dev:fix-style": "DEV: fix code style errors using php-cs-fixer and phpcbf",
"dev:test": "DEV: run dev:check-style, phpunit and phpstan",
"dev:coverage": "DEV: run phpunit with xdebug and storage coverage in build/coverage/html/"
"dev:build": "DEV: run dev:fix-style dev:check-style and dev:tests, run before pull request",
"dev:check-style": "DEV: search for code style errors using composer-normalize, php-cs-fixer and phpcs",
"dev:coverage": "DEV: run phpunit with xdebug and storage coverage in build/coverage/html/",
"dev:fix-style": "DEV: fix code style errors using composer-normalize, php-cs-fixer and phpcbf",
"dev:test": "DEV: run phpunit and phpstan"
}
}
Loading

0 comments on commit e5387ed

Please sign in to comment.