Skip to content

Commit cb3f5e9

Browse files
committed
Merging upstream changes
2 parents 1dfc9be + 40730b7 commit cb3f5e9

21 files changed

+644
-200
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: 81 additions & 0 deletions
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/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, phpunit
38+
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
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 qossmic/deptrac --trust-gpg-keys B8F640134AB1782E
79+
deptrac analyze --cache-file=build/deptrac.cache

.github/workflows/test-phpunit.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/test.yml

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

Lines changed: 1 addition & 0 deletions
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/

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Provides database storage and retrieval of application settings, with a fallback to the
44
config classes.
55

6+
[![](https://github.com/codeigniter4/settings/workflows/PHPUnit/badge.svg)](https://github.com/codeigniter4/settings/actions/workflows/test.yml)
7+
[![](https://github.com/codeigniter4/settings/workflows/PHPStan/badge.svg)](https://github.com/codeigniter4/settings/actions/workflows/analyze.yml)
8+
[![](https://github.com/codeigniter4/settings/workflows/Deptrac/badge.svg)](https://github.com/codeigniter4/settings/actions/workflows/inspect.yml)
9+
[![Coverage Status](https://coveralls.io/repos/github/codeigniter4/settings/badge.svg?branch=develop)](https://coveralls.io/github/codeigniter4/settings?branch=develop)
10+
611
## Quick Start
712

813
1. Install with Composer: `> composer require codeigniter4/settings`

admin/pre-commit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ done
2929
if [ "$FILES" != "" ]
3030
then
3131
echo "Running Code Sniffer..."
32-
./vendor/bin/phpcbf --standard=./vendor/codeigniter4/codeigniter4-standard/CodeIgniter4 --encoding=utf-8 -n -p $FILES
32+
./vendor/bin/phpcbf --standard=PSR12 --encoding=utf-8 -n -p $FILES
3333
fi
3434

35-
exit $?
35+
exit $?

0 commit comments

Comments
 (0)