Skip to content

Commit

Permalink
Travis build improvements (#14)
Browse files Browse the repository at this point in the history
* Trial turning off xdebug

* Remove composer `--dev` warning

* Add composer cache

* Add badges to README

* Add php 7.2

* Using --prefer-lowest means we need to polyfill phpunit 5.0 test case class

* Trial running travis with lowest dependencies

* Check folder structure - to be removed

* Do not need that many lowest deps builds

* Remove debug line

* Not using mongodb in these tests

* Move to simpler bash test for existence

* Attempt to fix the composer update error

* Trial with ignore platform reqs for composer pre-build

* Remove accidentally committed composer change

* Move pre-run composer update

* Move pre-run composer update comment

* Prefer dist for all composer calls

* Fix php7.2 lowest dependencies build

* Add comment making it obvious php mongodb adapter is pinned to lowest
  • Loading branch information
redthor authored and caciobanu committed Mar 28, 2018
1 parent 1b0af31 commit 78395c3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
28 changes: 22 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
sudo: false
language: php
sudo: false

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

matrix:
include:
# Test the latest
- php: 5.6
env: MONGO_VERSION=stable
- php: 7.1
env: ADAPTER_VERSION="^1.0.0" MONGODB_VERSION=stable
- php: 7.2
env: ADAPTER_VERSION="^1.0.0" MONGODB_VERSION=stable

services: mongodb
# Test with the lowest deps
- php: 5.6
env: MONGO_VERSION=stable COMPOSER_FLAGS="--prefer-stable --prefer-lowest --prefer-dist"
- php: 7.2
# Note that the ADAPTER_VERSION is pinned to 1.0.0 when testing lowest deps
env: ADAPTER_VERSION="1.0.0" MONGODB_VERSION=stable COMPOSER_FLAGS="--prefer-stable --prefer-lowest --prefer-dist"

before_script:
- if [ "x${MONGO_VERSION}" != "x" ]; then yes '' | pecl -q install -f mongo-${MONGO_VERSION}; fi
- if [ "x${MONGODB_VERSION}" != "x" ]; then pecl install -f mongodb-${MONGODB_VERSION}; fi
- if [ "x${ADAPTER_VERSION}" != "x" ]; then composer require "alcaeus/mongo-php-adapter=${ADAPTER_VERSION}" --ignore-platform-reqs; fi
# Not using code coverage
- phpenv config-rm xdebug.ini
- if ! [ -z "$MONGO_VERSION" ]; then yes '' | pecl -q install -f mongo-${MONGO_VERSION}; fi
- if ! [ -z "$MONGODB_VERSION" ]; then pecl install -f mongodb-${MONGODB_VERSION}; fi
- if ! [ -z "$ADAPTER_VERSION" ]; then composer require "alcaeus/mongo-php-adapter=${ADAPTER_VERSION}" --ignore-platform-reqs; fi
- composer self-update
- composer install --dev
# To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
- if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --ignore-platform-reqs --quiet; fi
- composer update -v ${COMPOSER_FLAGS}

script:
- ./vendor/bin/phpunit
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[![Build Status](https://travis-ci.org/doesntmattr/mongodb-migrations-bundle.svg?branch=master)](https://travis-ci.org/doesntmattr/mongodb-migrations-bundle)
[![Latest Stable Version](https://poser.pugx.org/doesntmattr/mongodb-migrations-bundle/v/stable)](https://packagist.org/packages/doesntmattr/mongodb-migrations-bundle)
[![Total Downloads](https://poser.pugx.org/doesntmattr/mongodb-migrations-bundle/downloads)](https://packagist.org/packages/doesntmattr/mongodb-migrations-bundle)

:warning: Forked from [antimattr/mongodb-migrations-bundle](https://github.com/antimattr/mongodb-migrations-bundle) for contributors as the original project isn't being maintained. See [issue 16](https://github.com/antimattr/mongodb-migrations/issues/16)

The original authors did an awesome job of making a library that has been really
Expand Down
12 changes: 12 additions & 0 deletions Tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace PHPUnit\Framework;

$class = 'PHPUnit\Framework\TestCase';

if (!class_exists($class)) {

abstract class TestCase extends \PHPUnit_Framework_TestCase
{
}
}
4 changes: 3 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true">
<phpunit colors="true"
bootstrap="Tests/bootstrap.php"
>
<testsuites>
<testsuite name="Doesntmattr MongoDB Migrations Bundle Tests">
<directory>./Tests/</directory>
Expand Down

0 comments on commit 78395c3

Please sign in to comment.