From 7aa09c5d2911780ae9b68821bc3c6a6a48492fbe Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 12:13:35 -0600 Subject: [PATCH 01/14] Add test related to nodecfdi/credentials (Teletex) --- tests/Unit/CertificateTest.php | 10 ++++++++++ tests/_files/00001000000413053762.cer | Bin 0 -> 1611 bytes 2 files changed, 10 insertions(+) create mode 100644 tests/_files/00001000000413053762.cer diff --git a/tests/Unit/CertificateTest.php b/tests/Unit/CertificateTest.php index be30835..cd5fb56 100644 --- a/tests/Unit/CertificateTest.php +++ b/tests/Unit/CertificateTest.php @@ -213,4 +213,14 @@ public function testCreateSerialNumber(): void $this->assertStringContainsString('Certificate does not contain a serial number', $exception->getMessage()); } } + + public function testReadCertificateTeletex(): void + { + /** @see https://github.com/nodecfdi/credentials/commit/cd8f1827e06a5917c41940e82b8d696379362d5d */ + $teletexCertificate = $this->fileContents('00001000000413053762.cer'); + $certificate = new Certificate($teletexCertificate); + + $this->assertSame('SMA0112284B2', $certificate->rfc()); + $this->assertSame('COMPAÑIA SANTA MARIA SA DE CV', $certificate->legalName()); + } } diff --git a/tests/_files/00001000000413053762.cer b/tests/_files/00001000000413053762.cer new file mode 100644 index 0000000000000000000000000000000000000000..2fa4f2ffaacf94521c6bbb54852a36e052a909c5 GIT binary patch literal 1611 zcmXqLVskfWV$ol~%*4pVBw_#rh9JVgz{Jqlz|`2>%*cS3jZ>@5qwPB{BO^B}gFzGH zCPNDYGdAW>7G@rOM?Ggfg_P7Bh2YepvdrYnd>}``F(o%MFSEF$C^0$n@a8;)kfO|_ z(vrlY%tS+d16`0#E*>=^H9)Q623mz?D$t_f)b!G#%#_3wkgYk13Z8js`9--9TMgw6 zWZ^F7WE2xfOwLa!b|_9P(M!)y(#x$dR5MTkxrLKQ*0D@a!2@VcPI|tAxw(#lbAFDV zf_rIdQBi79z9F9h4@jLL537NhF))C*4LCu3Hen{;2t!E&aS(@tN5BQ-3LlFZZkQ6%)w{vM?X-3K6mAU!JhN1?-AW>amo?yoiOLGHr14BPQW5Za3XoPE- zc>ID=iwpAeiW8G^Qmrro)HyW|7`QngU&Dg27!k_(#R@<<=X{_VV7ONT)utNAiSrs- z7#bOw85tQFo0vz5^BNf;aSa-u!-9iZMAq5gH^A|tr=vo!qhE-lg0Eu`n62RAs^A<3 zQ>RI!Ixa%$R1K6N0U{IZ>u6vIbd`mPlaYeHg1f)7qqzxCz`!HYz);RW2BeHtSQJ$% zEXvm}2pB8S*yJW)9WebWAtz}@RtDxKMt)Gb=3;7MWMo*k^ii+b8;L`=t~GiKX54As zxTQK*_vD$~2IWkDWdB`r5_$N;d7kkT>!YWpPra>vIyvmD`-9D^CDQLsGx;LB%FlFm z`qEjBavY`Goqb{=d&(BaFR9JjBD1MHbmO7N9Ywd=+~?eQHq+H==`p2SGg;QXY2TYt z`0Kk`_JgD6e!sZ<{JK%bRi>YlrX;UrOpx%Dd6^%2D^kC*xGLiJ+SfW4SG4@;Ki)rM zCrjN{1^!R}{&ZDGhAiQTJ0799`2o+{DgJMg1KF5Q+9sy*vz^@Rk;oiryPYv(?~1uB z=IZ%}`aLHdlKXw_yUr4}Qb+xe6T8+#f8o5btE4C5^W=M}sw>sDot3Em)62xn$iTQ* z)<7DZ>Scu)8UM2|888@d14CbypM`~)iR}P#00PSd<|Zaa2Is`f&)4heIk`6YHnBAa z^r&`TkqD>}3YhW3|MvI7Z9VDI;#^JK>BdeL)>9YC1*gRRGdFT6dClEwKU+u7mZM|R z0j9&JYPhG#uq-RLvwgW_>s3|#J1==P%kn4Nt_XHnAMp401ix8T(n?3<`RwYSy+2xc zapL2Bmfe3|zUlAncGf!GFt2)-z_(VNy*0NsFL6GvdUXHiEAG-2zkXD4>CO_l;k~8I z_v~Di^QYxZ=RH}>_NU{L(?%KPqZ6kZznS;D_k-jb`;7}8eD7Lf6jlBImcsR}h3^H} zwPa_d7Vp|n#CGM)>YQH{ivl@2x|doo@2Y>ub})YO@65e-SeRbCIw`u6vs%zK%+6Bk z^7YEP`6p{5?iwuUnD6xb&nC5pp$C5@@EJ=#|F`ekL6r#&_se!>@m?~28X4JMH0{Kv zl$mQ6Xt#gh5j!QiXD?gs6b^qKp(QS@vR$Yo(K~OmLR0?ivm8%*+I0&r?B+alC}v}z{+B~n zj(S>Tuw-+mC@ucou=D+#RoT&NI!soFRY)~!b4>HP!WA{ElF`D#CYm@6(G zmt?Ut>`q#d2-_`-D-U1SOKbcnh`Xl|xxePSV)@~1*|rr1ZQ@5>{}q{D`C4}|SM+m} IKOt>u0FfD3wEzGB literal 0 HcmV?d00001 From dd3ee74cc9a6ac45232105563df59a68ffe3d132 Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 12:15:07 -0600 Subject: [PATCH 02/14] Replace directive ::set-output with $GITHUB_OUTPUT --- .github/workflows/build.yml | 4 ++-- .github/workflows/coverage.yml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df101e0..c8b527d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ 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 with: @@ -93,7 +93,7 @@ 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 with: diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 8a40ddf..972da24 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -25,7 +25,7 @@ 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 with: @@ -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 @@ -83,7 +83,7 @@ jobs: 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 with: From a4b56f45586ba8ef6a0d60b95817a8f27a1fdd08 Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 12:15:38 -0600 Subject: [PATCH 03/14] Remove fixed paths from phpcs job --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8b527d..caed6d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,7 @@ jobs: 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) From 918f01ee3959bb5b4811b8d29be91e7bcaf84a0f Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 12:16:07 -0600 Subject: [PATCH 04/14] Add PHP 8.2 to test matrix --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index caed6d2..642a44d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,7 +79,7 @@ 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 From c5924750913dcdba4b92c9f1e4cb4fe1da2407cc Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 12:16:42 -0600 Subject: [PATCH 05/14] Run all jobs on PHP 8.2 --- .github/workflows/build.yml | 8 +++++--- .github/workflows/coverage.yml | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 642a44d..0512f5e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.2' coverage: none tools: composer:v2, cs2pr, phpcs env: @@ -38,13 +38,15 @@ jobs: - 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 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) @@ -55,7 +57,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.2' coverage: none tools: composer:v2, phpstan env: diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 972da24..a71f370 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -18,7 +18,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.2' coverage: xdebug tools: composer:v2 env: @@ -78,7 +78,7 @@ jobs: - 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 From 6f8ed3215971eca0978fc1bb97f9d92e98853c57 Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 12:16:54 -0600 Subject: [PATCH 06/14] Update development tools --- .phive/phars.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.phive/phars.xml b/.phive/phars.xml index a8c442c..593a7b6 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,7 +1,7 @@ - - - - + + + + From a96d2b1436a0b247c05b8f3a13ab8e95e2c136e9 Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 18:04:38 -0600 Subject: [PATCH 07/14] Add create credential example --- docs/EjemploCrearCredencialVerificacion.md | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 docs/EjemploCrearCredencialVerificacion.md diff --git a/docs/EjemploCrearCredencialVerificacion.md b/docs/EjemploCrearCredencialVerificacion.md new file mode 100644 index 0000000..51885d6 --- /dev/null +++ b/docs/EjemploCrearCredencialVerificacion.md @@ -0,0 +1,55 @@ +# Ejemplo de creación de una credencial con verificaciones previas + +Al momento de crear una *credencial* (`Credential`), es posible que queramos verificar la creación con +una lista detallada de errores. Si bien esto puede significar una doble verificación, es posible implementarlo +con el siguiente código de ejemplo: + +```php +rfc() !== $expectedRfc) { + throw new Exception(sprintf('El certificado no pertenece al RFC %s.', $expectedRfc)); + } + if ($certificate->validOn()) { + throw new Exception('El certificado no es vigente en este momento.'); + } + if ($expectedType->isFiel() && ! $certificate->satType()->isFiel()) { + throw new Exception('El certificado no corresponde a una eFirma/FIEL.'); + } + if ($expectedType->isCsd() && ! $certificate->satType()->isCsd()) { + throw new Exception('El certificado no corresponde a un CSD.'); + } + + try { + $privateKey = PrivateKey::openFile($privateKeyFile, $passPhrase); + } catch (Throwable $exception) { + throw new Exception('El archivo de llave privada no se pudo abrir, el archivo o la contraseña son incorrectos.', 0, $exception); + } + if (! $privateKey->belongsTo($certificate)) { + throw new Exception('La llave privada no es par del certificado.'); + } + + return new Credential($certificate, $privateKey); +} +``` From c11e9d2b4738334f5c545e60132d17914f683b64 Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 18:05:08 -0600 Subject: [PATCH 08/14] Update license year. Happy 2023! --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 27397b2..97083c0 100644 --- a/LICENSE +++ b/LICENSE @@ -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 From 93d0e853189550497783ecdab7f1b3761086f258 Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 18:05:29 -0600 Subject: [PATCH 09/14] Fix badge-build --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e391d02..821b721 100644 --- a/README.md +++ b/README.md @@ -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 From e9d9c45830fd7c5f860a49ccf47da45e04c6fd2c Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 18:06:49 -0600 Subject: [PATCH 10/14] Update code style configuration files --- .php-cs-fixer.dist.php | 13 +++++++------ phpcs.xml.dist | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index fab2854..bfdf895 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -11,25 +11,24 @@ 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, @@ -37,16 +36,18 @@ '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']), ) ; diff --git a/phpcs.xml.dist b/phpcs.xml.dist index e7c3269..e7a9c2a 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,4 +1,4 @@ - + The EngineWorks (PSR-2 based) coding standard. From 67f2a9489766671c93bc88fe867ff632639cc07b Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 18:16:51 -0600 Subject: [PATCH 11/14] Fix homepage link --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d96576..2b9f998 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. From 3adad530940a9e6c6e56e00d8bb4dc160737808e Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 18:16:23 -0600 Subject: [PATCH 12/14] Add composer normalize and improve dev scripts --- .github/workflows/build.yml | 17 +++++++++++ .phive/phars.xml | 1 + composer.json | 56 ++++++++++++++++++++++--------------- 3 files changed, 52 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0512f5e..eff3d9d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,23 @@ 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" diff --git a/.phive/phars.xml b/.phive/phars.xml index 593a7b6..c05fe29 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -4,4 +4,5 @@ + diff --git a/composer.json b/composer.json index fff7c5b..4e4eeb8 100644 --- a/composer.json +++ b/composer.json @@ -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": "eclipxe13@gmail.com" } ], + "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", @@ -31,6 +31,7 @@ "ext-json": "*", "phpunit/phpunit": "^9.5" }, + "prefer-stable": true, "autoload": { "psr-4": { "PhpCfdi\\Credentials\\": "src/" @@ -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" } } From ee0b2af9443270a72a99919e5f77e2d4f4be73c5 Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 18:28:59 -0600 Subject: [PATCH 13/14] Update github actions to version 3 --- .github/workflows/build.yml | 16 ++++++++-------- .github/workflows/coverage.yml | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eff3d9d..1b89dea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,13 +34,13 @@ 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.2' coverage: none - tools: composer:v2, cs2pr, phpcs + tools: cs2pr, phpcs env: fail-fast: true - name: Code style (phpcs) @@ -51,13 +51,13 @@ 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.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) @@ -70,7 +70,7 @@ 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: @@ -83,7 +83,7 @@ jobs: id: composer-cache 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') }} @@ -101,7 +101,7 @@ jobs: 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: @@ -114,7 +114,7 @@ jobs: id: composer-cache 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') }} diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a71f370..09687f8 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -14,7 +14,7 @@ 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: @@ -27,7 +27,7 @@ jobs: id: composer-cache 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') }} @@ -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 @@ -72,7 +72,7 @@ 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 @@ -85,7 +85,7 @@ jobs: id: composer-cache 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') }} @@ -93,7 +93,7 @@ jobs: - 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 From a34cfb8c3457c4093b83ed3ba147fe455ef999ec Mon Sep 17 00:00:00 2001 From: Carlos C Soto Date: Wed, 22 Feb 2023 18:33:32 -0600 Subject: [PATCH 14/14] Document maintenance changes --- docs/CHANGELOG.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index ba44a4d..811474a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,7 +7,26 @@ Usamos [Versionado Semántico 2.0.0](SEMVER.md) por lo que puedes usar esta libr ## Cambios no liberados en una versión Pueden aparecer cambios no liberados que se integran a la rama principal, pero no ameritan una nueva liberación de -versión, aunque sí su incorporación en la rama principal de trabajo. Generalmente se tratan de cambios en el desarrollo. +versión, aunque sí su incorporación en la rama principal de trabajo. Generalmente, se tratan de cambios en el desarrollo. + +### Mantenimiento 2023-02-22 + +Los siguientes cambios son de mantenimiento: + +- Se actualiza el año en el archivo de licencia. +- Se agrega una prueba para comprobar certificados *Teletex*. + Ver https://github.com/nodecfdi/credentials/commit/cd8f1827e06a5917c41940e82b8d696379362d5d. +- Se agrega un archivo de documentación: *Ejemplo de creación de una credencial con verificaciones previas*. +- Se corrige la insignia de construcción del proyecto `[bagde-build]`. +- Se sustituye la referencia `[homepage]` a `[project]` en el archivo `CONTRIBUTING.md`. +- Se actualizan los archivos de configuración de estilo de código. +- Se actualizan los flujos de trabajo de GitHub: + - Los trabajos de PHP se ejecutan en la versión 8.2. + - Se actualizan las acciones de GitHub a la versión 3. + - Se agrega PHP 8.2 a la matriz de pruebas. + - Se cambia la directiva `::set-output` a `$GITHUB_OUTPUT`. + - Se corrige el trabajo `phpcs` eliminando las rutas fijas. +- Se actualizan las versiones de las herramientas de desarrollo. ## Listado de cambios