.gitlab-ci.yml 4.74 KB
Newer Older
1
2
3
4
5
6
7
# Specify docker image
image: debian:stretch

# Define variable to disable SSL verification of GIT
variables:
  GIT_SSL_NO_VERIFY: "true"

8
stages:
9
10
11
  - lint
  - codestyle
  - manpages
12
  - transifex
13
  - tarballs
14
  - trigger
15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Stage lint

# PHP lint (jessie)
create_php_lint_rapport_jessie:
  image: php:5.6.33-cli-jessie
  stage: lint
  only:
    - branches
  script:
    - find . -type f -name '*.php' -o -name '*.inc' -print0 | xargs -0 -n1 php -l

# PHP lint (stretch)
create_php_lint_rapport_stretch:
  image: php:cli-stretch
  stage: lint
  only:
    - branches
  script:
    - find . -type f -name '*.php' -o -name '*.inc' -print0 | xargs -0 -n1 php -l

## Stage codestyle

38
39
40
41
# PHP codesniffer
create_php_code_sniffer_rapport_13:
  stage: codestyle
  only:
42
    - branches
43
44
45
46
47
48
49
50
  before_script:
    - apt-get update -qq
    - apt-get install -y -qq  git php-cli php-codesniffer
  script:
    - git clone https://gitlab.fusiondirectory.org/fusiondirectory/dev-tools.git -b 1.3 ../dev-tools
    - find . -type f -name '*.php' -o -name '*.inc' > ./filelist
    - phpcs --ignore=class_sieve.inc --standard=../dev-tools/php-codesniffer-rules/FDStandard/ruleset.xml --file-list=./filelist

51
52
53
54
55
56
57
58
59
60
61
62
# Sonar publishing
sonar_publish:
  image: sonar-cli:3.1.0.1141
  stage: codestyle
  only:
    - 1.3-dev
  script:
    - /home/sonar/*/bin/sonar-scanner
      -D sonar.projectKey=fusiondirectory-plugins-dev
      -D sonar.projectName=FusionDirectory-Plugins-Dev
      -D sonar.projectVersion=1.3
      -D sonar.sourceEncoding=UTF-8
Côme Chilliet's avatar
Côme Chilliet committed
63
      -D sonar.exclusions='mail/personal/mail/class_sieve.inc'
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
      -D sonar.gitlab.project_id="$CI_PROJECT_PATH"
      -D sonar.gitlab.commit_sha="$CI_COMMIT_SHA"
      -D sonar.gitlab.ref_name="$CI_COMMIT_REF_NAME"

# Sonar preview
sonar_preview:
  image: sonar-cli:3.1.0.1141
  stage: codestyle
  except:
    - 1.3-dev
  script:
    - /home/sonar/*/bin/sonar-scanner
      -D sonar.projectKey=fusiondirectory-plugins-dev
      -D sonar.projectName=FusionDirectory-Plugins-Dev
      -D sonar.projectVersion=1.3
      -D sonar.sourceEncoding=UTF-8
Côme Chilliet's avatar
Côme Chilliet committed
80
      -D sonar.exclusions='mail/personal/mail/class_sieve.inc'
81
82
83
84
85
      -D sonar.gitlab.project_id="$CI_PROJECT_PATH"
      -D sonar.gitlab.commit_sha="$CI_COMMIT_SHA"
      -D sonar.gitlab.ref_name="$CI_COMMIT_REF_NAME"
      -D sonar.analysis.mode=preview

86
87
# fusiondirectory-update-locale
fusiondirectory-update-locale:
88
  image: php:cli-stretch
89
  stage: transifex
90
91
  only:
    - branches
92
93
  before_script:
    - apt-get update -qq
94
    - apt-get install -y -qq gettext git
95
96
  script:
    - git clone https://gitlab.fusiondirectory.org/fusiondirectory/dev-tools.git ../dev-tools
97
    - ../dev-tools/locale-scripts/fusiondirectory-update-locale-plugins
98

99
100
# Update transifex
update-transifex:
101
  image: php:cli-stretch
102
  stage: transifex
103
  only:
104
    - /^1.*$/
105
106
  before_script:
    - apt-get update -qq
107
    - apt-get install -y -qq gettext git transifex-client
108
109
110
111
  script:
    - git clone https://gitlab.fusiondirectory.org/fusiondirectory/dev-tools.git ../dev-tools
    - echo $'[https://www.transifex.com]\nhostname = https://www.transifex.com\nusername = '"$TRANSIFEX_USER"$'\npassword = '"$TRANSIFEX_PASSWORD"$'\ntoken = '"$TRANSIFEX_API_TOKEN"$'\n' > ~/.transifexrc
    - tx pull -a -f
112
    - ../dev-tools/locale-scripts/fusiondirectory-update-locale-plugins
113
    - tx push -f -s -t --skip --no-interactive
114
115

build-tarballs:
116
  stage: tarballs
117
118
119
120
121
122
123
  script:
    - tar -cvzf fusiondirectory-plugins.tar.gz *
  artifacts:
    paths:
    - fusiondirectory-plugins.tar.gz
    expire_in: 1h

124
125
126
127
128
build-release:
  stage: tarballs
  only:
    - tags
  script: 
129
    - tar -cvzf fusiondirectory-plugins-$(grep '%' Changelog.md | head -n1 | cut -d ' ' -f3 | tr -d '"').tar.gz *
130
131
  artifacts:
    paths:
132
      - fusiondirectory-plugins-$(grep '%' Changelog.md | head -n1 | cut -d ' ' -f3 | tr -d '"').tar.gz
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171

trigger-ci-debian-stretch:
  stage: trigger
  only:
    - master
  variables:
    GROUP: "$GROUP"
    BRANCH_CORE: "$CI_COMMIT_REF_NAME"
    BRANCH_PLUGIN: "$CI_COMMIT_REF_NAME"
    BRANCH_BUILD_DEBIAN_STRETCH: "$BRANCH_BUILD_DEBIAN_STRETCH"
  trigger:
    project: debian/stretch-fusiondirectory-release
    branch: "$BRANCH_BUILD_DEBIAN_STRETCH"

trigger-ci-debian-buster:
  stage: trigger
  only:
    - master
  variables:
    GROUP: "$GROUP"
    BRANCH_CORE: "$CI_COMMIT_REF_NAME"
    BRANCH_PLUGIN: "$CI_COMMIT_REF_NAME"
    BRANCH_BUILD_DEBIAN_BUSTER: "$BRANCH_BUILD_DEBIAN_BUSTER"
  trigger:
    project: debian/buster-fusiondirectory-release
    branch: "$BRANCH_BUILD_DEBIAN_BUSTER"

trigger-ci-centos7:
  stage: trigger
  only:
    - master
  variables:
    GROUP: "$GROUP"
    BRANCH_CORE: "$CI_COMMIT_REF_NAME"
    BRANCH_PLUGIN: "$CI_COMMIT_REF_NAME"
    BRANCH_BUILD_CENTOS_7: "$BRANCH_BUILD_CENTOS_7"
  trigger:
    project: centos/centos7-fusiondirectory-release
    branch: "$BRANCH_BUILD_CENTOS_7"