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 #7 from tattersoftware/tools
Refactor Tests
- Loading branch information
Showing
33 changed files
with
1,123 additions
and
745 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, gd, 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, gd, 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 |
---|---|---|
|
@@ -2,5 +2,6 @@ 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
File renamed without changes.
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,21 @@ | ||
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: | ||
universalObjectCratesClasses: | ||
- CodeIgniter\Entity | ||
- Faker\Generator | ||
scanDirectories: | ||
- vendor/codeigniter4/codeigniter4/system/Helpers | ||
dynamicConstantNames: | ||
- APP_NAMESPACE | ||
- CI_DEBUG | ||
- ENVIRONMENT |
Oops, something went wrong.