Skip to content

Commit 7aef8b9

Browse files
authored
Merge pull request #15 from tattersoftware/tools
Update Toolkit
2 parents f01d829 + 07abf7e commit 7aef8b9

File tree

8 files changed

+92
-31
lines changed

8 files changed

+92
-31
lines changed

.github/workflows/deduplicate.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ on:
77
branches:
88
- 'develop'
99
paths:
10+
- 'app/**'
1011
- 'src/**'
1112
- 'tests/**'
12-
- '.github/workflows/test-phpcpd.yml'
13+
- '.github/workflows/deduplicate.yml'
1314
push:
1415
branches:
1516
- 'develop'
1617
paths:
18+
- 'app/**'
1719
- 'src/**'
1820
- 'tests/**'
19-
- '.github/workflows/test-phpcpd.yml'
21+
- '.github/workflows/deduplicate.yml'
2022

2123
jobs:
2224
build:
@@ -30,10 +32,8 @@ jobs:
3032
uses: shivammathur/setup-php@v2
3133
with:
3234
php-version: '8.0'
33-
tools: phive
34-
extensions: intl, json, mbstring, xml
35+
tools: phpcpd
36+
extensions: dom, mbstring
3537

3638
- name: Detect code duplication
37-
run: |
38-
sudo phive --no-progress install --global --trust-gpg-keys 4AA394086372C20A phpcpd
39-
phpcpd src/ tests/
39+
run: phpcpd app/ src/ tests/

.github/workflows/inspect.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ jobs:
7575

7676
- name: Run architectural inspection
7777
run: |
78-
sudo phive --no-progress install --global --trust-gpg-keys B8F640134AB1782E,A98E898BB53EB748 qossmic/deptrac
79-
deptrac analyze --cache-file=build/deptrac.cache
78+
sudo phive --no-progress install --global --trust-gpg-keys B8F640134AB1782E,A98E898BB53EB748 qossmic/deptrac
79+
deptrac analyze --cache-file=build/deptrac.cache

.github/workflows/test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: shivammathur/setup-php@v2
2929
with:
3030
php-version: ${{ matrix.php-versions }}
31-
tools: composer, pecl, phpunit
31+
tools: composer, infection, pecl, phive, phpunit
3232
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
3333
coverage: xdebug
3434
env:
@@ -64,13 +64,15 @@ jobs:
6464
- if: matrix.php-versions == '8.0'
6565
name: Mutate with Infection
6666
run: |
67-
composer global require infection/infection
6867
git fetch --depth=1 origin $GITHUB_BASE_REF
6968
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
7069
7170
- if: matrix.php-versions == '8.0'
7271
name: Run Coveralls
73-
run: vendor/bin/php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
72+
continue-on-error: true
73+
run: |
74+
sudo phive --no-progress install --global --trust-gpg-keys E82B2FB314E9906E php-coveralls
75+
php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
7476
env:
7577
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7678
COVERALLS_PARALLEL: true

.github/workflows/unused.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# When a PR is opened or a push is made, check code
2+
# for unused packages with Composer Unused.
3+
name: Unused
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- 'develop'
9+
paths:
10+
- 'src/**'
11+
- 'tests/**'
12+
- '.github/workflows/unused.yml'
13+
push:
14+
branches:
15+
- 'develop'
16+
paths:
17+
- 'src/**'
18+
- 'tests/**'
19+
- '.github/workflows/unused.yml'
20+
21+
jobs:
22+
build:
23+
name: Unused Package Detection
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: '8.0'
33+
tools: composer, composer-unused
34+
extensions: intl, json, mbstring, xml
35+
env:
36+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Get composer cache directory
39+
id: composer-cache
40+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
41+
42+
- name: Cache composer dependencies
43+
uses: actions/cache@v2
44+
with:
45+
path: ${{ steps.composer-cache.outputs.dir }}
46+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
47+
restore-keys: ${{ runner.os }}-composer-
48+
49+
- name: Install dependencies (limited)
50+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
51+
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
52+
53+
- name: Install dependencies (authenticated)
54+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
55+
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
56+
env:
57+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
58+
59+
- name: Detect unused packages
60+
run: composer-unused -vvv --profile --ansi --no-interaction --no-progress --excludePackage=php

.php-cs-fixer.dist.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
<?php
22

3-
/**
4-
* This file is part of Tatter Alerts.
5-
*
6-
* (c) 2021 Tatter Software
7-
*
8-
* For the full copyright and license information, please view
9-
* the LICENSE file that was distributed with this source code.
10-
*/
11-
3+
use CodeIgniter\CodingStandard\CodeIgniter4;
124
use Nexus\CsConfig\Factory;
135
use PhpCsFixer\Finder;
14-
use Tatter\Tools\Standard;
156

167
$finder = Finder::create()
178
->files()
@@ -20,18 +11,24 @@
2011
->append([__FILE__]);
2112

2213
// Remove overrides for incremental changes
23-
$overrides = [];
14+
$overrides = [
15+
'array_indentation' => false,
16+
'braces' => false,
17+
'indentation_type' => false,
18+
];
2419

2520
$options = [
2621
'finder' => $finder,
2722
'cacheFile' => 'build/.php-cs-fixer.cache',
2823
];
2924

30-
return Factory::create(new Standard(), $overrides, $options)->forLibrary(
31-
'Tatter Alerts',
25+
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
26+
27+
/* Reenable For libraries after incremental changes are applied
28+
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
29+
'Tatter ________',
3230
'Tatter Software',
3331
'',
3432
2021
3533
);
36-
37-
return Factory::create(new Standard(), $overrides, $options)->forProjects();
34+
*/

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"require-dev": {
2626
"codeigniter4/codeigniter4": "dev-develop",
27-
"tatter/tools": "^1.11"
27+
"tatter/tools": "^1.15"
2828
},
2929
"autoload": {
3030
"psr-4": {
@@ -55,14 +55,13 @@
5555
"@deduplicate",
5656
"@analyze",
5757
"@test",
58-
"@mutate",
5958
"@inspect",
6059
"@style"
6160
],
6261
"deduplicate": "phpcpd app/ src/",
6362
"inspect": "deptrac analyze --cache-file=build/deptrac.cache",
6463
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
65-
"style": "php-cs-fixer fix --verbose --ansi",
64+
"style": "php-cs-fixer fix --verbose --ansi --using-cache=no",
6665
"test": "phpunit"
6766
}
6867
}

depfile.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ ruleset:
109109
- Entity
110110
- Service
111111
- Vendor Config
112+
- Vendor Entity
112113
- Vendor Model
113114
Service:
114115
- Config
115116
- Vendor Config
116117

117118
# Ignore anything in the Vendor layers
118119
Vendor Model:
120+
- Config
119121
- Service
120122
- Vendor Config
121123
- Vendor Controller
@@ -130,6 +132,7 @@ ruleset:
130132
- Vendor Model
131133
- Vendor View
132134
Vendor Config:
135+
- Config
133136
- Service
134137
- Vendor Config
135138
- Vendor Controller

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ parameters:
66
- tests
77
bootstrapFiles:
88
- vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php
9-
excludes_analyse:
9+
excludePaths:
1010
- src/Config/Routes.php
1111
- src/Views/*
1212
ignoreErrors:

0 commit comments

Comments
 (0)