/ php

Example Use of Gitlab CI / CD Tool

In the making of the software there is the term Continous Integration. Continuous Integration or abbreviated CI, is the process of building and testing program code that is usually written by some programmers automatically.

Gitlab as a software development collaboration service provider has built-in CI / CD features. Here is an example of using CI / CD for PHP software development.

Main Files

For Gitlab CI / CD to work in the repository, add the .gitlab-ci.yml file in the root of the source code folder and fill in:

image: php:7.1

services:  
  - mysql:latest

variables:  
  # Configure mysql environment variables (https://hub.docker.com/r/_/mysql/)
  MYSQL_DATABASE: sungai
  MYSQL_ROOT_PASSWORD: secret

before_script:  
# Install dependencies
- bash ci/docker_install.sh > /dev/null

test:app:  
  script:
  - cd api
  - phpunit

This is just an example, customize the script itself.

More information at Gitlab CI/CD Documentation

Badge Status

In order to know the status of CI / CD can be added to the badge obtained in setting-> CI / CD.

CI/CD Gitlab Setting