Skip to content

Commit c443f1b

Browse files
authored
Merge pull request #35 from tattersoftware/retool
CodeIgniter DevKit
2 parents 459d721 + d0e18b7 commit c443f1b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3336
-2475
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.github/workflows/deptrac.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Deptrac
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- '**.php'
9+
- 'composer.*'
10+
- 'depfile.yaml'
11+
- '.github/workflows/deptrac.yml'
12+
push:
13+
branches:
14+
- develop
15+
paths:
16+
- '**.php'
17+
- 'composer.*'
18+
- 'depfile.yaml'
19+
- '.github/workflows/deptrac.yml'
20+
21+
jobs:
22+
build:
23+
name: Dependency Tracing
24+
runs-on: ubuntu-latest
25+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v3
30+
31+
- name: Set up PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: '8.1'
35+
tools: phive
36+
extensions: intl, json, mbstring, xml
37+
coverage: none
38+
env:
39+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Get composer cache directory
42+
id: composer-cache
43+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
44+
45+
- name: Cache composer dependencies
46+
uses: actions/cache@v3
47+
with:
48+
path: ${{ steps.composer-cache.outputs.dir }}
49+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
50+
restore-keys: ${{ runner.os }}-composer-
51+
52+
- name: Create Deptrac cache directory
53+
run: mkdir -p build/
54+
55+
- name: Cache Deptrac results
56+
uses: actions/cache@v3
57+
with:
58+
path: build
59+
key: ${{ runner.os }}-deptrac-${{ github.sha }}
60+
restore-keys: ${{ runner.os }}-deptrac-
61+
62+
- name: Install dependencies
63+
run: |
64+
if [ -f composer.lock ]; then
65+
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
66+
else
67+
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
68+
fi
69+
70+
- name: Trace dependencies
71+
run: |
72+
sudo phive --no-progress install --global --trust-gpg-keys B8F640134AB1782E,A98E898BB53EB748 qossmic/deptrac
73+
deptrac analyze --cache-file=build/deptrac.cache

.github/workflows/infection.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Infection
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- '**.php'
9+
- 'composer.*'
10+
- 'phpunit*'
11+
- '.github/workflows/infection.yml'
12+
push:
13+
branches:
14+
- develop
15+
paths:
16+
- '**.php'
17+
- 'composer.*'
18+
- 'phpunit*'
19+
- '.github/workflows/infection.yml'
20+
21+
jobs:
22+
main:
23+
name: Mutation Testing
24+
runs-on: ubuntu-latest
25+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v3
30+
31+
- name: Set up PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: '8.1'
35+
tools: infection, phpunit
36+
extensions: intl, json, mbstring, gd, xml, sqlite3
37+
coverage: xdebug
38+
env:
39+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Set up problem matchers for PHPUnit
42+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
43+
44+
- name: Configure matchers
45+
uses: mheap/phpunit-matcher-action@v1
46+
47+
- name: Get composer cache directory
48+
id: composer-cache
49+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
50+
51+
- name: Cache composer dependencies
52+
uses: actions/cache@v3
53+
with:
54+
path: ${{ steps.composer-cache.outputs.dir }}
55+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
56+
restore-keys: ${{ runner.os }}-composer-
57+
58+
- name: Install dependencies
59+
run: |
60+
if [ -f composer.lock ]; then
61+
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
62+
else
63+
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
64+
fi
65+
66+
- name: Test with PHPUnit
67+
run: vendor/bin/phpunit --teamcity
68+
69+
- name: Mutate with Infection
70+
run: |
71+
git fetch --depth=1 origin $GITHUB_BASE_REF
72+
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

.github/workflows/phpcpd.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: PHPCPD
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- '**.php'
9+
- '.github/workflows/phpcpd.yml'
10+
push:
11+
branches:
12+
- develop
13+
paths:
14+
- '**.php'
15+
- '.github/workflows/phpcpd.yml'
16+
17+
jobs:
18+
build:
19+
name: Code Copy-Paste Detection
20+
runs-on: ubuntu-latest
21+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: '8.1'
31+
tools: phpcpd
32+
extensions: dom, mbstring
33+
coverage: none
34+
35+
- name: Detect duplicate code
36+
run: phpcpd src/ tests/

.github/workflows/phpcsfixer.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: PHPCSFixer
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- '**.php'
9+
- '.github/workflows/phpcsfixer.yml'
10+
push:
11+
branches:
12+
- develop
13+
paths:
14+
- '**.php'
15+
- '.github/workflows/phpcsfixer.yml'
16+
17+
jobs:
18+
build:
19+
name: Coding Standards
20+
runs-on: ubuntu-latest
21+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: Set up PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: '8.1'
31+
extensions: json, tokenizer
32+
coverage: none
33+
env:
34+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Get composer cache directory
37+
id: composer-cache
38+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
39+
40+
- name: Cache composer dependencies
41+
uses: actions/cache@v3
42+
with:
43+
path: ${{ steps.composer-cache.outputs.dir }}
44+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
45+
restore-keys: ${{ runner.os }}-composer-
46+
47+
- name: Install dependencies
48+
run: |
49+
if [ -f composer.lock ]; then
50+
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
51+
else
52+
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
53+
fi
54+
55+
- name: Check code for standards compliance
56+
run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --using-cache=no --diff
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,75 @@
1-
# When a PR is opened or a push is made, perform
2-
# a static analysis check on the code using PHPStan.
31
name: PHPStan
42

53
on:
64
pull_request:
75
branches:
8-
- 'develop'
6+
- develop
97
paths:
10-
- 'src/**'
11-
- 'tests/**'
8+
- '**.php'
9+
- 'composer.*'
1210
- 'phpstan*'
13-
- '.github/workflows/analyze.yml'
11+
- '.github/workflows/phpstan.yml'
1412
push:
1513
branches:
16-
- 'develop'
14+
- develop
1715
paths:
18-
- 'src/**'
19-
- 'tests/**'
16+
- '**.php'
17+
- 'composer.*'
2018
- 'phpstan*'
21-
- '.github/workflows/analyze.yml'
19+
- '.github/workflows/phpstan.yml'
2220

2321
jobs:
2422
build:
2523
name: PHP ${{ matrix.php-versions }} Static Analysis
2624
runs-on: ubuntu-latest
25+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
2726
strategy:
2827
fail-fast: false
2928
matrix:
30-
php-versions: ['7.2', '7.3', '7.4', '8.0']
29+
php-versions: ['7.4', '8.0', '8.1']
30+
3131
steps:
3232
- name: Checkout
33-
uses: actions/checkout@v2
33+
uses: actions/checkout@v3
3434

3535
- name: Setup PHP
3636
uses: shivammathur/setup-php@v2
3737
with:
3838
php-version: ${{ matrix.php-versions }}
39-
tools: composer, pecl, phpunit
40-
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3
39+
tools: phpstan, phpunit
40+
extensions: intl, json, mbstring, xml
41+
coverage: none
42+
env:
43+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4144

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

46-
- name: Create composer cache directory
47-
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}
48-
4949
- name: Cache composer dependencies
50-
uses: actions/cache@v2
50+
uses: actions/cache@v3
5151
with:
5252
path: ${{ steps.composer-cache.outputs.dir }}
53-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
53+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
5454
restore-keys: ${{ runner.os }}-composer-
5555

5656
- name: Create PHPStan cache directory
5757
run: mkdir -p build/phpstan
5858

5959
- name: Cache PHPStan results
60-
uses: actions/cache@v2
60+
uses: actions/cache@v3
6161
with:
6262
path: build/phpstan
6363
key: ${{ runner.os }}-phpstan-${{ github.sha }}
6464
restore-keys: ${{ runner.os }}-phpstan-
6565

6666
- name: Install dependencies
67-
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
68-
env:
69-
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
67+
run: |
68+
if [ -f composer.lock ]; then
69+
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
70+
else
71+
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
72+
fi
7073
7174
- name: Run static analysis
7275
run: vendor/bin/phpstan analyze

0 commit comments

Comments
 (0)