Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Toolkit #15

Merged
merged 1 commit into from
Dec 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/deduplicate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ on:
branches:
- 'develop'
paths:
- 'app/**'
- 'src/**'
- 'tests/**'
- '.github/workflows/test-phpcpd.yml'
- '.github/workflows/deduplicate.yml'
push:
branches:
- 'develop'
paths:
- 'app/**'
- 'src/**'
- 'tests/**'
- '.github/workflows/test-phpcpd.yml'
- '.github/workflows/deduplicate.yml'

jobs:
build:
Expand All @@ -30,10 +32,8 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
tools: phive
extensions: intl, json, mbstring, xml
tools: phpcpd
extensions: dom, mbstring

- name: Detect code duplication
run: |
sudo phive --no-progress install --global --trust-gpg-keys 4AA394086372C20A phpcpd
phpcpd src/ tests/
run: phpcpd app/ src/ tests/
4 changes: 2 additions & 2 deletions .github/workflows/inspect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ jobs:

- name: Run architectural inspection
run: |
sudo phive --no-progress install --global --trust-gpg-keys B8F640134AB1782E,A98E898BB53EB748 qossmic/deptrac
deptrac analyze --cache-file=build/deptrac.cache
sudo phive --no-progress install --global --trust-gpg-keys B8F640134AB1782E,A98E898BB53EB748 qossmic/deptrac
deptrac analyze --cache-file=build/deptrac.cache
8 changes: 5 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer, pecl, phpunit
tools: composer, infection, pecl, phive, phpunit
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
coverage: xdebug
env:
Expand Down Expand Up @@ -64,13 +64,15 @@ jobs:
- if: matrix.php-versions == '8.0'
name: Mutate with Infection
run: |
composer global require infection/infection
git fetch --depth=1 origin $GITHUB_BASE_REF
infection --threads=2 --skip-initial-tests --coverage=build/phpunit --git-diff-base=origin/$GITHUB_BASE_REF --git-diff-filter=AM --logger-github --ignore-msi-with-no-mutations

- if: matrix.php-versions == '8.0'
name: Run Coveralls
run: vendor/bin/php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
continue-on-error: true
run: |
sudo phive --no-progress install --global --trust-gpg-keys E82B2FB314E9906E php-coveralls
php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/unused.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# When a PR is opened or a push is made, check code
# for unused packages with Composer Unused.
name: Unused

on:
pull_request:
branches:
- 'develop'
paths:
- 'src/**'
- 'tests/**'
- '.github/workflows/unused.yml'
push:
branches:
- 'develop'
paths:
- 'src/**'
- 'tests/**'
- '.github/workflows/unused.yml'

jobs:
build:
name: Unused Package Detection
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
tools: composer, composer-unused
extensions: intl, json, mbstring, xml
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer 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 dependencies (limited)
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: Install dependencies (authenticated)
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

- name: Detect unused packages
run: composer-unused -vvv --profile --ansi --no-interaction --no-progress --excludePackage=php
27 changes: 12 additions & 15 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
<?php

/**
* This file is part of Tatter Alerts.
*
* (c) 2021 Tatter Software
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
use PhpCsFixer\Finder;
use Tatter\Tools\Standard;

$finder = Finder::create()
->files()
Expand All @@ -20,18 +11,24 @@
->append([__FILE__]);

// Remove overrides for incremental changes
$overrides = [];
$overrides = [
'array_indentation' => false,
'braces' => false,
'indentation_type' => false,
];

$options = [
'finder' => $finder,
'cacheFile' => 'build/.php-cs-fixer.cache',
];

return Factory::create(new Standard(), $overrides, $options)->forLibrary(
'Tatter Alerts',
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();

/* Reenable For libraries after incremental changes are applied
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
'Tatter ________',
'Tatter Software',
'',
2021
);

return Factory::create(new Standard(), $overrides, $options)->forProjects();
*/
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"require-dev": {
"codeigniter4/codeigniter4": "dev-develop",
"tatter/tools": "^1.11"
"tatter/tools": "^1.15"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -55,14 +55,13 @@
"@deduplicate",
"@analyze",
"@test",
"@mutate",
"@inspect",
"@style"
],
"deduplicate": "phpcpd app/ src/",
"inspect": "deptrac analyze --cache-file=build/deptrac.cache",
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
"style": "php-cs-fixer fix --verbose --ansi",
"style": "php-cs-fixer fix --verbose --ansi --using-cache=no",
"test": "phpunit"
}
}
3 changes: 3 additions & 0 deletions depfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@ ruleset:
- Entity
- Service
- Vendor Config
- Vendor Entity
- Vendor Model
Service:
- Config
- Vendor Config

# Ignore anything in the Vendor layers
Vendor Model:
- Config
- Service
- Vendor Config
- Vendor Controller
Expand All @@ -130,6 +132,7 @@ ruleset:
- Vendor Model
- Vendor View
Vendor Config:
- Config
- Service
- Vendor Config
- Vendor Controller
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
- tests
bootstrapFiles:
- vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php
excludes_analyse:
excludePaths:
- src/Config/Routes.php
- src/Views/*
ignoreErrors:
Expand Down