-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from tattersoftware/tools
Development Tools
- Loading branch information
Showing
17 changed files
with
438 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/.github export-ignore | ||
/docs export-ignore | ||
/examples export-ignore | ||
/tests export-ignore | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/phpstan.neon.dist export-ignore | ||
|
||
# Configure diff output for .php and .phar files. | ||
*.php diff=php | ||
*.phar -diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: composer | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: daily |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# When a PR is opened or a push is made, perform | ||
# a static analysis check on the code using PHPStan. | ||
name: PHPStan | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'develop' | ||
paths: | ||
- 'src/**' | ||
- 'tests/**' | ||
- 'composer.**' | ||
- 'phpstan*' | ||
- '.github/workflows/analyze.yml' | ||
push: | ||
branches: | ||
- 'develop' | ||
paths: | ||
- 'src/**' | ||
- 'tests/**' | ||
- 'composer.**' | ||
- 'phpstan*' | ||
- '.github/workflows/analyze.yml' | ||
|
||
jobs: | ||
build: | ||
name: PHP ${{ matrix.php-versions }} Static Analysis | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-versions: ['7.3', '7.4', '8.0'] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
tools: composer, pecl, phpunit | ||
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3 | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Create composer cache directory | ||
run: mkdir -p ${{ steps.composer-cache.outputs.dir }} | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Create PHPStan cache directory | ||
run: mkdir -p build/phpstan | ||
|
||
- name: Cache PHPStan results | ||
uses: actions/cache@v2 | ||
with: | ||
path: build/phpstan | ||
key: ${{ runner.os }}-phpstan-${{ github.sha }} | ||
restore-keys: ${{ runner.os }}-phpstan- | ||
|
||
- name: Install dependencies | ||
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader | ||
env: | ||
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} | ||
|
||
- name: Run static analysis | ||
run: vendor/bin/phpstan analyze |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: PHPUnit | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
main: | ||
name: PHP ${{ matrix.php-versions }} Unit Tests | ||
|
||
strategy: | ||
matrix: | ||
php-versions: ['7.3', '7.4', '8.0'] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
if: "!contains(github.event.head_commit.message, '[ci skip]')" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
tools: composer, pecl, phpunit | ||
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3 | ||
coverage: xdebug | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader | ||
env: | ||
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} | ||
|
||
- name: Test with PHPUnit | ||
run: vendor/bin/phpunit --verbose --coverage-text | ||
env: | ||
TERM: xterm-256color | ||
|
||
- if: matrix.php-versions == '8.0' | ||
name: Mutate with Infection | ||
run: | | ||
composer global require infection/infection | ||
git fetch --depth=1 origin $GITHUB_BASE_REF | ||
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 | ||
- if: matrix.php-versions == '8.0' | ||
name: Run Coveralls | ||
run: vendor/bin/php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_PARALLEL: true | ||
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} | ||
|
||
coveralls: | ||
needs: [main] | ||
name: Coveralls Finished | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Upload Coveralls results | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
parallel-finished: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
vendor/ | ||
build/ | ||
phpunit*.xml | ||
phpunit | ||
*.cache | ||
composer.lock | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"source": { | ||
"directories": [ | ||
"src" | ||
], | ||
"excludes": [ | ||
"Config", | ||
"Database/Migrations", | ||
"Views" | ||
] | ||
}, | ||
"logs": { | ||
"text": "build/infection.log" | ||
}, | ||
"mutators": { | ||
"@default": true | ||
}, | ||
"bootstrap": "vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
parameters: | ||
tmpDir: build/phpstan | ||
level: 5 | ||
paths: | ||
- src | ||
- tests | ||
bootstrapFiles: | ||
- vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php | ||
excludes_analyse: | ||
- src/Config/Routes.php | ||
- src/Views/* | ||
ignoreErrors: | ||
- '#Access to protected property .+\\[A-Za-z]+Model::\$[A-Za-z]+#' | ||
- '#Access to an undefined property CodeIgniter\\Session\\Session::\$session_id#' | ||
- '#Call to an undefined static method Config\\Services::[A-Za-z]+\(\)#' | ||
- '#Unsafe usage of new static\(\)*#' | ||
universalObjectCratesClasses: | ||
- CodeIgniter\Entity | ||
- Faker\Generator | ||
scanDirectories: | ||
- vendor/codeigniter4/codeigniter4/system/Helpers | ||
dynamicConstantNames: | ||
- APP_NAMESPACE | ||
- CI_DEBUG | ||
- ENVIRONMENT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
bootstrap="vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php" | ||
backupGlobals="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
executionOrder="random" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnIncomplete="false" | ||
stopOnSkipped="false" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
|
||
<coverage includeUncoveredFiles="true" processUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
<exclude> | ||
<directory suffix=".php">./src/Views</directory> | ||
<file>./src/Config/Routes.php</file> | ||
</exclude> | ||
<report> | ||
<clover outputFile="build/phpunit/clover.xml"/> | ||
<html outputDirectory="build/phpunit/html"/> | ||
<php outputFile="build/phpunit/coverage.serialized"/> | ||
<text outputFile="php://stdout" showUncoveredFiles="false"/> | ||
<xml outputDirectory="build/phpunit/xml-coverage"/> | ||
</report> | ||
</coverage> | ||
|
||
<testsuites> | ||
<testsuite name="app"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<logging> | ||
<testdoxHtml outputFile="build/phpunit/testdox.html"/> | ||
<testdoxText outputFile="build/phpunit/testdox.txt"/> | ||
<junit outputFile="build/phpunit/junit.xml"/> | ||
</logging> | ||
|
||
<php> | ||
<env name="XDEBUG_MODE" value="coverage"/> | ||
<server name="app.baseURL" value="http://example.com"/> | ||
|
||
<!-- Directory containing phpunit.xml --> | ||
<const name="HOMEPATH" value="./"/> | ||
|
||
<!-- Directory containing the Paths config file --> | ||
<const name="CONFIGPATH" value="./vendor/codeigniter4/codeigniter4/app/Config/"/> | ||
|
||
<!-- Directory containing the front controller (index.php) --> | ||
<const name="PUBLICPATH" value="./vendor/codeigniter4/codeigniter4/public/"/> | ||
|
||
<!-- https://getcomposer.org/xdebug --> | ||
<env name="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/> | ||
|
||
<!-- Database configuration --> | ||
<!-- Uncomment to use alternate testing database configuration | ||
<env name="database.tests.hostname" value="localhost"/> | ||
<env name="database.tests.database" value="tests"/> | ||
<env name="database.tests.username" value="tests_user"/> | ||
<env name="database.tests.password" value=""/> | ||
<env name="database.tests.DBDriver" value="MySQLi"/> | ||
<env name="database.tests.DBPrefix" value="tests_"/> | ||
--> | ||
</php> | ||
</phpunit> |
Oops, something went wrong.