Skip to content
This repository was archived by the owner on May 18, 2024. It is now read-only.

Commit 426ca0c

Browse files
committed
Add standard dev toolkit
1 parent 156fe4b commit 426ca0c

File tree

10 files changed

+6687
-1220
lines changed

10 files changed

+6687
-1220
lines changed

.gitattributes

Lines changed: 13 additions & 0 deletions
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

Lines changed: 12 additions & 0 deletions
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

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
- 'app/**'
11+
- 'tests/**'
12+
- 'composer.**'
13+
- 'phpstan*'
14+
- '.github/workflows/analyze.yml'
15+
push:
16+
branches:
17+
- 'develop'
18+
paths:
19+
- 'app/**'
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+
44+
- name: Get composer cache directory
45+
id: composer-cache
46+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
47+
48+
- name: Create composer cache directory
49+
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}
50+
51+
- name: Cache composer dependencies
52+
uses: actions/cache@v2
53+
with:
54+
path: ${{ steps.composer-cache.outputs.dir }}
55+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
56+
restore-keys: ${{ runner.os }}-composer-
57+
58+
- name: Create PHPStan cache directory
59+
run: mkdir -p build/phpstan
60+
61+
- name: Cache PHPStan results
62+
uses: actions/cache@v2
63+
with:
64+
path: build/phpstan
65+
key: ${{ runner.os }}-phpstan-${{ github.sha }}
66+
restore-keys: ${{ runner.os }}-phpstan-
67+
68+
- name: Install dependencies
69+
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
70+
env:
71+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
72+
73+
- name: Run static analysis
74+
run: vendor/bin/phpstan analyze

.github/workflows/test.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
35+
- name: Get composer cache directory
36+
id: composer-cache
37+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
38+
39+
- name: Cache composer dependencies
40+
uses: actions/cache@v2
41+
with:
42+
path: ${{ steps.composer-cache.outputs.dir }}
43+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
44+
restore-keys: ${{ runner.os }}-composer-
45+
46+
- name: Install dependencies
47+
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
48+
env:
49+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
50+
51+
- name: Enable Tachycardia
52+
run: echo "TACHYCARDIA_MONITOR_GA=enabled" >> $GITHUB_ENV
53+
54+
- name: Test with PHPUnit
55+
run: vendor/bin/phpunit --verbose --coverage-text
56+
env:
57+
TERM: xterm-256color
58+
59+
- if: matrix.php-versions == '8.0'
60+
name: Mutate with Infection
61+
run: |
62+
composer global require infection/infection
63+
git fetch --depth=1 origin $GITHUB_BASE_REF
64+
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
65+
66+
- if: matrix.php-versions == '8.0'
67+
name: Run Coveralls
68+
run: vendor/bin/php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
69+
env:
70+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
COVERALLS_PARALLEL: true
72+
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }}
73+
74+
coveralls:
75+
needs: [main]
76+
name: Coveralls Finished
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Upload Coveralls results
80+
uses: coverallsapp/github-action@master
81+
with:
82+
github-token: ${{ secrets.GITHUB_TOKEN }}
83+
parallel-finished: true

.gitignore

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ $RECYCLE.BIN/
4141
#-------------------------
4242
# These should never be under version control,
4343
# as it poses a security risk.
44-
.env*
44+
.env
4545
.vagrant
4646
Vagrantfile
4747

@@ -51,6 +51,9 @@ Vagrantfile
5151
writable/cache/*
5252
!writable/cache/index.html
5353

54+
writable/files/*
55+
!writable/files/index.html
56+
5457
writable/logs/*
5558
!writable/logs/index.html
5659

@@ -62,28 +65,27 @@ writable/uploads/*
6265

6366
writable/debugbar/*
6467

65-
php_errors.log
68+
writable/database.db
6669

67-
#-------------------------
68-
# User Guide Temp Files
69-
#-------------------------
70-
user_guide_src/build/*
71-
user_guide_src/cilexer/build/*
72-
user_guide_src/cilexer/dist/*
73-
user_guide_src/cilexer/pycilexer.egg-info/*
70+
php_errors.log
71+
public/error_log
7472

7573
#-------------------------
7674
# Test Files
7775
#-------------------------
7876
tests/coverage*
79-
80-
# Don't save phpunit under version control.
77+
results/
78+
build/
79+
phpunit*.xml
8180
phpunit
81+
.phpunit*.cache
82+
app/Commands/Test.php
8283

8384
#-------------------------
8485
# Composer
8586
#-------------------------
8687
vendor/
88+
public/assets/vendor/
8789

8890
#-------------------------
8991
# IDE / Development Files
@@ -121,5 +123,19 @@ nb-configuration.xml
121123
# Visual Studio Code
122124
.vscode/
123125

124-
/results/
125-
/phpunit*.xml
126+
#-------------------------
127+
# Local & Sensitive Files
128+
#-------------------------
129+
130+
/access
131+
/local
132+
/public/local
133+
134+
#-------------------------
135+
# Supplemental Content
136+
#-------------------------
137+
138+
/public/data/*
139+
/public/userguide
140+
/public/user?guide?/*
141+
!/public/*/readme.rst

composer.json

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,29 @@
22
"name": "codeigniter/website",
33
"type": "project",
44
"description": "CodeIgniter Website",
5+
"keywords": [
6+
"codeigniter",
7+
"codeigniter4"
8+
],
59
"homepage": "https://codeigniter.com",
610
"license": "MIT",
711
"require": {
812
"php": "^7.3 || ^8.0",
913
"codeigniter4/framework": "^4",
10-
"knplabs/github-api": "~1.5"
14+
"knplabs/github-api": "^1.5",
15+
"symfony/event-dispatcher": "^5.2"
1116
},
1217
"require-dev": {
18+
"codeigniter4/codeigniter4-standard": "^1.0",
1319
"fakerphp/faker": "^1.9",
20+
"friendsofphp/php-cs-fixer": "^2.16",
1421
"mikey179/vfsstream": "^1.6",
15-
"phpunit/phpunit": "^9.1"
22+
"nexusphp/tachycardia": "^1.3",
23+
"php-coveralls/php-coveralls": "^2.4",
24+
"phpstan/phpstan": "^0.12",
25+
"phpunit/phpunit": "^9.1",
26+
"rector/rector": "0.10.9",
27+
"squizlabs/php_codesniffer": "^3.5"
1628
},
1729
"suggest": {
1830
"ext-fileinfo": "Improves mime type detection for files"
@@ -31,7 +43,12 @@
3143
"Tests\\Support\\": "tests/_support"
3244
}
3345
},
46+
"minimum-stability": "dev",
47+
"prefer-stable": true,
3448
"scripts": {
49+
"analyze": "phpstan analyze",
50+
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
51+
"style": "phpcbf --standard=./vendor/codeigniter4/codeigniter4-standard/CodeIgniter4 tests/ app/",
3552
"test": "phpunit"
3653
},
3754
"support": {

0 commit comments

Comments
 (0)