Skip to content

Commit

Permalink
Merge pull request #416 from codeigniter4projects/develop
Browse files Browse the repository at this point in the history
Deploy
  • Loading branch information
kenjis authored Jan 23, 2024
2 parents 72260f1 + 7d8d48a commit b2d1f12
Show file tree
Hide file tree
Showing 32 changed files with 839 additions and 547 deletions.
67 changes: 57 additions & 10 deletions .github/workflows/infection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,62 @@ on:
- 'composer.*'
- 'phpunit*'
- '.github/workflows/infection.yml'
push:
branches:
- develop
paths:
- '**.php'
- 'composer.*'
- 'phpunit*'
- '.github/workflows/infection.yml'
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
infection:
uses: codeigniter4/.github/.github/workflows/infection.yml@main
main:
name: Mutation Testing
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: infection, phpunit
extensions: intl, json, mbstring, gd, xml, sqlite3
coverage: xdebug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Configure matchers
uses: mheap/phpunit-matcher-action@v1

- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: |
if [ -f composer.lock ]; then
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
else
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
fi
- name: Run Infection for added files only
run: |
git fetch --depth=1 origin $GITHUB_BASE_REF
infection --threads=max --git-diff-lines --git-diff-base=origin/$GITHUB_BASE_REF --ignore-msi-with-no-mutations --only-covered --logger-github
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52 changes: 50 additions & 2 deletions .github/workflows/phpcsfixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,55 @@ on:
paths:
- '**.php'
- '.github/workflows/phpcsfixer.yml'
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
phpcsfixer:
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@main
build:
name: PHP ${{ matrix.php-versions }} Coding Standards
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
fail-fast: false
matrix:
php-versions: ['8.1']

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json, tokenizer
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: |
if [ -f composer.lock ]; then
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
else
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
fi
- name: Check code for standards compliance
run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --using-cache=no --diff
63 changes: 61 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,66 @@ on:
- 'composer.*'
- 'phpstan*'
- '.github/workflows/phpstan.yml'
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
phpstan:
uses: codeigniter4/.github/.github/workflows/phpstan.yml@main
build:
name: PHP ${{ matrix.php-versions }} Static Analysis
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
fail-fast: false
matrix:
php-versions: ['8.1']

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpstan, phpunit
extensions: intl, json, mbstring, xml
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

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

- name: Cache PHPStan results
uses: actions/cache@v4
with:
path: build/phpstan
key: ${{ runner.os }}-phpstan-${{ github.sha }}
restore-keys: ${{ runner.os }}-phpstan-

- name: Install dependencies
run: |
if [ -f composer.lock ]; then
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
else
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
fi
- name: Run static analysis
run: vendor/bin/phpstan analyze
8 changes: 4 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']
php-versions: ['8.1']

steps:
- name: Checkout
Expand All @@ -39,13 +39,13 @@ jobs:
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
Expand All @@ -66,7 +66,7 @@ jobs:
TACHYCARDIA_MONITOR_GA: enabled
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- if: matrix.php-versions == '8.0'
- if: matrix.php-versions == '8.1'
name: Run Coveralls
continue-on-error: true
run: |
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ on:
- 'composer.*'
- 'rector.php'
- '.github/workflows/rector.yml'
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
Expand All @@ -26,7 +34,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1']
php-versions: ['8.1']

steps:
- name: Checkout
Expand All @@ -40,13 +48,13 @@ jobs:
extensions: intl, json, mbstring, xml
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
Expand All @@ -61,6 +69,4 @@ jobs:
fi
- name: Analyze for refactoring
run: |
composer global require --dev rector/rector:^0.15.1
rector process --dry-run --no-progress-bar
run: vendor/bin/rector process --dry-run --no-progress-bar
3 changes: 1 addition & 2 deletions app/Config/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class App extends BaseConfig
* 'http://accounts.example.com/':
* ['media.example.com', 'accounts.example.com']
*
* @var string[]
* @phpstan-var list<string>
* @var list<string>
*/
public array $allowedHostnames = [];

Expand Down
8 changes: 3 additions & 5 deletions app/Config/Autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Autoload extends AutoloadConfig
* 'App' => APPPATH
* ];
*
* @var array<string, string>
* @var array<string, list<string>|string>
*/
public $psr4 = [
APP_NAMESPACE => APPPATH, // For custom app namespace
Expand Down Expand Up @@ -80,8 +80,7 @@ class Autoload extends AutoloadConfig
* '/path/to/my/file.php',
* ];
*
* @var string[]
* @phpstan-var list<string>
* @var list<string>
*/
public $files = [];

Expand All @@ -94,8 +93,7 @@ class Autoload extends AutoloadConfig
* 'form',
* ];
*
* @var string[]
* @phpstan-var list<string>
* @var list<string>
*/
public $helpers = [];
}
3 changes: 2 additions & 1 deletion app/Config/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Config;

use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Cache\Handlers\DummyHandler;
use CodeIgniter\Cache\Handlers\FileHandler;
use CodeIgniter\Cache\Handlers\MemcachedHandler;
Expand Down Expand Up @@ -156,7 +157,7 @@ class Cache extends BaseConfig
* This is an array of cache engine alias' and class names. Only engines
* that are listed here are allowed to be used.
*
* @var array<string, string>
* @var array<string, class-string<CacheInterface>>
*/
public array $validHandlers = [
'dummy' => DummyHandler::class,
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Email extends BaseConfig
public string $mailPath = '/usr/sbin/sendmail';

/**
* SMTP Server Address
* SMTP Server Hostname
*/
public string $SMTPHost = '';

Expand Down
7 changes: 3 additions & 4 deletions app/Config/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class Filters extends BaseConfig
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*
* @var array<string, string>
* @phpstan-var array<string, class-string>
* @var array<string, class-string|list<class-string>> [filter_name => classname]
* or [filter_name => [classname1, classname2, ...]]
*/
public array $aliases = [
'csrf' => CSRF::class,
Expand All @@ -30,8 +30,7 @@ class Filters extends BaseConfig
* List of filter aliases that are always
* applied before and after every request.
*
* @var array<string, array<string, array<string, string>>>|array<string, array<string>>
* @phpstan-var array<string, list<string>>|array<string, array<string, array<string, string>>>
* @var array<string, array<string, array<string, string>>>|array<string, list<string>>
*/
public array $globals = [
'before' => [
Expand Down
Loading

0 comments on commit b2d1f12

Please sign in to comment.