Skip to content

Commit

Permalink
Merge pull request #6 from phpcfdi/version-3.0.1
Browse files Browse the repository at this point in the history
Fix Psalm issues and maintenance (Version 3.0.1)
  • Loading branch information
eclipxe13 authored May 16, 2024
2 parents ad9bddb + 587a988 commit 68c1e75
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 42 deletions.
38 changes: 29 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,30 @@ on:
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action

jobs:

composer-normalize:
name: Composer normalization
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
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@v3
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -27,14 +45,14 @@ 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)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -51,7 +69,7 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -64,7 +82,7 @@ jobs:
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -79,7 +97,7 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -92,13 +110,15 @@ jobs:
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
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: Psalm version
run: psalm --version
- name: Psalm
run: psalm --no-progress --output-format=github

Expand All @@ -110,7 +130,7 @@ jobs:
php-version: ['8.3']
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -123,7 +143,7 @@ jobs:
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -28,7 +28,7 @@ jobs:
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Create code coverage
run: vendor/bin/phpunit --testdox --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
- name: Store code coverage
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: build/coverage
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Unshallow clone to provide blame information
run: git fetch --unshallow
- name: Setup PHP
Expand All @@ -86,15 +86,15 @@ jobs:
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
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@v3
uses: actions/download-artifact@v4
with:
name: code-coverage
path: build/coverage
Expand Down
11 changes: 6 additions & 5 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpcs" version="^3.8.1" installed="3.8.1" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.8.1" installed="3.8.1" location="./tools/phpcbf" copy="false"/>
<phar name="php-cs-fixer" version="^3.48.0" installed="3.48.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpstan" version="^1.10.56" installed="1.10.56" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="^5.20.0" installed="5.20.0" location="./tools/psalm" copy="false"/>
<phar name="phpcs" version="^3.9.2" installed="3.9.2" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.9.2" installed="3.9.2" location="./tools/phpcbf" copy="false"/>
<phar name="php-cs-fixer" version="^3.57.1" installed="3.57.1" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpstan" version="^1.11.1" installed="1.11.1" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="^5.24.0" installed="5.24.0" location="./tools/psalm" copy="false"/>
<phar name="composer-normalize" version="^2.42.0" installed="2.42.0" location="./tools/composer-normalize" copy="false"/>
</phive>
38 changes: 23 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
{
"name": "phpcfdi/resources-sat-xml-generator",
"description": "Generates XSD and XSLT from SAT",
"keywords": ["mexico", "sat"],
"homepage": "https://github.com/phpcfdi/resources-sat-xml-generator",
"license": "MIT",
"keywords": [
"mexico",
"sat"
],
"authors": [
{
"name": "Carlos C Soto",
"email": "eclipxe13@gmail.com"
}
],
"homepage": "https://github.com/phpcfdi/resources-sat-xml-generator",
"support": {
"source": "https://github.com/phpcfdi/resources-sat-xml-generator",
"issues": "https://github.com/phpcfdi/resources-sat-xml-generator/issues"
"issues": "https://github.com/phpcfdi/resources-sat-xml-generator/issues",
"source": "https://github.com/phpcfdi/resources-sat-xml-generator"
},
"require": {
"php": ">=8.3",
"ext-json": "*",
"eclipxe/xmlresourceretriever": "^2.0.1",
"symfony/http-client": "^7.0",
"symfony/console": "^7.0"
"symfony/console": "^7.0",
"symfony/http-client": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^10.5",
"fakerphp/faker": "^1.17",
"phpunit/phpunit": "^11.1.3",
"symfony/finder": "^7.0"
},
"autoload": {
Expand All @@ -37,12 +40,20 @@
}
},
"scripts": {
"dev:build": ["@dev:fix-style", "@dev:test"],
"dev:build": [
"@dev:fix-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 --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"
],
Expand All @@ -51,16 +62,13 @@
"@php vendor/bin/phpunit --testdox --stop-on-failure",
"@php tools/phpstan analyse --no-progress",
"@php tools/psalm --no-progress"
],
"dev:coverage": [
"@php -dzend_extension=xdebug.so -dxdebug.mode=coverage vendor/bin/phpunit --coverage-html build/coverage/html/"
]
},
"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, phpstan and psalm",
"dev:coverage": "DEV: run phpunit with xdebug and storage coverage in build/coverage/html/"
"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 dev:check-style, phpunit, phpstan and psalm"
}
}
13 changes: 13 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ Utilizamos [Versionado Semántico 2.0.0](SEMVER.md).

Importante: **Cambiar la versión en `Application::__construct`**.

## Versión 3.0.1 2024-05-15

- Se corrige el problema encontrado por Psalm poniendo el tipo apropiado en la constante `NS_REGISTRY`.

Actualizaciones de mantenimiento:

- Se actualiza PHPUnit a la versión 11.
- Se actualizan las acciones de GitHub a versión 4.
- Se remueven las rutas fijas en la ejecución del flujo de trabajo `phpcs`.
- Se muestra la versión de Psalm en el flujo de trabajo pues no se muestra en la instalación.
- Se agrega la herramienta `composer-normalize` a las herramientas de desarrollo.
- Se actualizan las herramientas de desarrollo.

## Versión 3.0.0 2024-01-22

- Se actualiza la versión mínima de PHP a 8.3.
Expand Down
19 changes: 13 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
cacheDirectory="build/phpunit"
bootstrap="tests/bootstrap.php"
colors="true"
bootstrap="./tests/bootstrap.php"
cacheResultFile="build/phpunit.result.cache">
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerErrors="true"
>
<testsuites>
<testsuite name="Default">
<directory>./tests/</directory>
<directory>tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src/</directory>
<directory>src</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/CLI/FetchSatCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

final class FetchSatCommand extends Command
{
public const NS_REGISTRY = 'https://raw.githubusercontent.com/phpcfdi/sat-ns-registry/master/complementos_v1.json';
public const string NS_REGISTRY = 'https://raw.githubusercontent.com/phpcfdi/sat-ns-registry/master/complementos_v1.json';

/** @noinspection PhpMissingParentCallCommonInspection */
public static function getDefaultName(): string
Expand Down

0 comments on commit 68c1e75

Please sign in to comment.