.gitlab-ci.yml 5.13 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
  - lint
10
  - codestyle
11
  - transifex
12
  - tarballs
13

14
## Stage lint
15

16 17
# Perl lint
create_perl_lint_rapport:
18
  stage: lint
19 20 21 22 23 24 25 26 27
  only:
    - branches
  before_script:
    - apt-get update -qq
    - apt-get install -y -qq libarchive-extract-perl libcrypt-cbc-perl libdigest-sha-perl libfile-copy-recursive-perl
    - apt-get install -y -qq libnet-ldap-perl libpath-class-perl libterm-readkey-perl libxml-twig-perl
  script:
    - perl -cW contrib/bin/fusiondirectory-setup contrib/bin/fusiondirectory-insert-schema

28
# PHP lint (stretch)
29
create_php_lint_rapport_stretch:
30
  image: php:cli-stretch
31
  stage: lint
32
  only:
33
    - branches
34
  script:
35
    - find . -type f -name '*.php' -o -name '*.inc' -print0 | xargs -0 -n1 php -l
36

37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
# generate man pages to test validity
create_manpages_lint_report:
  stage: lint
  only:
    - branches
  before_script:
  - apt-get update -qq
  - apt-get install -y -qq perl man-db
  script:
    - pod2man -c "FusionDirectory Documentation" -r "FusionDirectory 1.3" contrib/bin/fusiondirectory-insert-schema contrib/man/fusiondirectory-insert-schema.1
    - pod2man -c "FusionDirectory Documentation" -r "FusionDirectory 1.3" contrib/bin/fusiondirectory-setup contrib/man/fusiondirectory-setup.1
    - pod2man -c "FusionDirectory Documentation" -r "FusionDirectory 1.3" contrib/man/fusiondirectory.conf.pod contrib/man/fusiondirectory.conf.5
    - lexgrog contrib/man/fusiondirectory-insert-schema.1
    - lexgrog contrib/man/fusiondirectory-setup.1
    - lexgrog contrib/man/fusiondirectory.conf.5

53
## Stage codestyle
54 55 56

# Generate perlcritic rapport
create_perlcritic_rapport:
57
  stage: codestyle
58 59 60 61 62 63 64 65 66 67
  only:
    - branches
  before_script:
  - apt-get update -qq
  - apt-get install -y -qq libperl-critic-perl
  script:
    - cp contrib/bin/fusiondirectory-setup contrib/bin/fusiondirectory-setup.pl
    - cp contrib/bin/fusiondirectory-insert-schema contrib/bin/fusiondirectory-insert-schema.pl
    - perlcritic --quiet --verbose "%f~|~%s~|~%l~|~%c~|~%m~|~%e~|~%p~||~%n" contrib/bin

68 69
# PHP codesniffer
create_php_code_sniffer_rapport:
70
  stage: codestyle
71 72 73 74 75 76 77 78 79 80
  only:
    - branches
  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 ../dev-tools
    - find . -type f -name '*.php' -o -name '*.inc' > ./filelist
    - phpcs --standard=../dev-tools/php-codesniffer-rules/FDStandard/ruleset.xml --file-list=./filelist

81 82 83 84 85
# Sonar publishing
sonar_publish:
  image: sonar-cli:3.1.0.1141
  stage: codestyle
  only:
86
    - 1.4-dev
87 88
  script:
    - /home/sonar/*/bin/sonar-scanner
89 90 91
      -D sonar.projectKey=fusiondirectory-1.4-dev
      -D sonar.projectName=FusionDirectory-1.4-Dev
      -D sonar.projectVersion=1.4
92 93 94 95 96 97 98 99 100 101 102
      -D sonar.sourceEncoding=UTF-8
      -D sonar.exclusions='html/themes/legacy/**/*,include/class_xml.inc'
      -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:
103
    - 1.4-dev
104 105
  script:
    - /home/sonar/*/bin/sonar-scanner
106 107 108
      -D sonar.projectKey=fusiondirectory-1.4-dev
      -D sonar.projectName=FusionDirectory-1.4-Dev
      -D sonar.projectVersion=1.4
109 110 111 112 113 114 115
      -D sonar.sourceEncoding=UTF-8
      -D sonar.exclusions='html/themes/legacy/**/*,include/class_xml.inc'
      -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

116 117
# fusiondirectory-update-locale
fusiondirectory-update-locale:
118
  image: php:cli-stretch
119
  stage: transifex
120 121
  only:
    - branches
122 123
  before_script:
    - apt-get update -qq
124
    - apt-get install -y -qq gettext git
125 126
  script:
    - git clone https://gitlab.fusiondirectory.org/fusiondirectory/dev-tools.git ../dev-tools
127
    - ../dev-tools/locale-scripts/fusiondirectory-update-locale -g
128 129 130

# Update transifex
update-transifex:
131
  image: php:cli-stretch
132
  stage: transifex
133
  only:
134
    - /^1.*$/
135 136
  before_script:
    - apt-get update -qq
137
    - apt-get install -y -qq gettext git transifex-client
138 139
  script:
    - git clone https://gitlab.fusiondirectory.org/fusiondirectory/dev-tools.git ../dev-tools
140
    - echo $'[https://www.transifex.com]\nhostname = https://www.transifex.com\nusername = '"$TRANSIFEX_USER"$'\npassword = '"$TRANSIFEX_PASSWORD"$'\ntoken = '"$TRANSIFEX_API_TOKEN"$'\n' > ~/.transifexrc
141
    - tx pull -a -f
142
    - ../dev-tools/locale-scripts/fusiondirectory-update-locale -g
143
    - tx push -f -s -t --skip --no-interactive
144 145

build-tarballs:
146
  stage: tarballs
147 148 149 150
  script:
    - tar -cvzf fusiondirectory-core.tar.gz *
  artifacts:
    paths:
151
    - fusiondirectory-core.tar.gz
152
    expire_in: 1h
153 154 155 156 157 158

build-release:
  stage: tarballs
  only:
    - tags
  script: 
159
    - tar -cvzf fusiondirectory-core-$(grep '%' Changelog.md | head -n1 | cut -d ' ' -f3 | tr -d '"').tar.gz *
160 161
  artifacts:
    paths:
162
      - fusiondirectory-core-$(grep '%' Changelog.md | head -n1 | cut -d ' ' -f3 | tr -d '"').tar.gz