Skip to content

Commit

Permalink
MNT Travis shared config
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Dec 10, 2020
1 parent 68a6a82 commit ddaeaf4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 57 deletions.
67 changes: 11 additions & 56 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,15 @@
language: php
version: ~> 1.0

dist: xenial

services:
- mysql
- postgresql
- xvfb

apt:
packages:
- tidy
- chromium-chromedriver
- chromium-browser
import:
- silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-fixed.yml

env:
global:
- COMPOSER_ROOT_VERSION=1.x-dev

matrix:
fast_finish: true
include:
- php: 7.1
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1 COMPOSER_INSTALL_ARG="--prefer-lowest"
- php: 7.2
env: DB=PGSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1
- php: 7.3
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_COVERAGE_TEST=1
- php: 7.4
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1 PDO=1
- php: 7.4
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1 PHPCS_TEST=1
- php: nightly
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1 COMPOSER_INSTALL_ARG="--ignore-platform-reqs"

before_script:
# Init PHP
# TODO: Remove this condition once Imagick officially ships PHP 8 support
- if [ "$COMPOSER_ARG" != "--ignore-platform-reqs"]; then printf "\n" | pecl install imagick; fi
- composer self-update || true
- phpenv rehash
- phpenv config-rm xdebug.ini || true
- export PATH=~/.config/composer/vendor/bin:$PATH
- echo 'memory_limit = 4G' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

# Install composer dependencies
- composer validate
- composer require --prefer-dist silverstripe/recipe-core:$RECIPE_VERSION silverstripe/versioned:1.x-dev $COMPOSER_INSTALL_ARG
- if [[ $DB == PGSQL ]]; then composer require silverstripe/postgresql:^2 --prefer-dist $COMPOSER_INSTALL_ARG; fi
- if [[ $PHPCS_TEST ]]; then composer global require squizlabs/php_codesniffer:^3 --prefer-dist --no-interaction --no-progress --no-suggest -o $COMPOSER_INSTALL_ARG; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then pecl install pcov ; composer require pcov/clobber --dev ; vendor/bin/pcov clobber; fi
- composer update --prefer-dist $COMPOSER_INSTALL_ARG

script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
- if [[ $PHPCS_TEST ]]; then composer run-script lint; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then vendor/bin/phpunit --coverage-clover=coverage.xml; fi

after_success:
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
- COMPOSER_ROOT_VERSION="1.7.x-dev"
- REQUIRE_RECIPE="4.7.x-dev"
- PHPUNIT_COVERAGE_SUITE="assets"

#before_script:
# Fix for phpunit timeout issue, e.g.
# https://travis-ci.com/github/silverstripe/silverstripe-assets/jobs/451250554
#- if [[ $PHPUNIT_COVERAGE_TEST ]]; then pecl install pcov ; composer require pcov/#clobber --dev ; vendor/bin/pcov clobber; fi
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"require-dev": {
"silverstripe/versioned": "^1@dev",
"sminnee/phpunit-mock-objects": "^3.4.5",
"sminnee/phpunit": "^5.7.29"
"sminnee/phpunit": "^5.7.29",
"squizlabs/php_codesniffer": "^3"
},
"suggest": {
"ext-exif": "If you use GD backend (the default) you may want to have EXIF extension installed to elude some tricky issues"
Expand Down
3 changes: 3 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>

<file>src</file>
<file>tests</file>

<!-- base rules are PSR-2 -->
<rule ref="PSR2" >
<!-- Current exclusions -->
Expand Down

0 comments on commit ddaeaf4

Please sign in to comment.