Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #11 from eclipxe13/maintenance
Browse files Browse the repository at this point in the history
Mantenimiento 2022-02-22
  • Loading branch information
eclipxe13 authored Feb 23, 2022
2 parents 90b473f + 2ef6289 commit 332a34c
Show file tree
Hide file tree
Showing 13 changed files with 247 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

# Do not put this files on a distribution package
/.github/ export-ignore
/.phive/ export-ignore
/build/ export-ignore
/tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/.scrutinizer.yml export-ignore
/infection.json.dist export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# see https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
/.github/* @phpcfdi/core-mantainers
/.github/* @phpcfdi/core-maintainers
124 changes: 73 additions & 51 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,112 +1,134 @@
name: build
on:
pull_request:
branches: [ main ]
branches: [ "main" ]
push:
branches: [ main ]
branches: [ "main" ]
schedule:
- cron: '0 16 * * 0' # sunday 16:00

jobs:
# Actions
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action

ci: # this job runs all the development tools and upload code coverage to scrutinizer
jobs:

name: PHP 8.0 (full)
phpcs:
name: Code style (phpcs)
runs-on: "ubuntu-latest"

steps:

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

# see https://github.com/marketplace/actions/setup-php-action
php-cs-fixer:
name: Code style (php-cs-fixer)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: dom
coverage: xdebug
tools: composer:v2, phpcs, php-cs-fixer, phpstan, psalm, infection, cs2pr
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

phpstan:
name: Code analysis (phpstan)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
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)"

- name: Cache dependencies
uses: actions/cache@v2
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: Code style (phpcs)
run: phpcs -q --report=checkstyle | cs2pr

- name: Code style (php-cs-fixer)
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr

- name: Tests (phpunit with code coverage)
run: vendor/bin/phpunit --testdox --verbose --coverage-clover=build/coverage-clover.xml --coverage-xml=build/coverage --log-junit=build/coverage/junit.xml

- name: Code analysis (phpstan)
- name: PHPStan
run: phpstan analyse --no-progress --verbose

- name: Code analysis (psalm)
run: psalm --no-progress --output-format=github

- name: Mutation testing analysis
run: infection --skip-initial-tests --coverage=build/coverage --no-progress --no-interaction --logger-github

# see https://github.com/marketplace/actions/action-scrutinizer
- name: Upload code coverage to scrutinizer
uses: sudo-bot/action-scrutinizer@latest
psalm:
name: Code analysis (psalm)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
cli-args: "--format=php-clover build/coverage-clover.xml"
continue-on-error: true

build: # this job runs tests on all php supported versions
php-version: '8.0'
coverage: none
tools: composer:v2, psalm
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
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
run: psalm --no-progress

name: PHP ${{ matrix.php-versions }} (tests)
tests:
name: Tests on PHP ${{ matrix.php-versions }}
runs-on: "ubuntu-latest"

strategy:
matrix:
php-versions: ['7.3', '7.4']

php-versions: ['7.3', '7.4', '8.0', '8.1']
steps:

- name: Checkout
uses: actions/checkout@v2

# see https://github.com/marketplace/actions/setup-php-action
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: dom
coverage: none
tools: composer:v2, cs2pr
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)"

- name: Cache dependencies
uses: actions/cache@v2
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: Tests
- name: Tests (phpunit)
run: vendor/bin/phpunit --testdox --verbose
142 changes: 142 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: coverage
on:
push:
branches: [ "main" ]

# Actions
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action
# sonarsource/sonarcloud-github-action@master https://github.com/marketplace/actions/sonarcloud-scan

jobs:

tests-coverage:
name: Tests on PHP 8.0 (code coverage)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
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)"
- name: Cache dependencies
uses: actions/cache@v2
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: 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
with:
name: code-coverage
path: build/coverage

infection:
name: Mutation testing analysis
needs: tests-coverage
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
tools: composer:v2,infection
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
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
with:
name: code-coverage
path: build/coverage
- name: infection
run: infection --skip-initial-tests --coverage=build/coverage --no-progress --no-interaction --logger-github

sonarcloud-secrets:
name: SonarCloud check secrets are present
runs-on: ubuntu-latest
outputs:
github: ${{ steps.check-secrets.outputs.github }}
sonar: ${{ steps.check-secrets.outputs.sonar }}
steps:
- name: Check secrets are present
id: check-secrets
run: |
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then
echo "::set-output name=github::yes"
else
echo "::set-output name=github::no"
echo "::warning ::GITHUB_TOKEN non set"
fi
if [ -n "${{ secrets.SONAR_TOKEN }}" ]; then
echo "::set-output name=sonar::yes"
else
echo "::set-output name=sonar::no"
echo "::warning ::SONAR_TOKEN non set"
fi
sonarcloud:
name: SonarCloud Scan and Report
needs: [ "tests-coverage", "sonarcloud-secrets" ]
if: ${{ needs.sonarcloud-secrets.outputs.github == 'yes' && needs.sonarcloud-secrets.outputs.sonar == 'yes' }}
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow clone to provide blame information
run: git fetch --unshallow
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
tools: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
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
with:
name: code-coverage
path: build/coverage
- name: Prepare SonarCloud Code Coverage Files
run: |
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/junit.xml > build/sonar-junit.xml
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/clover.xml > build/sonar-coverage.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
10 changes: 5 additions & 5 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.1.0" installed="3.1.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcs" version="^3.6.0" installed="3.6.0" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.6.0" installed="3.6.0" location="./tools/phpcbf" copy="false"/>
<phar name="phpstan" version="^0.12.98" installed="0.12.98" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="^4.9.3" installed="4.9.3" location="./tools/psalm" copy="false"/>
<phar name="php-cs-fixer" version="^3.6.0" installed="3.6.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.6" installed="1.4.6" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="^4.21.0" installed="4.21.0" location="./tools/psalm" copy="false"/>
<phar name="infection" version="^0.23.0" installed="0.23.0" location="./tools/infection" copy="false"/>
</phive>
19 changes: 0 additions & 19 deletions .scrutinizer.yml

This file was deleted.

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 - 2021 PhpCfdi https://www.phpcfdi.com/
Copyright (c) 2019 - 2022 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
Loading

0 comments on commit 332a34c

Please sign in to comment.