-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy path.gitlab-ci.yml
170 lines (152 loc) · 3.92 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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
variables:
# disable the Gradle daemon for Continuous Integration servers
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
GIT_SUBMODULE_STRATEGY: recursive
ZOLA_VERSION: "v0.13.0"
include:
- template: SAST.gitlab-ci.yml
- template: Dependency-Scanning.gitlab-ci.yml
stages:
- build
- test
- pages
- publish
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
.cachetemplate: &cachedefinition
key: "$CI_COMMIT_REF_NAME-$JAVA_VERSION"
paths:
- build
- api/build
- core/build
- cli/build
- .gradle
.buildtemplate: &builddefinition
stage: build
script:
# create the executables for distribution
- ./gradlew --build-cache assembleDist --info
- mkdir bin
- cp cli/build/libs/*.jar bin/
- cp cli/build/distributions/*.zip bin/
# create checksum file to make sure we're distributing the right thing
- cd bin
- md5sum *.{jar,zip} > checksums.txt
artifacts:
name: "$CI_COMMIT_REF_NAME-snapshot"
paths:
- bin
expire_in: 1 week
cache:
<<: *cachedefinition
policy: push
build:linux:jdk8:
image: openjdk:8
<<: *builddefinition
build:linux:jdk11:
image: openjdk:11
<<: *builddefinition
.testtemplate: &testdefinition
stage: test
script:
- ./gradlew test
- ./gradlew detekt
cache:
<<: *cachedefinition
policy: pull
test:dependencies:
stage: test
needs: ["build:linux:jdk8"]
image: openjdk:8
script:
- ./gradlew dependencyUpdates
cache:
<<: *cachedefinition
policy: pull
test:spotless:
stage: test
needs: ["build:linux:jdk8"]
image: openjdk:8
script:
- ./gradlew spotlessCheck
cache:
<<: *cachedefinition
policy: pull
test:linux:jdk8:
needs: ["build:linux:jdk8"]
image: openjdk:8
<<: *testdefinition
test:linux:jdk11:
needs: ["build:linux:jdk11"]
image: openjdk:11
<<: *testdefinition
.pagestemplate: &pagesdefinition
stage: pages
image: nixos/nix:latest
needs: []
script:
- nix-env --install gnused
- tail -n +8 README.md | sed 's/## /# /g' >> website/content/_index.md
- tail -n +3 CHANGELOG.md | sed 's/## /# /g' >> website/content/CHANGELOG.md
- cd website && nix --extra-experimental-features nix-command --extra-experimental-features flakes develop -c zola build
# GL pages needs the artifact at the root directory
- cd .. && cp -r website/public ./public
pages:
<<: *pagesdefinition
artifacts:
paths:
- public
# this is required for building the manual and quickstart PDF
- website/public
expire_in: 1 week
rules:
- if: '$CI_COMMIT_REF_NAME == "master"'
- if: '$CI_COMMIT_TAG'
pages:for-manual:
<<: *pagesdefinition
artifacts:
paths:
# this is required for building the manual and quickstart PDF
- website/public
expire_in: 1 week
rules:
- if: '$CI_COMMIT_REF_NAME != "master"'
- if: '$CI_COMMIT_TAG == null'
publish:gitlab:
image: openjdk:8
stage: publish
script:
- ./gradlew publishAllPublicationsToGitLabRepository -PjobToken=$CI_JOB_TOKEN -Prelease=true
cache:
<<: *cachedefinition
policy: pull
rules:
- if: '$CI_COMMIT_TAG != null'
.ctantemplate: &ctandefinition
stage: publish
image: nixos/nix:latest
script:
- nix --extra-experimental-features nix-command --extra-experimental-features flakes develop -c gradle -Prelease=$PRELEASE assembleCTAN --info
- cp build/*.zip ./
artifacts:
name: "$CI_COMMIT_REF_NAME-ctan"
paths:
- ./*.zip
- docs/*.pdf
expire_in: 1 week
cache:
<<: *cachedefinition
policy: pull
publish:snapshot_tdszip:
variables:
PRELEASE: "false"
<<: *ctandefinition
rules:
- if: '$CI_COMMIT_TAG == null && $CI_MERGE_REQUEST_ID == null && $CI_COMMIT_REF_NAME == "development"'
- if: '$CI_COMMIT_TAG == null && $CI_MERGE_REQUEST_ID == null && $CI_COMMIT_REF_NAME == "master"'
publish:tdszip:
variables:
PRELEASE: "true"
<<: *ctandefinition
rules:
- if: '$CI_COMMIT_TAG != null'