Skip to content

Commit

Permalink
Update check with GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
antalaron committed Oct 24, 2024
1 parent 14b6abb commit 445850e
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 143 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test

on:
push:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: intl, mbstring
- name: Run PHP CS Fixer
run: |
mkdir -p tools/php-cs-fixer
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer:3.57.1 kubawerlos/php-cs-fixer-custom-fixers
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --diff --dry-run -vvv --config=.php-cs-fixer.dist.php --show-progress=none
tests:
name: Test project
needs: [php-cs-fixer]
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['5.6', '7.0', '7.4', '8.1', '8.2']
dependency: [lowest, highest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: intl, mbstring
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: |
if [ "${{ matrix.dependency }}" == "lowest" ]; then
composer update --prefer-lowest --prefer-stable --no-progress --no-suggest
else
composer install --prefer-dist --no-progress --no-suggest
fi
- name: Run PHPUnit
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ vendor/
composer.lock
.php_cs.cache
.php_cs
tools/
56 changes: 56 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

/*
* (c) Antal Áron <antalaron@antalaron.hu>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

$header = <<<'EOF'
(c) Antal Áron <antalaron@antalaron.hu>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setUsingCache(false)
->setRules([
'@DoctrineAnnotation' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_before_statement' => ['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'phpdoc', 'return', 'throw', 'yield', 'yield_from']],
'header_comment' => ['header' => $header],
'heredoc_to_nowdoc' => true,
'linebreak_after_opening_tag' => true,
'modernize_strpos' => true,
'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'],
'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']],
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'phpdoc_to_comment' => ['ignored_tags' => ['var']],
'no_useless_return' => true,
'nullable_type_declaration_for_default_null_value' => true,
'ordered_class_elements' => ['order' => ['use_trait', 'constant_public', 'constant_protected', 'constant_private', 'property_public', 'property_protected', 'property_private', 'construct', 'destruct']],
'ordered_imports' => true,
'ordered_interfaces' => true,
'psr_autoloading' => true,
'strict_comparison' => true,
'strict_param' => true,
'trailing_comma_in_multiline' => ['after_heredoc' => false, 'elements' => ['arguments', 'arrays']],
'yoda_style' => ['equal' => true, 'identical' => true, 'less_and_greater' => true, 'always_move_variable' => true],
])
->setFinder(
(new PhpCsFixer\Finder())
->in(__DIR__)
->append([
__FILE__,
])
->exclude([
'vendor',
]),
)
;
42 changes: 0 additions & 42 deletions .php_cs.dist

This file was deleted.

41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VAT number validator
====================

[![Build Status](https://travis-ci.org/antalaron/vat-number-validator.svg?branch=master)](https://travis-ci.org/antalaron/vat-number-validator) [![Coverage Status](https://coveralls.io/repos/github/antalaron/vat-number-validator/badge.svg)](https://coveralls.io/github/antalaron/vat-number-validator?branch=master) [![Latest Stable Version](https://poser.pugx.org/antalaron/vat-number-validator/v/stable)](https://packagist.org/packages/antalaron/vat-number-validator) [![Latest Unstable Version](https://poser.pugx.org/antalaron/vat-number-validator/v/unstable)](https://packagist.org/packages/antalaron/vat-number-validator) [![License](https://poser.pugx.org/antalaron/vat-number-validator/license)](https://packagist.org/packages/antalaron/vat-number-validator)
[![PHP Tests](https://github.com/antalaron/vat-number-validator/actions/workflows/php.yml/badge.svg)](https://github.com/antalaron/vat-number-validator) [![Latest Stable Version](https://poser.pugx.org/antalaron/vat-number-validator/v/stable)](https://packagist.org/packages/antalaron/vat-number-validator) [![Latest Unstable Version](https://poser.pugx.org/antalaron/vat-number-validator/v/unstable)](https://packagist.org/packages/antalaron/vat-number-validator) [![License](https://poser.pugx.org/antalaron/vat-number-validator/license)](https://packagist.org/packages/antalaron/vat-number-validator)

PHP library to validate VAT numbers.

Expand Down
59 changes: 0 additions & 59 deletions appveyor.yml

This file was deleted.

0 comments on commit 445850e

Please sign in to comment.