2017 © Pedro Peláez
 

library ci-sniffer

Detects which CI environment the code is run and how to fetch details about the code being tested.

image

matthiasmullie/ci-sniffer

Detects which CI environment the code is run and how to fetch details about the code being tested.

  • Thursday, April 7, 2016
  • by matthiasmullie
  • Repository
  • 1 Watchers
  • 3 Stars
  • 754 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

CI sniffer

Code quality Latest version Downloads total License, (*1)

Travis, is that you?

All CI providers set some environment variables to let you know who they are and some additional info, but there's little consistency between how and what they expose. This will figure out what environment you're in and how to access some (sometimes hard to get) data in there, so you don't have to., (*2)

Supported CI providers

Provider Status
Appveyor
Circle CI
Codeship
Drone
Jenkins Supported!
Shippable
Snap CI
Travis CI
Wercker

Example usage

$factory = new \MatthiasMullie\CI\Factory();
$provider = $factory->getCurrent();

// outputs 'travis', 'circle', ..., depending on what CI server the code is run
echo $provider->getProvider(); // e.g. 'travis'

// outputs data about the thing being tested
echo $provider->getRepo(); // e.g. 'https://github.com/matthiasmullie/ci-sniffer.git'
echo $provider->getSlug(); // e.g. 'matthiasmullie/ci-sniffer'
echo $provider->getBranch(); // e.g. 'master' (or '', when testing PR)
echo $provider->getPullRequest(); // e.g. '1' (or '', when not testing PR)
echo $provider->getCommit(); // e.g. '01081a9c908717bf315f992b814a36c7c9ba7e65'
echo $provider->getPreviousCommit(); // e.g. '45da9806d50c98f9c88dc0049303cf039b93a95b'
echo $provider->getAuthor(); // e.g. 'Matthias Mullie'
echo $provider->getAuthorEmail(); // e.g. 'ci-sniffer@mullie.eu'
echo $provider->getTimestamp(); // e.g. '2016-02-17T18:36:49+01:00'
echo $provider->getBuild(); // e.g. '62.1'

Or execute the binary (bin/ci-sniffer) to get all info in JSON format. E.g.:, (*3)

{
    "provider":"travis",
    "repo":"https:\/\/github.com\/matthiasmullie\/ci-sniffer.git",
    "slug":"matthiasmullie\/ci-sniffer",
    "branch":"master",
    "pr":"",
    "commit":"01081a9c908717bf315f992b814a36c7c9ba7e65",
    "previous-commit":"45da9806d50c98f9c88dc0049303cf039b93a95b",
    "author":"Matthias Mullie",
    "author-email":"ci-sniffer@mullie.eu",
    "timestamp":"2016-02-17T18:36:49+01:00",
    "build":"62.1"
}

Installation

Simply add a dependency on matthiasmullie/ci-sniffer to your composer.json file if you use Composer to manage the dependencies of your project:, (*4)

composer require matthiasmullie/ci-sniffer

Although it's recommended to use Composer, you can actually include these files anyway you want., (*5)

License

ci-sniffer is MIT licensed., (*6)

The Versions

07/04 2016

dev-master

9999999-dev http://github.com/matthiasmullie/ci-sniffer

Detects which CI environment the code is run and how to fetch details about the code being tested.

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0

 

The Development Requires

php environment ci continuous integration

07/04 2016

1.2.1

1.2.1.0 http://github.com/matthiasmullie/ci-sniffer

Detects which CI environment the code is run and how to fetch details about the code being tested.

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0

 

The Development Requires

php environment ci continuous integration

18/02 2016

1.2.0

1.2.0.0 http://github.com/matthiasmullie/ci-sniffer

Detects which CI environment the code is run and how to fetch details about the code being tested.

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0

 

The Development Requires

php environment ci continuous integration

17/02 2016

1.1.0

1.1.0.0 http://github.com/matthiasmullie/ci-sniffer

Detects which CI environment the code is run and how to fetch details about the code being tested.

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0

 

The Development Requires

php environment ci continuous integration

16/02 2016

1.0.2

1.0.2.0 http://github.com/matthiasmullie/ci-environment

Detects which CI environment the code is run in and lets you get common values

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0

 

The Development Requires

php environment ci continuous integration

12/02 2016

1.0.1

1.0.1.0 http://github.com/matthiasmullie/ci-environment

Detects which CI environment the code is run in and lets you get common values

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0

 

The Development Requires

php environment ci continuous integration

11/02 2016

1.0.0

1.0.0.0 http://github.com/matthiasmullie/ci-environment

Detects which CI environment the code is run in and lets you get common values

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0

 

The Development Requires

php environment ci continuous integration