-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
86 lines (80 loc) · 2.06 KB
/
.gitlab-ci.yml
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
81
82
83
84
85
86
variables:
MAVEN_OPTS: "-DproxySet=true -Dhttp.proxyHost=web-proxy.rrzn.uni-hannover.de -Dhttp.proxyPort=3128 -Dhttp.nonProxyHosts=learnweb.l3s.uni-hannover.de -Dhttps.proxyHost=web-proxy.rrzn.uni-hannover.de -Dhttps.proxyPort=3128 -Dhttps.nonProxyHosts=learnweb.l3s.uni-hannover.de"
MAVEN_CLI_OPTS: "-P prod,!local --batch-mode"
MAVEN_CLI_QUIET: "--quiet -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.MavenCli=OFF"
stages:
- lint
- test
- build
- deploy
# Check for code style issues
lint:
stage: lint
tags:
- javascript
- java
script:
- npm ci
- npm run lint --silent
- mvn $MAVEN_CLI_OPTS $MAVEN_CLI_QUIET checkstyle:check
cache:
paths:
- node_modules/
# Run Java tests
test:
stage: test
tags:
- java
script:
- mvn $MAVEN_CLI_OPTS $MAVEN_CLI_QUIET compile spotbugs:check
- mvn $MAVEN_CLI_OPTS test
rules:
- if: '$CI_COMMIT_BRANCH != "master"'
# Build Java sources (includes tests)
build:
stage: build
tags:
- javascript
- java
script:
- npm run build
- mvn $MAVEN_CLI_OPTS $MAVEN_CLI_QUIET spotbugs:check
- mvn $MAVEN_CLI_OPTS install
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
cache:
paths:
- node_modules/
- target/Learnweb.war
# Any commit to `master` branch will be deployed to /dev instance
deploy_dev:
stage: deploy
tags:
- java
script:
- mvn $MAVEN_CLI_OPTS tomcat7:redeploy-only -Dpath=dev
environment:
name: dev
url: https://learnweb.l3s.uni-hannover.de/dev/
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
cache:
paths:
- target/Learnweb.war
policy: pull
# A commit to `master` brunch with message `chore: version release` will be deployed to ROOT instance
deploy_prod:
stage: deploy
tags:
- java
script:
- mvn $MAVEN_CLI_OPTS tomcat7:deploy-only -Dpath=ROOT
environment:
name: prod
url: https://learnweb.l3s.uni-hannover.de/
rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TITLE == "chore: version release"'
cache:
paths:
- target/Learnweb.war
policy: pull