Skip to content

Commit

Permalink
Merge pull request #116 from lemberg/feature/travis-ci
Browse files Browse the repository at this point in the history
Convert Travis config file to use stages
  • Loading branch information
T2L committed Dec 17, 2019
2 parents 52f64d7 + 8372393 commit 8d16fbf
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 57 deletions.
215 changes: 159 additions & 56 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,159 @@
dist: xenial
sudo: required

language: python
python: "3.6"

env:
- MOLECULE_PLATFORM=ubuntu:16.04
- MOLECULE_PLATFORM=ubuntu:18.04

cache:
apt: true
pip: true
directories:
- "$HOME/.composer/cache"

services:
- docker

before_install:
# Update composer
- phpenv config-rm xdebug.ini
- composer self-update
# Download and register Oracle VirtualBox keys
- wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
- wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
# Add Oracle VirtualBox repository
- sudo add-apt-repository "deb https://download.virtualbox.org/virtualbox/debian xenial contrib"
# Update apt-get
- sudo apt-get update -qq
# Install Linux headers
- sudo apt-get -y --force-yes install linux-headers-`uname -r`
# Install VirtualBox 5.2
- sudo apt-get install virtualbox-5.2
# Install Vagrant 2.2.6
# Todo: install from a package repository, not from a hardcoded URL.
- curl -O https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.deb
- sudo dpkg -i vagrant_2.2.6_x86_64.deb

install:
- composer install --no-interaction --no-progress --no-suggest
- pip install ansible==2.6.* docker molecule

before_script:
- vagrant --version
- composer --version
- ansible --version
- molecule --version

script:
- composer validate --no-check-all --ansi
- vagrant status
- ./bin/phpcs
- ./bin/phpstan analyse
- ./bin/phpunit
- molecule test
stages:
- PHP
- Vagrant
- Molecule
- Code coverage

jobs:
fast_finish: true
allow_failures:
- stage: Vagrant
env: VIRTUAL_BOX_VERSION=6.1

include:
- &PHP

stage: PHP

os: linux

dist: xenial

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

language: php

php: 7.2

before_install:
- phpenv config-rm xdebug.ini
- composer self-update

install:
- composer install --no-interaction --no-progress --no-suggest --prefer-dist --optimize-autoloader

script:
- ./bin/phpcs
- ./bin/phpstan analyse
- ./bin/phpunit

- <<: *PHP

php: 7.3

- <<: *PHP

php: 7.4

- &Vagrant

stage: Vagrant

os: linux

dist: xenial

cache:
apt: true

language: php

php: 7.2

env: VIRTUAL_BOX_VERSION=5.2

before_install:
- phpenv config-rm xdebug.ini
- composer self-update
# Download and register Oracle VirtualBox keys
- wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
- wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
# Add Oracle VirtualBox repository
- sudo add-apt-repository "deb https://download.virtualbox.org/virtualbox/debian xenial contrib"
# Update apt-get
- sudo apt-get update -qq
# Install Linux headers
- sudo apt-get -y --force-yes install linux-headers-`uname -r`
# Install VirtualBox
- sudo apt-get install virtualbox-${VIRTUAL_BOX_VERSION}
# Install Vagrant
# Todo: install from a package repository, not from a hardcoded URL.s
- curl -O https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.deb
- sudo dpkg -i vagrant_2.2.6_x86_64.deb

install:
- composer install --no-interaction --no-progress --no-suggest --prefer-dist --optimize-autoloader --no-dev

script:
- vagrant status

- <<: *Vagrant

env: VIRTUAL_BOX_VERSION=6.0

- <<: *Vagrant

env: VIRTUAL_BOX_VERSION=6.1

- &Molecule

stage: Molecule

os: linux

dist: xenial

cache:
pip: true
directories:
- "$HOME/.composer/cache"

language: python

python: 3.6

env: MOLECULE_PLATFORM=ubuntu:16.04

before_install:
- composer self-update

install:
- composer install --no-interaction --no-progress --no-suggest --prefer-dist --optimize-autoloader --no-dev
- pip install ansible==2.6.* docker molecule

script:
- molecule test

- <<: *Molecule

env: MOLECULE_PLATFORM=ubuntu:18.04

- &CodeCoverage

stage: Code Coverage

os: linux

dist: xenial

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

language: php

php: 7.2

before_install:
- composer self-update

install:
- composer install --no-interaction --no-progress --no-suggest --prefer-dist --optimize-autoloader

script:
- ./bin/phpunit --coverage-clover=coverage.xml

after_success:
- bash <(curl -s https://codecov.io/bash)
6 changes: 5 additions & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!-- See http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php -->
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset -->
<ruleset name="Drupal">
<description>Drupal coding standard</description>
<!-- All PHP code files must be UTF-8 encoded and we treat them as such. -->
Expand All @@ -8,6 +8,10 @@
<arg name="extensions" value="php"/>
<!-- Use colors in output. -->
<arg name="colors"/>
<!-- Show sniff codes in all reports. -->
<arg value="s"/>
<!-- Show progress of the run. -->
<arg value="p"/>

<!-- Scan directories with PHP code only. -->
<file>./src/</file>
Expand Down

0 comments on commit 8d16fbf

Please sign in to comment.