LoginSignup
2
4

More than 5 years have passed since last update.

PHPプロジェクトにおけるCircle CIの設定

Posted at

基本構成

circle.yml というファイルをプロジェクトルートに置いて管理する。

この設定ファイルは大きく6つのエントリからなり、それぞれ以下を担うとのこと。

  • machine: adjusting the VM to your preferences and requirements
  • checkout: checking out and cloning your git repo
  • dependencies: setting up your project’s language-specific dependencies
  • database: preparing the databases for your tests
  • test: running your tests
  • deployment: deploying your code to your web servers

各セクションは、pre/override/postのセクションで実行するbashコマンドを指定できる。

pre: commands run before CircleCI’s inferred commands
override: CircleCIがデフォルトで実行する予定のコマンドを置き換える
post: commands run after CircleCI’s inferred commands

PHP の設定

Machine

Ubuntuが用意される模様。

version にてPHP構成の指定が可能

machine:
  php:
    version: 7.0.4

利用可能なバージョンは https://circleci.com/docs/build-image-trusty/#php を確認

machine.environmentの下にマップを置いて環境変数の定義も可能

dependencies

基本的には composer install が流れる。

PECL 等で拡張機能の導入が可能。

dependencies:
  pre:
    - pecl install mongo

php.iniの変更も以下の様な形で行える。

dependencies:
  pre:
    - cp config/custom.ini /opt/circleci/php/$(phpenv global)/etc/conf.d/
dependencies:
  pre:
    - echo "memory_limit = 64M" > /opt/circleci/php/$(phpenv global)/etc/conf.d/memory.ini  

database

色々なDatabaseが使えるとのこと。

test

phpunit が走る。

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4