Skip to content

Commit

Permalink
Merge 73e55df into 1c18955
Browse files Browse the repository at this point in the history
  • Loading branch information
MGatner committed Jan 26, 2021
2 parents 1c18955 + 73e55df commit dee16fe
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 57 deletions.
13 changes: 13 additions & 0 deletions .gitattributes
@@ -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
20 changes: 15 additions & 5 deletions .github/workflows/analyze.yml
Expand Up @@ -9,6 +9,7 @@ on:
paths:
- 'src/**'
- 'tests/**'
- 'composer.**'
- 'phpstan*'
- '.github/workflows/analyze.yml'
push:
Expand All @@ -17,32 +18,41 @@ on:
paths:
- 'src/**'
- 'tests/**'
- 'composer.**'
- 'phpstan*'
- '.github/workflows/analyze.yml'

jobs:
build:
name: Analyze code
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: '7.4'
extensions: intl
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.lock') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Create PHPStan cache directory
Expand All @@ -56,7 +66,7 @@ jobs:
restore-keys: ${{ runner.os }}-phpstan-

- name: Install dependencies
run: composer install --no-progress --no-suggest --no-interaction --prefer-dist --optimize-autoloader
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

Expand Down
33 changes: 28 additions & 5 deletions .github/workflows/test.yml
Expand Up @@ -2,16 +2,19 @@ name: PHPUnit

on:
pull_request:
branches:
branches:
- develop
push:
branches:
- develop

jobs:
main:
name: Build and test
name: PHP ${{ matrix.php-versions }} Unit Tests

strategy:
matrix:
php-versions: ['7.2', '7.3', '7.4']
php-versions: ['7.3', '7.4', '8.0']

runs-on: ubuntu-latest

Expand Down Expand Up @@ -41,9 +44,29 @@ jobs:
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-progress --no-suggest --no-interaction --prefer-dist --optimize-autoloader
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

- name: Test with phpunit
- name: Test with PHPUnit
run: vendor/bin/phpunit --verbose --coverage-text

- if: matrix.php-versions == '7.4'
name: Run Coveralls
run: |
composer global require php-coveralls/php-coveralls:^2.4
php-coveralls --coverage_clover=build/logs/clover.xml -v
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}

coveralls:
needs: [main]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
37 changes: 17 additions & 20 deletions composer.json
@@ -1,5 +1,6 @@
{
"name": "tatter/agents",
"type": "library",
"description": "Service analysis and assessment for CodeIgniter 4",
"keywords": [
"codeigniter",
Expand All @@ -20,43 +21,39 @@
"role": "Developer"
}
],
"repositories": [
{
"type": "vcs",
"url": "https://github.com/codeigniter4/CodeIgniter4"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php" : ">=7.2",
"php": "^7.2 || ^8.0",
"tatter/handlers": "^2.0",
"tatter/reports": "^1.1"
},
"require-dev": {
"codeigniter4/codeigniter4": "dev-develop",
"fzaninotto/faker": "^1.9@dev",
"phpunit/phpunit": "^8.5",
"phpstan/phpstan": "^0.12",
"squizlabs/php_codesniffer": "^3.5",
"codeigniter4/codeigniter4-standard": "^1.0"
"tatter/tools": "^1.4"
},
"autoload": {
"psr-4": {
"Tatter\\Agents\\": "src"
}
},
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\Support\\": "tests/_support"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/codeigniter4/CodeIgniter4"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"analyze": "phpstan analyze",
"style": "phpcs --standard=./vendor/codeigniter4/codeigniter4-standard/CodeIgniter4 src/ tests/",
"test": "phpunit",
"post-update-cmd": [
"composer dump-autoload"
]
"style": "phpcbf --standard=./vendor/codeigniter4/codeigniter4-standard/CodeIgniter4 tests/ src/",
"test": "phpunit"
}
}
64 changes: 37 additions & 27 deletions phpunit.xml.dist
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
Expand All @@ -8,34 +9,39 @@
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="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/logs/clover.xml"/>
<html outputDirectory="build/logs/html"/>
<php outputFile="build/logs/coverage.serialized"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
</report>
</coverage>

<testsuites>
<testsuite name="app">
<directory>./tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
<exclude>
<directory suffix=".php">./src/Views</directory>
<file>./src/Config/Routes.php</file>
</exclude>
</whitelist>
</filter>

<logging>
<log type="coverage-html" target="build/logs/html"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-php" target="build/logs/coverage.serialized"/>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
<log type="testdox-html" target="build/logs/testdox.html"/>
<log type="testdox-text" target="build/logs/testdox.txt"/>
<log type="junit" target="build/logs/logfile.xml"/>
<testdoxHtml outputFile="build/logs/testdox.html"/>
<testdoxText outputFile="build/logs/testdox.txt"/>
<junit outputFile="build/logs/logfile.xml"/>
</logging>

<php>
<env name="XDEBUG_MODE" value="coverage"/>
<server name="app.baseURL" value="http://example.com"/>

<!-- Directory containing phpunit.xml -->
Expand All @@ -47,13 +53,17 @@
<!-- Directory containing the front controller (index.php) -->
<const name="PUBLICPATH" value="./vendor/codeigniter4/codeigniter4/public/"/>

<!-- <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_"/> -->
<env name="database.tests.database" value=":memory:"/>
<env name="database.tests.DBDriver" value="SQLite3"/>
<!-- 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>

0 comments on commit dee16fe

Please sign in to comment.