.gitlab-ci.yml 2.22 KB
Newer Older
vagrant's avatar
vagrant committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
68
69
70
71
72
73
74
75
76
77
78
79
80

cache:
    key: "$CI_COMMIT_REF_NAME"
    paths:
        - .maven/
stages:
    - build
    - test
    - analyze
    - package
    - release
    - deploy


before_script:
    - export MAVEN_USER_HOME=`pwd`/.maven
    - ./mvnw com.github.eirslett:frontend-maven-plugin:install-node-and-npm -DnodeVersion=v10.13.0 -DnpmVersion=6.4.1 -Dmaven.repo.local=$MAVEN_USER_HOME
    - ./mvnw com.github.eirslett:frontend-maven-plugin:npm -Dmaven.repo.local=$MAVEN_USER_HOME

maven-compile:
    stage: build
    script:
        - ./mvnw compile -Dmaven.repo.local=$MAVEN_USER_HOME
    artifacts:
        paths:
            - target/classes/
            - target/generated-sources/
        expire_in: 1 day

maven-test:
    stage: test
    script:
        - ./mvnw test -Dmaven.repo.local=$MAVEN_USER_HOME
    artifacts:
        reports:
            junit: target/surefire-reports/TEST-*.xml
        paths:
            - target/test-results
        expire_in: 1 day

frontend-test:
    stage: test
    script:
        - ./mvnw com.github.eirslett:frontend-maven-plugin:npm -Dfrontend.npm.arguments='test -- -u' -Dmaven.repo.local=$MAVEN_USER_HOME
    artifacts:
        reports:
            junit: target/test-results/jest/TESTS-*.xml
        paths:
            - target/test-results
        expire_in: 1 day

maven-package:
    stage: package
    script:
        - ./mvnw verify -Pprod -DskipTests -Dmaven.repo.local=$MAVEN_USER_HOME
    artifacts:
        paths:
            - target/*.war
        expire_in: 1 day

# Uncomment the following line to use gitlabs container registry. You need to adapt the REGISTRY_URL in case you are not using gitlab.com
#docker-push:
#    image: docker:latest
#    services:
#        - docker:dind
#    variables:
#        REGISTRY_URL: registry.gitlab.com
#        DOCKER_HOST: tcp://docker:2375
#        DOCKER_DRIVER: overlay2
#        IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
#    stage: release
#    dependencies:
#        - maven-package
#    before_script:
#        - docker info
#        - cp target/*.war src/main/docker
#    script:
#        - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $REGISTRY_URL
#        - docker build -f src/main/docker/Dockerfile -t $IMAGE_TAG src/main/docker
#        - docker push $IMAGE_TAG