Skip to content

Instantly share code, notes, and snippets.

@RomainMarecat
Last active April 25, 2022 03:56
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • 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
#!/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
@xenogew
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 .gitlab-ci.sh do its job exactly?
  • - php app/console doctrine:database:create --env=test --if-not-exists -> connection refuse.

@PierluigiLampi
Copy link

ping: command not found

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