.gitlab-ci.yml 2.54 KB
Newer Older
Tino Goratsch's avatar
Tino Goratsch committed
1 2 3
variables:
  COMPOSER_HOME: .composerhome
  COMPOSER_ALLOW_SUPERUSER: 1
4
  npm_config_cache: .npmhome
Tino Goratsch's avatar
Tino Goratsch committed
5

Tino Goratsch's avatar
Tino Goratsch committed
6
stages:
7
  - build
Tino Goratsch's avatar
Tino Goratsch committed
8
  - test
Tino Goratsch's avatar
Tino Goratsch committed
9
  - release
Tino Goratsch's avatar
Tino Goratsch committed
10

11
.php-base:
12
  image: registry.gitlab.com/acp3/php-docker:7.2
13
  cache:
14
    key: composer-$CI_COMMIT_REF_NAME
15 16 17
    paths:
      - ${COMPOSER_HOME}
      - vendor
18
      - .php_cs.cache
19

20 21 22 23 24 25
build:composer:
  extends: .php-base
  stage: build
  script:
    - composer install -n --prefer-dist

26
test:php71-unit:
27 28 29 30 31
  extends: test:php72-unit
  image: registry.gitlab.com/acp3/php-docker:7.1
  coverage: ~

test:php72-unit:
32
  extends: .php-base
33
  stage: test
34 35
  cache:
    policy: pull
36 37 38 39
  script:
    - phpdbg -qrr ./vendor/bin/phpunit -c ./tests/phpunit.dist.xml --coverage-text --colors=never
  coverage: '/^\s*Lines:\s*\d+.\d+\%/'

40 41 42 43 44
test:php73-unit:
  extends: test:php72-unit
  image: registry.gitlab.com/acp3/php-docker:7.3
  coverage: ~

Tino Goratsch's avatar
Tino Goratsch committed
45
test:phpcs:
46
  extends: .php-base
47
  stage: test
48
  script:
49
    - composer run-script lint
50

Tino Goratsch's avatar
Tino Goratsch committed
51
test:phpstan:
52
  extends: .php-base
53
  stage: test
54 55
  cache:
    policy: pull
56
  script:
57
    - php -d memory_limit=-1 vendor/bin/phpstan analyse --no-progress
58

Tino Goratsch's avatar
Tino Goratsch committed
59
test:eslint:
Tino Goratsch's avatar
Tino Goratsch committed
60
  image: node:lts-alpine
61
  stage: test
Tino Goratsch's avatar
Tino Goratsch committed
62 63 64
  cache:
    key: node-$CI_COMMIT_REF_NAME
    paths:
65
      - ${npm_config_cache}
66 67
  before_script:
    - apk update && apk add --no-cache git
Tino Goratsch's avatar
Tino Goratsch committed
68
  script:
Tino Goratsch's avatar
Tino Goratsch committed
69
    - npm ci
Tino Goratsch's avatar
Tino Goratsch committed
70 71
    - npm run-script eslint

Tino Goratsch's avatar
Tino Goratsch committed
72
release:subtree-split:
Tino Goratsch's avatar
Tino Goratsch committed
73
  image: jderusse/gitsplit
Tino Goratsch's avatar
Tino Goratsch committed
74
  stage: release
Tino Goratsch's avatar
Tino Goratsch committed
75
  cache:
76
    key: "$CI_JOB_NAME"
Tino Goratsch's avatar
Tino Goratsch committed
77
    paths:
Tino Goratsch's avatar
Tino Goratsch committed
78
      - .gitsplit-cache
Tino Goratsch's avatar
Tino Goratsch committed
79 80
  variables:
    GIT_STRATEGY: clone
Tino Goratsch's avatar
Tino Goratsch committed
81 82 83
  before_script:
    - eval $(ssh-agent -s)
    - mkdir -p ~/.ssh
84 85 86
    - chmod 700 ~/.ssh
    - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
Tino Goratsch's avatar
Tino Goratsch committed
87
    - ssh-add -l
Tino Goratsch's avatar
Tino Goratsch committed
88 89 90
  script:
    - git config remote.origin.fetch "+refs/*:refs/*"
    - git config remote.origin.mirror true
91
    - git fetch --prune --unshallow || git fetch --prune
92
    - gitsplit --ref "${CI_COMMIT_REF_NAME}"
93

Tino Goratsch's avatar
Tino Goratsch committed
94
release:generate-artifact:
95
  extends: .php-base
Tino Goratsch's avatar
Tino Goratsch committed
96
  stage: release
97 98
  cache:
    policy: pull
99
  script:
100
    - composer install --no-dev --prefer-dist -o -n --ignore-platform-reqs
101 102 103 104
  artifacts:
    name: "release-${CI_COMMIT_TAG}"
    paths:
      - ACP3
105
      - bin
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
      - build/gulp
      - designs
      - installation
      - tests
      - uploads
      - vendor
      - .editorconfig
      - .htaccess.sample
      - CHANGELOG.md
      - composer.json
      - composer.lock
      - gulpfile.js
      - index.php
      - LICENSE
      - package.json
      - package-lock.json
      - README.md
123 124
  only:
    - tags