.gitlab-ci.yml 3.84 KB
Newer Older
1
2
services:
  - postgres:9.4
3

4

Alexandre Morin's avatar
Alexandre Morin committed
5
stages:
6
  - tests
Alexandre Morin's avatar
Alexandre Morin committed
7
  - push
Alexandre Morin's avatar
Alexandre Morin committed
8

Alexandre Morin's avatar
Alexandre Morin committed
9
variables:
10
  POSTGRES_DB: "maarchRMtest"
11
12
  POSTGRES_USER: maarch
  POSTGRES_PASSWORD: ""
Alexandre Morin's avatar
Alexandre Morin committed
13
14
15
  npm_config_cache: /builds/cypress-io/cypress-example-docker-gitlab/.npm
  CYPRESS_CACHE_FOLDER: /builds/cypress-io/cypress-example-docker-gitlab/cache/Cypress

Alexandre Morin's avatar
Alexandre Morin committed
16
17
18
19
20
21
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - .npm
    - cache/Cypress
    - node_modules
22
    - vendor/
Alexandre Morin's avatar
Alexandre Morin committed
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
unit-tests:php-7.2:
  image: php:7.2-apache
  stage: tests
  before_script:
    - apt-get update > /dev/null
    - mkdir -p /usr/share/man/man1
    - mkdir -p /usr/share/man/man7
    - apt-get install cron -yqq > /dev/null
    - bash tests/ci/docker_install_php.sh > /dev/null
    - bash tests/ci/docker_install_database.sh > /dev/null
    - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  script:
    - useradd -m -g www-data maarch
    - echo "export APACHE_RUN_USER=maarch" >> /etc/apache2/envvars
    - mkdir -p /var/www/html/
    - cp -R /builds/maarch/maarchRM/ /var/www/maarchRM/
    - mv /var/www/maarchRM/ /var/www/laabs/
    - cd /var/www/laabs
    - cp data/maarchRM/conf/vhost.conf.default data/maarchRM/conf/vhost.conf
    - cp data/maarchRM/conf/configuration.ini.default data/maarchRM/conf/configuration.ini
    - cp data/maarchRM/conf/confvars.ini.default data/maarchRM/conf/confvars.ini
    - sed -i -e 's!localhost!postgres!' data/maarchRM/conf/confvars.ini
    - sed -i -e 's!maarchRM!maarchRMtest!' data/maarchRM/conf/confvars.ini
    - mkdir -p /var/www/laabs/data/maarchRM/repository/archives_1 /var/www/laabs/data/maarchRM/repository/archives_2
    - chown -R maarch:www-data /var/www
    - chmod -R 777 /var/www
    - cd /etc/apache2/sites-available/
    - touch maarchRM.conf
    - echo "Include /var/www/laabs/data/maarchRM/conf/vhost.conf" >> maarchRM.conf
    - echo "127.0.0.1 maarchrm" >> /etc/hosts
    - a2ensite maarchRM.conf
    - a2dissite 000-default.conf
    - a2enmod rewrite
    - a2enmod env
    - service apache2 start
    - cd /var/www/laabs
    - composer install
    - sed -i -e 's!pgsql:host=localhost;dbname=maarchRMtest;port=5432!pgsql:host=postgres;dbname=maarchRMtest;port=5432!' /var/www/laabs/codeception.yml
    - vendor/bin/codecept run
  artifacts:
    paths:
      - tests/codeception/_output/
    expire_in: 1 week
    when: always
68

Alexandre Morin's avatar
Alexandre Morin committed
69
functional-test:cypress:
Alexandre Morin's avatar
Alexandre Morin committed
70
  image: cypress/base:10
71
  stage: tests
Alexandre Morin's avatar
Alexandre Morin committed
72
  script:
73
74
    - mv /builds/maarch/maarchRM/cypress.json /builds/maarch/maarchRM/cypress.json.old
    - mv /builds/maarch/maarchRM/cypress.json.ci /builds/maarch/maarchRM/cypress.json
75
    - npm install
Alexandre Morin's avatar
Alexandre Morin committed
76
77
    - npm ci
    - $(npm bin)/cypress verify
Alexandre Morin's avatar
Alexandre Morin committed
78
    - $(npm bin)/cypress run
Alexandre Morin's avatar
Alexandre Morin committed
79
80
  only:
    - schedules
Alexandre Morin's avatar
Alexandre Morin committed
81
82
83
84
  artifacts:
    expire_in: 1 week
    when: always
    paths:
85
86
      - tests/cypress/screenshots
      - tests/cypress/videos
Alexandre Morin's avatar
Alexandre Morin committed
87

88
syntax-test:php-metrics:
89
90
91
  image: jakzal/phpqa
  stage: tests
  script: phpmetrics --report-html=var/php-metrics src
92
93
  except:
    - schedules
Alexandre Morin's avatar
Alexandre Morin committed
94
95
  only:
    - develop
96
97
98
99
100
  artifacts:
    paths:
      - var/php-metrics/
  allow_failure: true

101
syntax-test:php-phpmd:
102
103
  image: jakzal/phpqa
  stage: tests
104
105
  script:
    - mkdir var/
Alexandre Morin's avatar
Alexandre Morin committed
106
    - phpmd src html phpmd.xml --reportfile var/phpmd.html --exclude --ignore-violations-on-exit
107
108
  except:
    - schedules
Alexandre Morin's avatar
Alexandre Morin committed
109
110
  only:
    - develop
111
112
  artifacts:
    paths:
113
      - var/phpmd.html
114
115
  allow_failure: true

116
117

syntax-test:php-deprecation-detector:
118
119
  image: jakzal/phpqa
  stage: tests
Alexandre Morin's avatar
Alexandre Morin committed
120
  script:
121
    - deprecation-detector check src vendor/
122
123
  except:
    - schedules
Alexandre Morin's avatar
Alexandre Morin committed
124
125
  only:
    - develop
126
127
  allow_failure: true

128

129
130
131
#build-dockerhub:
#  stage: push
#  script:
132
133
#    - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin
#    - docker build tests/dockerfile/ -t "$CI_REGISTRY_IMAGE"
134
#    - docker tag "$CI_REGISTRY_IMAGE"
135
136
#    - docker push "$CI_REGISTRY_IMAGE"
#  only:
137
#    - feat/codeception
138
139
#  except:
#    - schedules