techpivot/phalcon-ci-installer

Composer integration for PHP applications to install the Phalcon framework as an extension in the PHP runtime for various hosted CI services including TravisCI, CircleCI, Scrutinizer, Shippable and Codeship.

Fund package maintenance!
techpivot

Installs: 130 479

Dependents: 11

Suggesters: 0

Security: 0

Stars: 26

Watchers: 6

Forks: 8

Open Issues: 2

Language:Shell

1.0.7 2017-04-07 13:52 UTC

This package is auto-updated.

Last update: 2024-10-08 09:23:44 UTC


README

CircleCI Travis CI Scrutinizer Codeship Shippable

Latest Version Total Downloads Software License

Composer integration for PHP applications to install the Phalcon framework as an extension in the PHP runtime for various hosted CI services including CircleCI, Travis CI, Scrutinizer, Codeship, and Shippable.

Features

  • Phalcon extension loaded in PHP runtime
  • Native cache support to prevent rebuilding Phalcon from source
  • Auto-detection of latest tagged Phalcon version
  • Install specific Phalcon versions, tags and releases (Since 1.0.2)
  • Supports PHP7 and Phalcon 3.0.x (Since 1.0.4)

Version Compatibility

The following table outlines general compability of Phalcon inside various CI environments.

Installation

  1. Add the techpivot/phalcon-ci-installer repository into the require-dev section of your composer.json as follows:
  "require-dev": {
      "techpivot/phalcon-ci-installer": "~1.0"
  }
  1. Update your CI script to execute the vendor/bin/install-phalcon.sh installer in the relevant section. See the examples below for various CI providers.

Options

The installer takes one optional argument that can be used to specify a specific branch or tag.

Examples:

# Install latest version from default branch
vendor/bin/install-phalcon.sh

# Install latest revision from branch "3.0.x"
vendor/bin/install-phalcon.sh 3.0.x

# Install specific release tag "phalcon-v2.0.9"
vendor/bin/install-phalcon.sh phalcon-v2.0.9

Note: The Phalcon CI installer is designed to cache the resulting binaries that correspond to the Phalcon/PHP version. Specifing a release or tagged version will result in the best performance as subsequent builds (depending on CI container/settings) will be cached. Building from a branch (including the default master option) will result in a Phalcon rebuild every time the installer detects a new version that is not yet cached.

CI Environments

CircleCI

circle.yml

machine:
  php:
    version: 5.6.14

dependencies:
  cache_directories:
    - vendor
    - ~/cphalcon

  post:
    - vendor/bin/install-phalcon.sh phalcon-v2.0.13

test:
  override:
    - vendor/bin/phpunit

Note: In order to cache data for faster builds, ensure the cache_directories directives are specified as outlined above.

Note: Ensure that the vendor/bin/circleci-install-phalcon.sh is executed in the post phase, which will allow for the inclusion of the techpivot/phalcon-ci-installer repository during the composer installation at inference or override phase.

Reference: CircleCI PHP Versions – Ubuntu 14.04Ubuntu 12.04

Travis CI

.travis.yml

language: php

php:
  - 5.5
  - 5.6
  - 7.0

cache:
  directories:
    - vendor
    - ~/.composer/cache
    - ~/cphalcon

before_install:
  - composer install --prefer-source --no-interaction
  - vendor/bin/install-phalcon.sh 3.0.x

script:
  - vendor/bin/phpunit

notifications:
  email: false

Note: Multiple PHP versions can be specified and each one will be cached independently; however, the phalcon target ref (branch or tag) will be applied for all builds

Reference: TravisCI PHP Versions

Scrutinizer

.scrutinizer.yml

build:
    environment:
        php:
            version: 7.0.8

    cache:
        directories:
            - ~/cphalcon

    dependencies:
        override:
            - composer install --prefer-source --no-interaction
        after: 
            - vendor/bin/install-phalcon.sh 3.0.x

Note: No need to include the vendor/ cache directory as this is cached automatically.

Reference: ScrutinizerCI PHP Versions

Codeship

Sample Setup Commands

phpenv local 5.6
php --version
composer install --prefer-source --no-interaction
vendor/bin/install-phalcon.sh

Reference: Codeship CI PHP Versions

Shippable

shippable.yml

language: php
php:
  - 7.0

build:
  cache: true
    
  cache_dir_list:
    - $SHIPPABLE_BUILD_DIR/vendor
    - ~/cphalcon

  ci:
    - composer install --prefer-source --no-interaction
    - bin/install-phalcon.sh 3.0.x

Reference: Shippable PHP Versions