diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml new file mode 100644 index 0000000..56c5e5f --- /dev/null +++ b/.github/workflows/code-style.yml @@ -0,0 +1,56 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +on: + - pull_request + +name: "Code style" + +jobs: + run: + name: "Code Style" + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest] + php-versions: ['7.4'] + + steps: + - name: Set git to use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - name: Checkout + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 1 + + - name: Install PHP + uses: shivammathur/setup-php@2.11.0 + with: + php-version: ${{ matrix.php-versions }} + extensions: gd,mbstring,pcov + tools: cs2pr + + - 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.1.6 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: Run Grumphp + run: vendor/bin/grumphp run --testsuite=cs -n + + - name: Send feedback on Github + if: ${{ failure() }} + run: | + vendor/bin/php-cs-fixer --allow-risky=yes --config=.php_cs.dist fix --dry-run --format=checkstyle | cs2pr diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 0000000..2b8da3a --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,62 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +on: + - pull_request + - push + +name: "Static analysis" + +jobs: + run: + name: "Static Analysis" + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest] + php-versions: ['7.4', '8.0'] + + steps: + - name: Set git to use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - name: Checkout + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 1 + + - name: Install PHP + uses: shivammathur/setup-php@2.11.0 + with: + php-version: ${{ matrix.php-versions }} + extensions: gd,mbstring,pcov,xdebug + tools: cs2pr + + - 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.1.6 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: Run Grumphp + run: vendor/bin/grumphp run --tasks=psalm,phpstan -n + + - name: Send feedback on Github + if: ${{ failure() }} + run: | + vendor/bin/phpstan analyse -l max --error-format=checkstyle src/ | cs2pr + vendor/bin/psalm --output-format=github | cs2pr + + - name: Send PSALM data + run: vendor/bin/psalm --shepherd --stats src/ + continue-on-error: true diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/tests.yml similarity index 61% rename from .github/workflows/continuous-integration.yml rename to .github/workflows/tests.yml index d5e2776..34446b7 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/tests.yml @@ -4,17 +4,17 @@ on: - pull_request - push -name: "Continuous Integration" +name: "Unit tests" jobs: run: - name: "Grumphp" + name: "Unit Tests" runs-on: ${{ matrix.operating-system }} strategy: fail-fast: false matrix: operating-system: [ubuntu-latest, windows-latest] - php-versions: ['7.4'] + php-versions: ['7.4', '8.0'] steps: - name: Set git to use LF @@ -23,15 +23,15 @@ jobs: git config --global core.eol lf - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v2.3.4 with: fetch-depth: 1 - name: Install PHP - uses: shivammathur/setup-php@master + uses: shivammathur/setup-php@2.11.0 with: php-version: ${{ matrix.php-versions }} - extensions: xdebug,mbstring + extensions: gd,mbstring,pcov,xdebug - name: Get Composer Cache Directory id: composer-cache @@ -45,29 +45,13 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies - run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader + run: composer install --no-progress --prefer-dist --optimize-autoloader - name: Run Grumphp - run: vendor/bin/grumphp run - - - name: Send PSALM data - run: vendor/bin/psalm --shepherd --stats src/ - continue-on-error: true + run: vendor/bin/grumphp run --tasks=phpspec - name: Send Scrutinizer data run: | wget https://scrutinizer-ci.com/ocular.phar php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml continue-on-error: true - - - name: Infection score report - run: | - vendor/bin/infection run -j 2 - continue-on-error: true - - - name: PHP Insights report - run: | - rm -rf composer.lock vendor - composer require nunomaduro/phpinsights --dev - vendor/bin/phpinsights analyse src/ -n - continue-on-error: true