Skip to content

Commit 9047327

Browse files
authored
Merge pull request #7 from eclipxe13/development
Revisión 2021-09-31
2 parents 82a79c2 + 5d820f4 commit 9047327

18 files changed

+236
-119
lines changed

.gitattributes

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
* text=auto
33

44
# Do not put this files on a distribution package (by .gitignore)
5-
/vendor/ export-ignore
6-
/composer.lock export-ignore
5+
/tools/ export-ignore
6+
/vendor/ export-ignore
7+
/composer.lock export-ignore
78

89
# Do not put this files on a distribution package
9-
/build/ export-ignore
10-
/tests/ export-ignore
11-
/.gitattributes export-ignore
12-
/.gitignore export-ignore
13-
/.php_cs.dist export-ignore
14-
/.scrutinizer.yml export-ignore
15-
/.travis.yml export-ignore
16-
/phpcs.xml.dist export-ignore
17-
/phpunit.xml.dist export-ignore
10+
/.github/ export-ignore
11+
/build/ export-ignore
12+
/tests/ export-ignore
13+
/.gitattributes export-ignore
14+
/.gitignore export-ignore
15+
/.php-cs-fixer.dist.php export-ignore
16+
/.scrutinizer.yml export-ignore
17+
/phpcs.xml.dist export-ignore
18+
/phpstan.xml.dist export-ignore
19+
/phpunit.xml.dist export-ignore

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# see https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
2+
/.github/* @phpcfdi/core-mantainers

.github/workflows/build.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: build
2+
on:
3+
pull_request:
4+
branches: [ main ]
5+
push:
6+
branches: [ main ]
7+
schedule:
8+
- cron: '0 16 * * 0' # sunday 16:00
9+
10+
jobs:
11+
12+
ci: # this job runs all the development tools and upload code coverage to scrutinizer
13+
14+
name: Continuous Integration
15+
runs-on: "ubuntu-latest"
16+
17+
steps:
18+
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
# see https://github.com/marketplace/actions/setup-php-action
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: '8.0'
27+
extensions: dom
28+
coverage: xdebug
29+
tools: composer:v2, cs2pr
30+
env:
31+
fail-fast: true
32+
33+
- name: Get composer cache directory
34+
id: composer-cache
35+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
36+
37+
- name: Cache dependencies
38+
uses: actions/cache@v2
39+
with:
40+
path: ${{ steps.composer-cache.outputs.dir }}
41+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
42+
restore-keys: ${{ runner.os }}-composer-
43+
44+
- name: Install project dependencies
45+
run: composer upgrade --no-interaction --no-progress --prefer-dist
46+
47+
- name: Code style (phpcs)
48+
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
49+
50+
- name: Code style (php-cs-fixer)
51+
run: vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
52+
53+
- name: Tests (phpunit with code coverage)
54+
run: vendor/bin/phpunit --testdox --verbose --coverage-clover=build/coverage-clover.xml
55+
56+
- name: Code analysis (phpstan)
57+
run: vendor/bin/phpstan analyse --no-progress --verbose
58+
59+
# see https://github.com/marketplace/actions/action-scrutinizer
60+
- name: Upload code coverage to scrutinizer
61+
uses: sudo-bot/action-scrutinizer@latest
62+
with:
63+
cli-args: "--format=php-clover build/coverage-clover.xml"
64+
continue-on-error: true
65+
66+
build: # this job runs tests on all php supported versions
67+
68+
name: PHP ${{ matrix.php-versions }}
69+
runs-on: "ubuntu-latest"
70+
71+
strategy:
72+
matrix:
73+
php-versions: ['7.3', '7.4', '8.0']
74+
75+
steps:
76+
77+
- name: Checkout
78+
uses: actions/checkout@v2
79+
80+
# see https://github.com/marketplace/actions/setup-php-action
81+
- name: Setup PHP
82+
uses: shivammathur/setup-php@v2
83+
with:
84+
php-version: ${{ matrix.php-versions }}
85+
extensions: dom
86+
coverage: none
87+
tools: composer:v2, cs2pr
88+
env:
89+
fail-fast: true
90+
91+
- name: Get composer cache directory
92+
id: composer-cache
93+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
94+
95+
- name: Cache dependencies
96+
uses: actions/cache@v2
97+
with:
98+
path: ${{ steps.composer-cache.outputs.dir }}
99+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
100+
restore-keys: ${{ runner.os }}-composer-
101+
102+
- name: Install project dependencies
103+
run: composer upgrade --no-interaction --no-progress --prefer-dist
104+
105+
- name: Tests
106+
run: vendor/bin/phpunit --testdox --verbose

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# do not include this files on git
2-
/vendor
2+
/tools/
3+
/vendor/
34
/composer.lock

.phive/phars.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phive xmlns="https://phar.io/phive">
3+
<phar name="php-cs-fixer" version="^3.1.0" installed="3.1.0" location="./tools/php-cs-fixer" copy="false"/>
4+
<phar name="phpcs" version="^3.6.0" installed="3.6.0" location="./tools/phpcs" copy="false"/>
5+
<phar name="phpcbf" version="^3.6.0" installed="3.6.0" location="./tools/phpcbf" copy="false"/>
6+
<phar name="phpstan" version="^0.12.97" installed="0.12.97" location="./tools/phpstan" copy="false"/>
7+
</phive>
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,50 @@
11
<?php
22

3+
/**
4+
* @noinspection PhpUndefinedClassInspection
5+
* @noinspection PhpUndefinedNamespaceInspection
6+
* @see https://cs.symfony.com/doc/ruleSets/
7+
* @see https://cs.symfony.com/doc/rules/
8+
*/
9+
310
declare(strict_types=1);
411

5-
return PhpCsFixer\Config::create()
12+
return (new PhpCsFixer\Config())
613
->setRiskyAllowed(true)
714
->setCacheFile(__DIR__ . '/build/php_cs.cache')
815
->setRules([
9-
'@PSR2' => true,
10-
'@PHP70Migration' => true,
11-
'@PHP70Migration:risky' => true,
12-
'@PHP71Migration' => true,
16+
'@PSR12' => true,
17+
'@PSR12:risky' => true,
1318
'@PHP71Migration:risky' => true,
14-
// '@PHP73Migration' => true,
19+
'@PHP73Migration' => true,
1520
// symfony
1621
'class_attributes_separation' => true,
1722
'whitespace_after_comma_in_array' => true,
1823
'no_empty_statement' => true,
1924
'no_extra_blank_lines' => true,
2025
'function_typehint_space' => true,
21-
'no_alias_functions' => true,
22-
'trailing_comma_in_multiline_array' => true,
23-
'new_with_braces' => true,
24-
'no_blank_lines_after_class_opening' => true,
2526
'no_blank_lines_after_phpdoc' => true,
2627
'object_operator_without_whitespace' => true,
2728
'binary_operator_spaces' => true,
2829
'phpdoc_scalar' => true,
29-
'self_accessor' => true,
3030
'no_trailing_comma_in_singleline_array' => true,
3131
'single_quote' => true,
3232
'no_singleline_whitespace_before_semicolons' => true,
3333
'no_unused_imports' => true,
34-
'no_whitespace_in_blank_line' => true,
3534
'yoda_style' => ['equal' => true, 'identical' => true, 'less_and_greater' => null],
3635
'standardize_not_equals' => true,
37-
// contrib
3836
'concat_space' => ['spacing' => 'one'],
39-
'not_operator_with_successor_space' => true,
40-
'single_blank_line_before_namespace' => true,
4137
'linebreak_after_opening_tag' => true,
42-
'blank_line_after_opening_tag' => true,
43-
'ordered_imports' => true,
44-
'array_syntax' => ['syntax' => 'short'],
38+
// symfony:risky
39+
'no_alias_functions' => true,
40+
'self_accessor' => true,
41+
// contrib
42+
'not_operator_with_successor_space' => true,
4543
])
4644
->setFinder(
4745
PhpCsFixer\Finder::create()
4846
->in(__DIR__)
47+
->append([__FILE__])
4948
->exclude(['vendor', 'build'])
5049
)
5150
;

.scrutinizer.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
filter:
22
excluded_paths:
33
- 'tests/'
4+
dependency_paths:
5+
- 'tools/'
46
- 'vendor/'
57

68
build:
79
dependencies:
810
override:
9-
- composer self-update --2 --stable --no-interaction --no-progress
10-
- composer remove squizlabs/php_codesniffer friendsofphp/php-cs-fixer phpstan/phpstan --dev --no-interaction --no-progress --no-update
11-
- composer update --no-interaction --no-progress
11+
- composer upgrade --no-interaction --prefer-dist
1212
nodes:
13-
analysis:
14-
project_setup:
15-
override: true
13+
analysis: # see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/
14+
project_setup: {override: true}
1615
tests:
1716
override:
1817
- php-scrutinizer-run --enable-security-analysis
19-
- command: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
20-
coverage:
21-
file: coverage.clover
22-
format: clover
18+
19+
tools:
20+
external_code_coverage: true

.travis.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

CODE_OF_CONDUCT.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
# Código de Conducta convenido para Contribuyentes
1+
# Código de Conducta Convenido para Contribuyentes
32

43
## Nuestro compromiso
54

@@ -37,7 +36,7 @@ Este código de conducta aplica tanto a espacios del proyecto como a espacios p
3736

3837
## Aplicación
3938

40-
Instancias de comportamiento abusivo, acosador o inaceptable de otro modo podrán ser reportadas a los administradores de la comunidad responsables del cumplimiento a través de [coc@phpcfdi.com](). Todas las quejas serán evaluadas e investigadas de una manera puntual y justa.
39+
Instancias de comportamiento abusivo, acosador o inaceptable de otro modo podrán ser reportadas a los administradores de la comunidad responsables del cumplimiento a través de [coc@phpcfdi.com](mailto:coc@phpcfdi.com). Todas las quejas serán evaluadas e investigadas de una manera puntual y justa.
4140

4241
Todos los administradores de la comunidad están obligados a respetar la privacidad y la seguridad de quienes reporten incidentes.
4342

CONTRIBUTING.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Contribuciones
22

3-
Las contribuciones son bienvenidas. Aceptamos *Pull Requests* en el [repositorio GitHub][homepage].
3+
Las contribuciones son bienvenidas. Aceptamos *Pull Requests* en [el repositorio GitHub][homepage].
44

55
Este proyecto se apega al siguiente [Código de Conducta][coc].
66
Al participar en este proyecto y en su comunidad, deberás seguir este código.
77

88
## Miembros del equipo
99

10-
* [phpCfdi][] - Organización que mantiene el proyecto.
10+
* [phpCfdi][] Organización que mantiene el proyecto.
1111
* [Contribuidores][contributors].
1212

1313
## Canales de comunicación
@@ -50,20 +50,21 @@ o la forma de desarrollarlas puede que no estén alineadas con el proyecto.
5050
Considera las siguientes directrices:
5151

5252
* Usa una rama única que se desprenda de la rama principal.
53-
No mezcles dos diferentes funcionalidades en una misma rama o *Pull Request*.
53+
* No mezcles dos diferentes funcionalidades en una misma rama o *Pull Request*.
5454
* Describe claramente y en detalle los cambios que hiciste.
5555
* **Escribe pruebas** para la funcionalidad que deseas agregar.
56-
* **Asegúrate que las pruebas pasan** antes de enviar tu contribución.
57-
Usamos integración contínua donde se hace esta verificación, pero es mucho mejor si lo pruebas localmente.
56+
* Asegúrate que **las pruebas pasan** antes de enviar tu contribución.
57+
Usamos integración continua donde se hace esta verificación, pero es mucho mejor si lo pruebas localmente.
5858
* Intenta enviar una historia coherente, entenderemos cómo cambia el código si los *commits* tienen significado.
5959
* La documentación es parte del proyecto.
60-
Realiza los cambios en los archivos de ayuda para que reflejen los cambios en el código.
60+
* Realiza los cambios en los archivos de ayuda para que reflejen los cambios en el código.
6161

6262
## Proceso de construcción
6363

6464
```shell
6565
# Actualiza tus dependencias
6666
composer update
67+
phive update
6768

6869
# Verificación de estilo de código
6970
composer dev:check-style
@@ -74,12 +75,22 @@ composer dev:fix-style
7475
# Ejecución de pruebas
7576
composer dev:test
7677

77-
# Ejecución todo en uno, corregir estilo, verificar estilo y correr pruebas
78+
# Ejecución todo en uno: corregir estilo, verificar estilo y correr pruebas
7879
composer dev:build
7980
```
8081

82+
## Ejecutar GitHub Actions localmente
83+
84+
Puedes usar [`act`](https://github.com/nektos/act) para ejecutar GitHub Actions localmente, tal como se
85+
muestra en [`actions/setup-php-action`](https://github.com/marketplace/actions/setup-php-action#local-testing-setup)
86+
puedes ejecutar el siguiente comando:
87+
88+
```shell
89+
act -P ubuntu-latest=shivammathur/node:latest
90+
```
91+
8192
[phpCfdi]: https://github.com/phpcfdi/
8293
[project]: https://github.com/phpcfdi/cfdi-expresiones
8394
[contributors]: https://github.com/phpcfdi/cfdi-expresiones/graphs/contributors
84-
[coc]: https://github.com/phpcfdi/cfdi-expresiones/blob/master/CODE_OF_CONDUCT.md
95+
[coc]: https://github.com/phpcfdi/cfdi-expresiones/blob/main/CODE_OF_CONDUCT.md
8596
[issues]: https://github.com/phpcfdi/cfdi-expresiones/issues

0 commit comments

Comments
 (0)