Skip to content

Instantly share code, notes, and snippets.

@dimabory
Forked from RomainMarecat/.gitlab-ci.sh
Created April 12, 2018 15:17
Show Gist options
  • Save dimabory/f29968d7c575ea2339a1fadae9d0f165 to your computer and use it in GitHub Desktop.
Save dimabory/f29968d7c575ea2339a1fadae9d0f165 to your computer and use it in GitHub Desktop.
Simple gitlab-ci configuration symfony
#!/bin/bash
# Install dependencies only for Docker.
[[ ! -e /.dockerinit ]] && exit 0
set -xe
# Update packages and install composer and PHP dependencies.
apt-get update -yqq
apt-get install git libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev phpunit -yqq
# Compile PHP, include these extensions.
docker-php-ext-install mbstring mcrypt pdo pdo_mysql curl json intl gd xml zip bz2 opcache
# Select image from https://hub.docker.com/r/_/php/
image: php:7.0
# Services
services:
- mysql:latest
# Variables and root user used
variables:
MYSQL_ROOT_PASSWORD: secret
MYSQL_USER: gitlab-ci
MYSQL_PASSWORD: secret
MYSQL_DATABASE: your_db_name
# Before Script
before_script:
- bash .gitlab-ci.sh > /dev/null
- cd /builds/zeedenis/ZeeApi
- php -v
- ping -c 3 mysql
- cp app/config/parameters.gitlab-ci.yml app/config/parameters.yml
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
- php app/console doctrine:database:create --env=test --if-not-exists
- php app/console doctrine:schema:create --env=test
test:app:
script:
- phpunit -c app --debug
parameters:
database_host: mysql
database_name: your_db_name
database_name_test: your_db_name
database_user: root
database_password: secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment