Skip to content

Commit 949ac1d

Browse files
committed
CI updates
1 parent 4c93a4b commit 949ac1d

10 files changed

+110
-86
lines changed

.scrutinizer.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ tools:
1414
fixers: []
1515
enabled: false
1616
filter:
17-
paths: [tests/*,code/*]
17+
paths: [tests/*,src/*]
1818
excluded_paths: []
1919
coding_style:
2020
php:
@@ -27,5 +27,11 @@ checks:
2727
code_rating: true
2828
duplication: true
2929

30+
build:
31+
nodes:
32+
analysis:
33+
tests:
34+
override: [php-scrutinizer-run]
35+
3036
filter:
31-
paths: [tests/*,code/*]
37+
paths: [tests/*,src/*]

.travis.yml

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,34 @@
1-
21
language: php
32

4-
sudo: false
5-
6-
addons:
7-
apt:
8-
packages:
9-
- tidy
10-
11-
before_install:
12-
- pip install --user codecov
13-
143
env:
154
global:
16-
- DB=MYSQL CORE_RELEASE=4.0
17-
- MODULE_PATH=viewable-dataobject
18-
- COVERAGE=0
5+
- COMPOSER_ROOT_VERSION=4.0.x-dev
6+
- CODECOV_TOKEN=
7+
- SCRUT_TOKEN=
198

209
matrix:
2110
include:
11+
- php: 7.0
12+
env: DB=MYSQL PHPUNIT_TEST=1 PHPCS_TEST=1
2213
- php: 7.1
23-
env: DB=SQLITE
24-
- php: 7.1
25-
env: DB=PGSQL
26-
- php: 7.1
27-
env: COVERAGE=1
14+
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
2815
- php: 5.6
29-
allow_failures:
30-
- php: 7.1
31-
env: DB=SQLITE
32-
16+
env: DB=MYSQL PHPUNIT_TEST=1
3317

3418
before_script:
19+
# Init PHP
3520
- phpenv rehash
36-
- composer self-update || true
37-
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
38-
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
39-
- cd ~/builds/ss
40-
- mv "$MODULE_PATH/phpunit.xml.dist" .
21+
- phpenv config-rm xdebug.ini
22+
- echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
4123

42-
#Execute tests with or without coverage
43-
script:
44-
# Execute tests with no coverage. This is the fastest option
45-
- "if [ \"$COVERAGE\" = \"0\" ]; then vendor/bin/phpunit $MODULE_PATH/tests/; fi"
24+
# Install composer dependencies
25+
- composer require --prefer-dist --no-update silverstripe-themes/simple:~3.2
26+
- composer update --no-suggest --prefer-dist
4627

47-
# Execute tests with coverage. Do this for a small
48-
- "if [ \"$COVERAGE\" = \"1\" ]; then vendor/bin/phpunit --coverage-clover=coverage.clover $MODULE_PATH/tests/; fi"
28+
script:
29+
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
30+
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml && wget https://scrutinizer-ci.com/ocular.phar; fi
31+
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi
4932

50-
# Upload code coverage when tests pass
5133
after_success:
52-
- "if [ \"$COVERAGE\" = \"1\" ]; then mv coverage.clover ~/build/$TRAVIS_REPO_SLUG/; fi"
53-
- cd ~/build/$TRAVIS_REPO_SLUG
54-
- wget https://scrutinizer-ci.com/ocular.phar
55-
- "if [ \"$COVERAGE\" = \"1\" ]; then travis_retry codecov && travis_retry php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi"
34+
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml -t $CODECOV_TOKEN && travis_retry php ocular.phar code-coverage:upload --format=php-clover --access-token=$SCRUT_TOKEN coverage.xml; fi

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ DataExtension that easily allows a dataobject to be viewed like a Page
1616

1717
## Requirements
1818

19-
- SilverStripe 3.2
19+
- SilverStripe ^4.0
2020

2121
## Installation
2222

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
"keywords": [
1212
"silverstripe", "dataobject", "page", "viewable"
1313
],
14-
"type": "silverstripe-module",
14+
"type": "silverstripe-vendormodule",
1515
"license": "BSD-3-Clause",
1616
"require": {
17-
"silverstripe/cms": "^4.0",
18-
"silverstripe/framework": "^4.0"
17+
"silverstripe/recipe-cms": "^1.0",
18+
"silverstripe/vendor-plugin": "^1.0"
1919
},
2020
"require-dev": {
21-
"phpunit/PHPUnit": "^5.7"
21+
"phpunit/PHPUnit": "^5.7",
22+
"squizlabs/php_codesniffer": "*"
2223
},
2324
"autoload": {
2425
"psr-4": {

phpcs.xml.dist

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="SS4">
3+
<description>Coding standard for SilverStripe 4.x</description>
4+
5+
<!-- Don't sniff third party libraries -->
6+
<exclude-pattern>*/vendor/*</exclude-pattern>
7+
<exclude-pattern>*/thirdparty/*</exclude-pattern>
8+
9+
<!-- Show progress and output sniff names on violation, and add colours -->
10+
<arg value="sp"/>
11+
<arg name="colors"/>
12+
13+
<!-- Use PSR-2 as a base standard -->
14+
<rule ref="PSR2">
15+
<!-- Allow classes to not declare a namespace -->
16+
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
17+
18+
<!-- Allow underscores in class names -->
19+
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
20+
21+
<!-- Allow non camel cased method names -->
22+
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
23+
</rule>
24+
</ruleset>

phpunit.xml.dist

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<phpunit bootstrap="framework/tests/bootstrap.php" colors="true">
1+
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
22
<testsuite name="viewable-dataobject">
3-
<directory>viewable-dataobject/tests</directory>
3+
<directory>tests</directory>
44
</testsuite>
55

66
<filter>
77
<whitelist addUncoveredFilesFromWhitelist="true">
8-
<directory suffix=".php">viewable-dataobject/src/</directory>
8+
<directory suffix=".php">src/</directory>
99
<exclude>
10-
<directory suffix=".php">viewable-dataobject/tests/</directory>
10+
<directory suffix=".php">tests/</directory>
1111
</exclude>
1212
</whitelist>
1313
</filter>
14-
</phpunit>
14+
</phpunit>

0 commit comments

Comments
 (0)