summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: c44507b1c43219d559d9e7a59acec56192ccc7cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
image: php

cache:
  paths:
  - .composer

services:
  - mysql:5.6

variables:
  MYSQL_DATABASE: engelsystem
  MYSQL_USER: engel
  MYSQL_PASSWORD: engelsystem
  COMPOSER_HOME: .composer
  MYSQL_RANDOM_ROOT_PASSWORD: "yes"

before_script:
  # Install required Packages
  - apt-get update -yqq
  - apt-get install -yqq git unzip mysql-client
  - docker-php-ext-install pdo pdo_mysql gettext
  # Install xdebug
  - pecl install xdebug
  - docker-php-ext-enable xdebug
  # MySQL DB
  - mysql -h mysql -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" < db/install.sql
  - mysql -h mysql -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" < db/update.sql
  # Install Composer
  - curl -sS https://getcomposer.org/installer | php -- --no-ansi --install-dir /usr/local/bin/ --filename composer
  - /usr/local/bin/composer --no-ansi install

.test_template: &test_definition
  artifacts:
    name: "${CI_JOB_NAME}_${CI_PROJECT_ID}_${PHP_VERSION}"
    expire_in: 1 week
    paths:
      - ./coverage/
  coverage: '/^\s*Lines:\s*(\d+(?:\.\d+)?%)/'
  script: vendor/bin/phpunit --colors=never --coverage-text --coverage-html ./coverage/

test:7.0:
  image: php:7.0
  <<: *test_definition

test:7.1:
  image: php:7.1
  <<: *test_definition