Skip to content

Commit 403ca83

Browse files
committed
Apply updated dev toolkit
1 parent 578629d commit 403ca83

15 files changed

+692
-90
lines changed

.gitattributes

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/.github export-ignore
2+
/docs export-ignore
3+
/examples export-ignore
4+
/tests export-ignore
5+
/.editorconfig export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/phpstan.neon.dist export-ignore
10+
11+
# Configure diff output for .php and .phar files.
12+
*.php diff=php
13+
*.phar -diff

.github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: daily

.github/workflows/analyze.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# When a PR is opened or a push is made, perform
2+
# a static analysis check on the code using PHPStan.
3+
name: PHPStan
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- 'develop'
9+
paths:
10+
- 'src/**'
11+
- 'tests/**'
12+
- 'composer.**'
13+
- 'phpstan*'
14+
- '.github/workflows/analyze.yml'
15+
push:
16+
branches:
17+
- 'develop'
18+
paths:
19+
- 'src/**'
20+
- 'tests/**'
21+
- 'composer.**'
22+
- 'phpstan*'
23+
- '.github/workflows/analyze.yml'
24+
25+
jobs:
26+
build:
27+
name: PHP ${{ matrix.php-versions }} Static Analysis
28+
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
php-versions: ['7.3', '7.4', '8.0']
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: ${{ matrix.php-versions }}
41+
tools: composer, pecl, phpunit
42+
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
43+
env:
44+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Get composer cache directory
47+
id: composer-cache
48+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
49+
50+
- name: Create composer cache directory
51+
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}
52+
53+
- name: Cache composer dependencies
54+
uses: actions/cache@v2
55+
with:
56+
path: ${{ steps.composer-cache.outputs.dir }}
57+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
58+
restore-keys: ${{ runner.os }}-composer-
59+
60+
- name: Create PHPStan cache directory
61+
run: mkdir -p build/phpstan
62+
63+
- name: Cache PHPStan results
64+
uses: actions/cache@v2
65+
with:
66+
path: build/phpstan
67+
key: ${{ runner.os }}-phpstan-${{ github.sha }}
68+
restore-keys: ${{ runner.os }}-phpstan-
69+
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 }}
76+
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
77+
env:
78+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
79+
80+
- name: Run static analysis
81+
run: vendor/bin/phpstan analyze

.github/workflows/deduplicate.yml

+39
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

+79
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

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: PHPUnit
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
push:
8+
branches:
9+
- develop
10+
11+
jobs:
12+
main:
13+
name: PHP ${{ matrix.php-versions }} Unit Tests
14+
15+
strategy:
16+
matrix:
17+
php-versions: ['7.3', '7.4', '8.0']
18+
19+
runs-on: ubuntu-latest
20+
21+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
27+
- name: Setup PHP, with composer and extensions
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php-versions }}
31+
tools: composer, pecl, phpunit
32+
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
33+
coverage: xdebug
34+
env:
35+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Get composer cache directory
38+
id: composer-cache
39+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
40+
41+
- name: Cache composer dependencies
42+
uses: actions/cache@v2
43+
with:
44+
path: ${{ steps.composer-cache.outputs.dir }}
45+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
46+
restore-keys: ${{ runner.os }}-composer-
47+
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 }}
54+
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
55+
env:
56+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
57+
58+
- name: Test with PHPUnit
59+
run: vendor/bin/phpunit --verbose --coverage-text
60+
env:
61+
TERM: xterm-256color
62+
TACHYCARDIA_MONITOR_GA: enabled
63+
64+
- if: matrix.php-versions == '8.0'
65+
name: Mutate with Infection
66+
run: |
67+
composer global require infection/infection
68+
git fetch --depth=1 origin $GITHUB_BASE_REF
69+
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
70+
71+
- if: matrix.php-versions == '8.0'
72+
name: Run Coveralls
73+
run: vendor/bin/php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
74+
env:
75+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
COVERALLS_PARALLEL: true
77+
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }}
78+
79+
coveralls:
80+
needs: [main]
81+
name: Coveralls Finished
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Upload Coveralls results
85+
uses: coverallsapp/github-action@master
86+
with:
87+
github-token: ${{ secrets.GITHUB_TOKEN }}
88+
parallel-finished: true

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ vendor/
22
build/
33
phpunit*.xml
44
phpunit
5+
*.cache
56
composer.lock
67
.DS_Store
78
.idea/

.php-cs-fixer.dist.php

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
use CodeIgniter\CodingStandard\CodeIgniter4;
4+
use Nexus\CsConfig\Factory;
5+
use PhpCsFixer\Finder;
6+
7+
$finder = Finder::create()
8+
->files()
9+
->in(__DIR__)
10+
->exclude('build')
11+
->append([__FILE__]);
12+
13+
// Optional rule overrides
14+
$overrides = [];
15+
16+
$options = [
17+
'finder' => $finder,
18+
'cacheFile' => 'build/.php-cs-fixer.cache',
19+
];
20+
21+
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# CodeIgniter Shield
22

3-
[![Build Status](https://github.com/lonnieezell/codigniter-shield/workflows/PHPUnit/badge.svg)](https://github.com/lonnieezell/codigniter-shield/actions?query=workflow%3A%22PHPUnit%22)
3+
[![Unit Tests](https://github.com/lonnieezell/codigniter-shield/workflows/PHPUnit/badge.svg)](https://github.com/lonnieezell/codigniter-shield/actions/workflows/test.yml)
4+
[![Static Analysis](https://github.com/lonnieezell/codigniter-shield/workflows/PHPStan/badge.svg)](https://github.com/lonnieezell/codigniter-shield/actions/workflows/analyze.yml)
5+
[![Architecture](https://github.com/lonnieezell/codigniter-shield/workflows/Deptrac/badge.svg)](https://github.com/lonnieezell/codigniter-shield/actions/workflows/inspect.yml)
46
[![Coverage Status](https://coveralls.io/repos/github/lonnieezell/codigniter-shield/badge.svg?branch=develop)](https://coveralls.io/github/lonnieezell/codigniter-shield?branch=develop)
57

68
Shield is an authentication and authorization framework for CodeIgniter 4. While it does provide a base set of tools

SECURITY.md

+26
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.

0 commit comments

Comments
 (0)