Improve Travis CI build process (#4394)

This commit is contained in:
Ben Thomson 2019-06-24 07:38:41 +08:00 committed by GitHub
parent ae7da9f957
commit 6fb6e5f71c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 7 deletions

View File

@ -13,10 +13,39 @@ matrix:
sudo: false
if: type = pull_request OR (type = push AND (branch = develop OR branch = master))
cache:
directories:
- $HOME/.composer/cache/files
install:
- composer self-update
- travis_retry composer install --no-interaction --prefer-source
- travis_retry composer install --no-interaction --no-progress --no-suggest
before_script: git reset --hard HEAD
script: vendor/bin/phpunit
stages:
- test
- code quality
- code coverage
script:
- ./vendor/bin/parallel-lint --exclude vendor --exclude storage --exclude tests/fixtures/plugins/testvendor/goto/Plugin.php .
- ./vendor/bin/phpunit
jobs:
include:
- stage: code coverage
if: type = push AND (branch = develop OR branch = master)
php: 7.1
script:
- ./vendor/bin/phpunit --testsuite "October CMS Test Suite" --coverage-clover=coverage.xml
- bash <(curl -s https://codecov.io/bash)
- stage: code quality
if: type = pull_request
php: 7.1
script: ./vendor/bin/phpcs --colors -nq --report="full" --extensions="php" $(git diff-tree --no-commit-id --name-only -r ${TRAVIS_COMMIT_RANGE/.../..})
- stage: code quality
if: type = push AND (branch = develop OR branch = master)
php: 7.1
script: ./vendor/bin/phpcs --colors -nq --report="full" --extensions="php" $(git diff-tree --no-commit-id --name-only -r $TRAVIS_COMMIT)

View File

@ -42,9 +42,11 @@
},
"require-dev": {
"fzaninotto/faker": "~1.7",
"phpunit/phpunit": "~5.7",
"phpunit/phpunit": "~6.5",
"phpunit/phpunit-selenium": "~1.2",
"meyfa/phpunit-assert-gd": "1.1.0"
"meyfa/phpunit-assert-gd": "1.1.0",
"squizlabs/php_codesniffer": "3.*",
"jakub-onderka/php-parallel-lint": "^1.0"
},
"autoload-dev": {
"classmap": [

View File

@ -71,7 +71,9 @@ class Index extends Controller
protected function checkPermissionRedirect()
{
if (!$this->user->hasAccess('backend.access_dashboard')) {
$true = function () { return true; };
$true = function () {
return true;
};
if ($first = array_first(BackendMenu::listMainMenuItems(), $true)) {
return Redirect::intended($first->url);
}

16
phpcs.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<ruleset name="October CMS">
<description>The coding standard for October CMS.</description>
<rule ref="PSR2">
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
</rule>
<file>bootstrap/</file>
<file>config/</file>
<file>modules/</file>
<file>tests</file>
<exclude-pattern>vendor/</exclude-pattern>
<exclude-pattern>storage/</exclude-pattern>
<exclude-pattern>plugins/</exclude-pattern>
</ruleset>

View File

@ -18,9 +18,26 @@
<directory>./vendor/october/rain/tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./modules/</directory>
<exclude>
<file>./modules/backend/routes.php</file>
<file>./modules/cms/routes.php</file>
<file>./modules/system/routes.php</file>
<directory suffix=".php">./modules/backend/database</directory>
<directory suffix=".php">./modules/cms/database</directory>
<directory suffix=".php">./modules/system/database</directory>
</exclude>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing" />
<env name="CACHE_DRIVER" value="array" />
<env name="SESSION_DRIVER" value="array" />
</php>
</phpunit>
</phpunit>