Skip to content

Commit db6fbc3

Browse files
authored
Merge pull request #13 from tattersoftware/tools
Update Tools & Styles
2 parents 5f71e15 + f2433ac commit db6fbc3

23 files changed

+739
-273
lines changed

.github/workflows/analyze.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ jobs:
3939
with:
4040
php-version: ${{ matrix.php-versions }}
4141
tools: composer, pecl, phpunit
42-
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3
42+
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
43+
env:
44+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4345

4446
- name: Get composer cache directory
4547
id: composer-cache
@@ -65,7 +67,12 @@ jobs:
6567
key: ${{ runner.os }}-phpstan-${{ github.sha }}
6668
restore-keys: ${{ runner.os }}-phpstan-
6769

68-
- name: Install dependencies
70+
- name: Install dependencies (limited)
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+
74+
- name: Install dependencies (authenticated)
75+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
6976
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
7077
env:
7178
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

.github/workflows/compare.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# When a PR is opened or a push is made, compare
2+
# code for backwards compatibility.
3+
name: RoaveBC
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- develop
9+
paths:
10+
- 'src/**'
11+
12+
jobs:
13+
compare:
14+
name: Compare for Backwards Compatibility
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Run comparison (limited)
22+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
23+
uses: docker://nyholm/roave-bc-check-ga
24+
25+
- name: Run comparison (authenticated)
26+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
27+
uses: docker://nyholm/roave-bc-check-ga
28+
env:
29+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

.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+
- 'src/**'
11+
- 'tests/**'
12+
- '.github/workflows/test-phpcpd.yml'
13+
push:
14+
branches:
15+
- 'develop'
16+
paths:
17+
- 'src/**'
18+
- 'tests/**'
19+
- '.github/workflows/test-phpcpd.yml'
20+
21+
jobs:
22+
build:
23+
name: Duplicate Code 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: phive
34+
extensions: intl, json, mbstring, xml
35+
36+
- name: Detect code duplication
37+
run: |
38+
sudo phive --no-progress install --global --trust-gpg-keys 4AA394086372C20A phpcpd
39+
phpcpd 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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ jobs:
2929
with:
3030
php-version: ${{ matrix.php-versions }}
3131
tools: composer, pecl, phpunit
32-
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3
32+
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
3333
coverage: xdebug
34+
env:
35+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3436

3537
- name: Get composer cache directory
3638
id: composer-cache
@@ -43,7 +45,12 @@ jobs:
4345
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
4446
restore-keys: ${{ runner.os }}-composer-
4547

46-
- name: Install dependencies
48+
- name: Install dependencies (limited)
49+
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
50+
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
51+
52+
- name: Install dependencies (authenticated)
53+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
4754
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
4855
env:
4956
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
@@ -52,6 +59,7 @@ jobs:
5259
run: vendor/bin/phpunit --verbose --coverage-text
5360
env:
5461
TERM: xterm-256color
62+
TACHYCARDIA_MONITOR_GA: enabled
5563

5664
- if: matrix.php-versions == '8.0'
5765
name: Mutate with Infection

.php-cs-fixer.dist.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
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+
12+
use Nexus\CsConfig\Factory;
13+
use PhpCsFixer\Finder;
14+
use Tatter\Tools\Standard;
15+
16+
$finder = Finder::create()
17+
->files()
18+
->in(__DIR__)
19+
->exclude('build')
20+
->append([__FILE__]);
21+
22+
// Remove overrides for incremental changes
23+
$overrides = [];
24+
25+
$options = [
26+
'finder' => $finder,
27+
'cacheFile' => 'build/.php-cs-fixer.cache',
28+
];
29+
30+
return Factory::create(new Standard(), $overrides, $options)->forLibrary(
31+
'Tatter Alerts',
32+
'Tatter Software',
33+
'',
34+
2021
35+
);
36+
37+
return Factory::create(new Standard(), $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: 66 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,68 @@
11
{
2-
"name": "tatter/alerts",
3-
"type": "library",
4-
"description": "Lightweight user alerts for CodeIgniter 4",
5-
"keywords": [
6-
"codeigniter",
7-
"codeigniter4",
8-
"alerts",
9-
"dialogs",
10-
"messages"
11-
],
12-
"homepage": "https://github.com/tattersoftware/codeigniter4-alerts",
13-
"license": "MIT",
14-
"authors": [
15-
{
16-
"name": "Matthew Gatner",
17-
"email": "[email protected]",
18-
"homepage": "https://tattersoftware.com",
19-
"role": "Developer"
20-
}
21-
],
22-
"require": {
23-
"php": "^7.3 || ^8.0"
24-
},
25-
"require-dev": {
26-
"codeigniter4/codeigniter4": "dev-develop",
27-
"tatter/tools": "^1.6"
28-
},
29-
"autoload": {
30-
"psr-4": {
31-
"Tatter\\Alerts\\": "src"
32-
},
33-
"exclude-from-classmap": [
34-
"**/Database/Migrations/**"
35-
]
36-
},
37-
"autoload-dev": {
38-
"psr-4": {
39-
"Tests\\Support\\": "tests/_support"
40-
}
41-
},
42-
"repositories": [
43-
{
44-
"type": "vcs",
45-
"url": "https://github.com/codeigniter4/CodeIgniter4",
46-
"no-api": true
47-
}
48-
],
49-
"minimum-stability": "dev",
50-
"prefer-stable": true,
51-
"scripts": {
52-
"analyze": "phpstan analyze",
53-
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
54-
"style": "phpcbf --standard=./vendor/codeigniter4/codeigniter4-standard/CodeIgniter4 tests/ src/",
55-
"test": "phpunit"
56-
}
2+
"name": "tatter/alerts",
3+
"type": "library",
4+
"description": "Lightweight user alerts for CodeIgniter 4",
5+
"keywords": [
6+
"codeigniter",
7+
"codeigniter4",
8+
"alerts",
9+
"dialogs",
10+
"messages"
11+
],
12+
"homepage": "https://github.com/tattersoftware/codeigniter4-alerts",
13+
"license": "MIT",
14+
"authors": [
15+
{
16+
"name": "Matthew Gatner",
17+
"email": "[email protected]",
18+
"homepage": "https://tattersoftware.com",
19+
"role": "Developer"
20+
}
21+
],
22+
"require": {
23+
"php": "^7.3 || ^8.0"
24+
},
25+
"require-dev": {
26+
"codeigniter4/codeigniter4": "dev-develop",
27+
"tatter/tools": "^1.11"
28+
},
29+
"autoload": {
30+
"psr-4": {
31+
"Tatter\\Alerts\\": "src"
32+
},
33+
"exclude-from-classmap": [
34+
"**/Database/Migrations/**"
35+
]
36+
},
37+
"autoload-dev": {
38+
"psr-4": {
39+
"Tests\\Support\\": "tests/_support"
40+
}
41+
},
42+
"repositories": [
43+
{
44+
"type": "vcs",
45+
"url": "https://github.com/codeigniter4/CodeIgniter4",
46+
"no-api": true
47+
}
48+
],
49+
"minimum-stability": "dev",
50+
"prefer-stable": true,
51+
"scripts": {
52+
"analyze": "phpstan analyze",
53+
"ci": [
54+
"Composer\\Config::disableProcessTimeout",
55+
"@deduplicate",
56+
"@analyze",
57+
"@test",
58+
"@mutate",
59+
"@inspect",
60+
"@style"
61+
],
62+
"deduplicate": "phpcpd app/ src/",
63+
"inspect": "deptrac analyze --cache-file=build/deptrac.cache",
64+
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
65+
"style": "php-cs-fixer fix --verbose --ansi",
66+
"test": "phpunit"
67+
}
5768
}

0 commit comments

Comments
 (0)