Skip to content

Instantly share code, notes, and snippets.

Last active April 25, 2022 03:56
Show Gist options
  • Save RomainMarecat/6477a8c5b1505913448be5d70958b319 to your computer and use it in GitHub Desktop.
Save RomainMarecat/6477a8c5b1505913448be5d70958b319 to your computer and use it in GitHub Desktop.
Simple gitlab-ci configuration symfony
# 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
image: php:7.0
# Services
- mysql:latest
# Variables and root user used
MYSQL_USER: gitlab-ci
MYSQL_DATABASE: your_db_name
# Before Script
- bash > /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 | php
- php composer.phar install
- php app/console doctrine:database:create --env=test --if-not-exists
- php app/console doctrine:schema:create --env=test
- phpunit -c app --debug
database_host: mysql
database_name: your_db_name
database_name_test: your_db_name
database_user: root
database_password: secret
Copy link

senorihl commented Sep 30, 2017

I always get this error when executing similar configuration, any idea why ?

$ php composer.phar install — prefer-dist
Do not run Composer as root/super user! See for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 87 installs, 0 updates, 0 removals
 Failed to download symfony/polyfill-mbstring from dist: The zip extension and unzip command are both missing, skipping.
A php.ini file does not exist. You will have to create one.
 Now trying to download from source
 — Installing symfony/polyfill-mbstring (v1.4.0): Cloning f29dca382a
 Failed to clone, git was not found, check that it is installed and in your PATH env. 
 sh: 1: git: not found 
install [ — prefer-source] [ — prefer-dist] [ — dry-run] [ — dev] [ — no-dev] [ — no-custom-installers] [ — no-autoloader] [ — no-scripts] [ — no-progress] [ — no-suggest] [-v|vv|vvv| — verbose] [-o| — optimize-autoloader] [-a| — classmap-authoritative] [ — apcu-autoloader] [ — ignore-platform-reqs] [ — ] [<packages>]…
ERROR: Job failed: exit code 1

---- EDIT

Nevermind the changes made by @Querdos on fixed the thing ;-)

Copy link

xenogew commented Aug 22, 2018

I got problem with these lines:

  • - cd /builds/zeedenis/ZeeApi -> path not found, I quite understand because my project doesn't contain those path.
  • - ping -c 3 mysql -> command not found, very weird, cause ping is the basic command of Linux base environment.
  • - cp app/config/parameters.gitlab-ci.yml app/config/parameters.yml -> cp: cannot create regular file 'app/config/parameters.yml': No such file or directory
  • - phpunit -c app --debug -> phpunit command not found: wonder is do its job exactly?
  • - php app/console doctrine:database:create --env=test --if-not-exists -> connection refuse.

Copy link

ping: command not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment