Skip to content

Commit f8a7229

Browse files
committed
Update toolkit
1 parent 386302d commit f8a7229

File tree

9 files changed

+382
-25
lines changed

9 files changed

+382
-25
lines changed

.github/workflows/deduplicate.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# When a PR is opened or a push is made, check code
2+
# for duplication with PHP Copy/Paste Detector.
3+
name: PHPCPD
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- 'develop'
9+
paths:
10+
- 'app/**'
11+
- 'src/**'
12+
- 'tests/**'
13+
- '.github/workflows/deduplicate.yml'
14+
push:
15+
branches:
16+
- 'develop'
17+
paths:
18+
- 'app/**'
19+
- 'src/**'
20+
- 'tests/**'
21+
- '.github/workflows/deduplicate.yml'
22+
23+
jobs:
24+
build:
25+
name: Duplicate Code Detection
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v2
30+
31+
- name: Setup PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: '8.0'
35+
tools: phpcpd
36+
extensions: dom, mbstring
37+
38+
- name: Detect code duplication
39+
run: phpcpd app/ src/ tests/

.github/workflows/inspect.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# When a PR is opened or a push is made, perform an
2+
# architectural inspection on the code using Deptrac.
3+
name: Deptrac
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- 'develop'
9+
paths:
10+
- 'src/**'
11+
- 'tests/**'
12+
- 'composer.**'
13+
- 'depfile.yaml'
14+
- '.github/workflows/inspect.yml'
15+
push:
16+
branches:
17+
- 'develop'
18+
paths:
19+
- 'src/**'
20+
- 'tests/**'
21+
- 'composer.**'
22+
- 'depfile.yaml'
23+
- '.github/workflows/inspect.yml'
24+
25+
jobs:
26+
build:
27+
name: Architectural Inspection
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v2
32+
33+
- name: Setup PHP
34+
uses: shivammathur/setup-php@v2
35+
with:
36+
php-version: '8.0'
37+
tools: composer, pecl, phive
38+
extensions: intl, json, mbstring, xml
39+
env:
40+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Get composer cache directory
43+
id: composer-cache
44+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
45+
46+
- name: Create composer cache directory
47+
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}
48+
49+
- name: Cache composer dependencies
50+
uses: actions/cache@v2
51+
with:
52+
path: ${{ steps.composer-cache.outputs.dir }}
53+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
54+
restore-keys: ${{ runner.os }}-composer-
55+
56+
- name: Create Deptrac cache directory
57+
run: mkdir -p build/
58+
59+
- name: Cache Deptrac results
60+
uses: actions/cache@v2
61+
with:
62+
path: build
63+
key: ${{ runner.os }}-deptrac-${{ github.sha }}
64+
restore-keys: ${{ runner.os }}-deptrac-
65+
66+
- name: Install dependencies (limited)
67+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
68+
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
69+
70+
- name: Install dependencies (authenticated)
71+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
72+
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
73+
env:
74+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
75+
76+
- name: Run architectural inspection
77+
run: |
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: 6 additions & 6 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:
@@ -55,24 +55,24 @@ jobs:
5555
env:
5656
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
5757

58-
- name: Enable Tachycardia
59-
run: echo "TACHYCARDIA_MONITOR_GA=enabled" >> $GITHUB_ENV
60-
6158
- name: Test with PHPUnit
6259
run: vendor/bin/phpunit --verbose --coverage-text
6360
env:
6461
TERM: xterm-256color
62+
TACHYCARDIA_MONITOR_GA: enabled
6563

6664
- if: matrix.php-versions == '8.0'
6765
name: Mutate with Infection
6866
run: |
69-
composer global require infection/infection
7067
git fetch --depth=1 origin $GITHUB_BASE_REF
7168
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
7269
7370
- if: matrix.php-versions == '8.0'
7471
name: Run Coveralls
75-
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
7676
env:
7777
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7878
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: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
11
<?php
22

3+
use CodeIgniter\CodingStandard\CodeIgniter4;
34
use Nexus\CsConfig\Factory;
45
use PhpCsFixer\Finder;
5-
use Tatter\Tools\Standard;
66

77
$finder = Finder::create()
88
->files()
99
->in(__DIR__)
1010
->exclude('build')
1111
->append([__FILE__]);
1212

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

2015
$options = [
2116
'finder' => $finder,
2217
'cacheFile' => 'build/.php-cs-fixer.cache',
2318
];
2419

25-
/* Reenable after incremental changes are applied
26-
return Factory::create(new Standard(), $overrides, $options)->forLibrary(
27-
'Library',
28-
'Tatter Software',
29-
'',
30-
2021
31-
);
32-
*/
33-
return Factory::create(new Standard(), $overrides, $options)->forProjects();
20+
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();

SECURITY.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Security Policy
2+
3+
The development team and community take all security issues seriously. **Please do not make public any uncovered flaws.**
4+
5+
## Reporting a Vulnerability
6+
7+
Thank you for improving the security of our code! Any assistance in removing security flaws will be acknowledged.
8+
9+
**Please report security flaws by emailing the development team directly: [email protected]**.
10+
11+
The lead maintainer will acknowledge your email within 48 hours, and will send a more detailed response within 48 hours indicating
12+
the next steps in handling your report. After the initial reply to your report, the security team will endeavor to keep you informed of the
13+
progress towards a fix and full announcement, and may ask for additional information or guidance.
14+
15+
## Disclosure Policy
16+
17+
When the security team receives a security bug report, they will assign it to a primary handler.
18+
This person will coordinate the fix and release process, involving the following steps:
19+
20+
- Confirm the problem and determine the affected versions.
21+
- Audit code to find any potential similar problems.
22+
- Prepare fixes for all releases still under maintenance. These fixes will be released as fast as possible.
23+
24+
## Comments on this Policy
25+
26+
If you have suggestions on how this process could be improved please submit a Pull Request.

composer.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"require-dev": {
2727
"codeigniter4/codeigniter4": "dev-develop",
28-
"tatter/tools": "^1.10"
28+
"tatter/tools": "^1.15"
2929
},
3030
"autoload": {
3131
"psr-4": {
@@ -50,8 +50,18 @@
5050
"prefer-stable": true,
5151
"scripts": {
5252
"analyze": "phpstan analyze",
53+
"ci": [
54+
"Composer\\Config::disableProcessTimeout",
55+
"@deduplicate",
56+
"@analyze",
57+
"@test",
58+
"@inspect",
59+
"@style"
60+
],
61+
"deduplicate": "phpcpd app/ src/",
62+
"inspect": "deptrac analyze --cache-file=build/deptrac.cache",
5363
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
54-
"style": "php-cs-fixer fix --verbose --ansi",
64+
"style": "php-cs-fixer fix --verbose --ansi --using-cache=no",
5565
"test": "phpunit"
5666
}
5767
}

0 commit comments

Comments
 (0)