Skip to content

Commit

Permalink
Merge pull request #411 from creative-commoners/pulls/4.2/travis-shared
Browse files Browse the repository at this point in the history
MNT Travis shared config
  • Loading branch information
Garion Herman authored Dec 20, 2020
2 parents ec14688 + b369703 commit 0eebc31
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 84 deletions.
86 changes: 4 additions & 82 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,8 @@
dist: xenial
version: ~> 1.0

services:
- mysql
- postgresql
- xvfb

cache:
directories:
- $HOME/.composer/cache/files

addons:
apt:
packages:
- tidy
- chromium-chromedriver
- chromium-browser
import:
- silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-range-behat-npm.yml

env:
global:
- TRAVIS_NODE_VERSION="10"
- DISPLAY=":99"
- XVFBARGS=":99 -ac -screen 0 1024x768x16"
- SS_BASE_URL="http://localhost:8080/"
- SS_ENVIRONMENT_TYPE="dev"

matrix:
include:
- php: 7.1
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1 PHPCS_TEST=1
- php: 7.1
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_COVERAGE_TEST=1 PDO=1
- 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 BEHAT_TEST=1
- php: 7.4
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST NPM_TEST=1

before_script:
# Extra $PATH
- export PATH=/usr/lib/chromium-browser/:$PATH

# Init PHP
- phpenv rehash
- phpenv config-rm xdebug.ini || true

# Install composer dependencies
- composer validate
- if [[ $DB == PGSQL ]]; then composer require silverstripe/postgresql:^2 --no-update; fi
- composer require --no-update silverstripe/recipe-cms:$RECIPE_VERSION silverstripe/recipe-testing:^1
# Fix for running phpunit 5 on php 7.4+
- composer require --no-update sminnee/phpunit-mock-objects:^3
- composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile

# Remove preinstalled Chrome (google-chrome)
# this would conflict with our chromium-browser installation
# and its version is incompatible with chromium-chromedriver
- sudo apt-get remove -y --purge google-chrome-stable || true

# Behat bootstrapping
- if [[ $BEHAT_TEST ]]; then mkdir artifacts; fi
- if [[ $BEHAT_TEST ]]; then cp composer.lock artifacts/; fi
- if [[ $BEHAT_TEST ]]; then sh -e /etc/init.d/xvfb start; sleep 3; fi
- if [[ $BEHAT_TEST ]]; then (chromedriver > artifacts/chromedriver.log 2>&1 &); fi
- if [[ $BEHAT_TEST ]]; then (vendor/bin/serve --bootstrap-file vendor/silverstripe/cms/tests/behat/serve-bootstrap.php &> artifacts/serve.log &); fi

# Install NPM dependencies
- if [[ $NPM_TEST ]]; then nvm install $TRAVIS_NODE_VERSION && nvm use $TRAVIS_NODE_VERSION && npm install -g yarn && yarn install --network-concurrency 1 && yarn run build; fi

script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml tests; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi
- if [[ $NPM_TEST ]]; then git diff-files --quiet -w --relative=client; fi
- if [[ $NPM_TEST ]]; then git diff --name-status --relative=client; fi
- if [[ $NPM_TEST ]]; then yarn run coverage; fi
- if [[ $NPM_TEST ]]; then yarn run lint; fi
- if [[ $BEHAT_TEST ]]; then vendor/bin/behat @mfa; fi

after_success:
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml -F php; fi
- if [[ $NPM_TEST ]]; then bash <(curl -s https://codecov.io/bash) -F js; fi

after_failure:
- if [[ $BEHAT_TEST ]]; then php ./vendor/silverstripe/framework/tests/behat/travis-upload-artifacts.php --if-env BEHAT_TEST,ARTIFACTS_BUCKET,ARTIFACTS_KEY,ARTIFACTS_SECRET --target-path $TRAVIS_REPO_SLUG/$TRAVIS_BUILD_ID/$TRAVIS_JOB_ID --artifacts-base-url https://s3.amazonaws.com/$ARTIFACTS_BUCKET/ --artifacts-path ./artifacts/; fi
- BEHAT_SUITE=mfa
13 changes: 13 additions & 0 deletions client/src/images/extra-protection.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions client/src/images/locked-letter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions client/src/images/more-options.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0eebc31

Please sign in to comment.