From 79da0024ff812225fbceecac15ea7bf997968c73 Mon Sep 17 00:00:00 2001 From: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> Date: Sun, 13 Nov 2022 18:41:53 +0000 Subject: [PATCH] Add PHP Linting (Pint) github action Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> --- .github/workflows/pint.yml | 25 +++++++++++++++++++++++++ .github/workflows/tests.yml | 31 +++++++++++++++++++++++++++++++ pint.json | 21 +++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 .github/workflows/pint.yml create mode 100644 .github/workflows/tests.yml create mode 100644 pint.json diff --git a/.github/workflows/pint.yml b/.github/workflows/pint.yml new file mode 100644 index 0000000..a11d65e --- /dev/null +++ b/.github/workflows/pint.yml @@ -0,0 +1,25 @@ +name: PHP Linting (Pint) + +on: [push, pull_request] + +jobs: + phplint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Composer Install + run: composer install --no-interaction --ignore-platform-reqs + + - name: Remove Extensions & Themes + run: rm -rf extensions themes + + - name: Run Laravel Pint + run: ./vendor/bin/pint + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: PHP Linting (Pint) - Fix styling + skip_fetch: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..dd8a46e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,31 @@ +name: Tests + +on: [push, pull_request] + +jobs: + PHPUnitTests: + runs-on: ubuntu-latest + + strategy: + max-parallel: 6 + matrix: + php: ['7.4', '8.0', '8.1'] + fail-fast: false + + name: 'PHPUnit Tests ${{ matrix.php }} / ${{ matrix.dbName }}' + + steps: + - name: Checkout changes + uses: actions/checkout@v1 + + - name: Install PHP + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php }} + extensions: mbstring, intl, gd, xml, sqlite + + - name: Install composer dependencies + run: composer install --no-interaction --no-progress --no-scripts + + - name: Run PHPUnit Test Suite + run: ./vendor/bin/phpunit ./tests diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..ca3348f --- /dev/null +++ b/pint.json @@ -0,0 +1,21 @@ +{ + "rules": { + "method_chaining_indentation": true, + "logical_operators": true, + "simplified_null_return": false, + "cast_spaces": false, + "no_unreachable_default_argument_value": false, + "no_alternative_syntax": false, + "not_operator_with_successor_space": false, + "no_trailing_comma_in_list_call": false, + "phpdoc_summary": false, + "braces": false, + "self_accessor": false, + "Laravel/laravel_phpdoc_separation": false, + "Laravel/laravel_phpdoc_alignment": false, + "no_trailing_comma_in_singleline": false, + "blank_line_before_statement": { + "statements": ["declare", "return", "throw", "try"] + } + } +}