Code Monkey home page Code Monkey logo

php-ci's Introduction

Napp PHP CI Docker images

This repository contains a set of utilities for running PHP tests via Gitlab CI.

Supported tags and respective Dockerfile links

Images dont have VOLUME directories since fresh version of sources is supposed to be downloaded into image each time before running tests

These images are built from Docker official php images, and additionally include:

  • All extensions are compiled and ready for loading with docker-php-ext-enable
  • PECL extensions: memcache, redis, mongo, xdebug
  • sendmail command via msmtp, configured as relay to localhost. Check /etc/msmtprc to setup relay server
  • Git client from official Debian repo
  • Composer
  • PHPUnit
  • PHP Code Sniffer
  • PHP Mess Detector
  • Node.js v6 from official Node.js Debian repositories
  • mysql client for database manipulations

See below for details

PHP modules

Some modules are enabled by default (compiled-in) and some you have to enable in your .gitlab-ci.yml before_script section with docker-php-ext-enable module1 module2

Compiled-in modules

ctype curl date dom ereg fileinfo filter hash iconv json libxml mysqlnd openssl pcre pdo pdo_sqlite phar posix readline recode reflection session simplexml spl sqlite3 standard tokenizer xml xmlreader xmlwriter zlib

Available core modules

bcmath bz2 calendar dba enchant exif ftp gd gettext gmp imap intl ldap mbstring mcrypt mssql mysql mysqli opcache pcntl pdo pdo_dblib pdo_mysql pdo_pgsql pgsql pspell shmop snmp soap sockets sysvmsg sysvsem sysvshm tidy wddx xmlrpc xsl zip

Available PECL modules

memcache memcached mongo mongodb redis xdebug

Environment variables

There are environment variables which can be passed to images on docker run

  • WITH_XDEBUG=1 - enables xdebug extension

  • TIMEZONE=America/New_York - set system and php.ini timezone. You can also set timezone in .gitlab-ci.yml

  • COMPOSER_GITHUB=<YOUR_GITHUB_TOKEN> - Adds Github oauth token for composer which allows composer to get unlimited repositories from Github without blocking non-interactive mode with request for authorization. You can obtain your token at https://github.com/settings/tokens

    Composer documentation about Github API rate limit

FAQ

  1. How to set custom php.ini values

    Easiest way is to add your php.ini directives to /usr/local/etc/php/conf.d/[anyname].ini Another way is to mount your local php.ini on container start like docker run ... -v /home/user/php.ini:/usr/local/php/etc/php.ini ...

Example

stages:
  - test

before_script:
  # Enable PHP Extensions
  - docker-php-ext-enable zip soap gd pdo_mysql mysqli

  # Composer
  - composer self-update
  - composer install --no-progress --no-interaction

variables:
  WITH_XDEBUG: "1"
  MYSQL_ROOT_PASSWORD: mysql
  MYSQL_DATABASE: mydb
  MYSQL_USER: myuser
  MYSQL_PASSWORD: somepassword
  COMPOSER_HOME: /cache/composer
  REDIS_PORT: "6379"

test_php70:
  image: napp/php-ci:7.0
  stage: test
  script:
    - phpunit --testsuite=unit

test_php71:
  image: napp/php-ci:7.1
  stage: test
  script:
    - phpunit --testsuite=unit

php-ci's People

Contributors

morloderex avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.