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.
- 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)
The following table outlines general compability of Phalcon inside various CI environments.
PHP CI Version | Phalcon Version(s) | CI Environment |
---|---|---|
5.3 | ✖ (Not supported) | - |
5.4 | ✖ (Not supported) | - |
5.5 | ✔ master , 2.0.x , 3.0.x |
✔ CircleCI, Travis CI, Scrutinizer, Codeship, Shippable |
5.6 | ✔ master , 2.0.x , 3.0.x |
✔ CircleCI, Travis CI, Scrutinizer, Codeship, Shippable |
7.0 | ✔ 3.0.x |
✔ CircleCI, Travis CI, Scrutinizer, Codeship, Shippable |
- Add the
techpivot/phalcon-ci-installer
repository into the require-dev section of yourcomposer.json
as follows:
"require-dev": {
"techpivot/phalcon-ci-installer": "~1.0"
}
- 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.
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.
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 thetechpivot/phalcon-ci-installer
repository during the composer installation at inference or override phase.
Reference: CircleCI PHP Versions – Ubuntu 14.04 • Ubuntu 12.04
.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.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
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.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