.gitlab-ci.yml 2.88 KB
Newer Older
1
2
3
4
include:
  # https://docs.gitlab.com/ce/ci/yaml/README.html#workflowrules-templates
  - template: 'Workflows/Branch-Pipelines.gitlab-ci.yml'

Matija Obreza's avatar
Matija Obreza committed
5
6
7
variables:
  # This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
  # `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
8
  MAVEN_OPTS: "-server -Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
Matija Obreza's avatar
Matija Obreza committed
9
10
11
  # As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
  # when running from the command line.
  # `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
12
  MAVEN_CLI_OPTS: "--batch-mode --errors --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
Matija Obreza's avatar
Matija Obreza committed
13
14
15
16
17
18
19

# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache:
  paths:
    - .m2/repository

Matija Obreza's avatar
Matija Obreza committed
20
stages:
21
  - test
Matija Obreza's avatar
Matija Obreza committed
22
23
  - deploy

24
25
run tests:
  stage:         test
Maxym Borodenko's avatar
Java 11  
Maxym Borodenko committed
26
  image:         maven:3-openjdk-11
Matija Obreza's avatar
Matija Obreza committed
27
  script:
28
29
30
31
    # First do coverage testing
    - mvn $MAVEN_CLI_OPTS --activate-profiles quality verify -U
    - cat coverage/target/site/jacoco-aggregate/index.html | grep -o 'Total[^%]*%'
  coverage: '/Total.*?([0-9]{1,3})%/'
Matija Obreza's avatar
Matija Obreza committed
32
  artifacts:
33
34
35
36
    name:                 "${CI_PROJECT_NAME}-${CI_COMMIT_REF_NAME}"
    expire_in:            1 day
    paths:
      - coverage/target/site/jacoco-aggregate
Matija Obreza's avatar
Matija Obreza committed
37
38
39
40
41
    reports:
      junit:
        - core/target/surefire-reports/TEST-*.xml
        - security/target/surefire-reports/TEST-*.xml
        - auditlog/target/surefire-reports/TEST-*.xml
Matija Obreza's avatar
Matija Obreza committed
42

43
publish snapshot artifacts:
Matija Obreza's avatar
Matija Obreza committed
44
  stage:         deploy
Maxym Borodenko's avatar
Java 11  
Maxym Borodenko committed
45
  image:         maven:3-openjdk-11
46
47
  dependencies:
    - run tests
Matija Obreza's avatar
Matija Obreza committed
48
49
  before_script:
    - echo "${GPG_KEY_SECRET}" | gpg --batch --import
Matija Obreza's avatar
Matija Obreza committed
50
    - gpg --list-keys
Matija Obreza's avatar
Matija Obreza committed
51
  script:
52
53
54
55
56
    # Package the clean app
    - mvn $MAVEN_CLI_OPTS -DskipTests=true clean deploy --settings .ci-maven-settings.xml
  rules:
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'

57
58

publish artifacts on central:
Matija Obreza's avatar
Matija Obreza committed
59
  stage:         deploy
60
61
62
63
  dependencies:
    - run tests
  rules:
    - if: '$CI_COMMIT_TAG =~ /^application\-blocks\-/'
Maxym Borodenko's avatar
Java 11  
Maxym Borodenko committed
64
  image:         maven:3-openjdk-11
Matija Obreza's avatar
Matija Obreza committed
65
66
67
  before_script:
    - echo "${GPG_KEY_SECRET}" | gpg --batch --import
    - gpg --list-keys
68
  script:
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    # Package the clean app
    - mvn $MAVEN_CLI_OPTS -DskipTests=true --activate-profiles release clean deploy --settings .ci-maven-settings.xml

pages:
  stage: deploy
  dependencies:
    - run tests
  rules:
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
  script:
   - mkdir public
   - mv coverage/target/site/jacoco-aggregate/* public
  artifacts:
    expire_in: 1 days
    paths:
      - public