306 lines (297 loc) · 8.79 KB
/
main.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
name: CI
on:
push:
release:
types: [published]
env:
KNORA_GDB_LICENSE: ${{ github.workspace }}/ci/graphdb/UNIBAS_DEV_GRAPHDB_SE_latest-31-12-2020_1cores.license
jobs:
compile:
name: Build Everything
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- name: cache maven artifacts
uses: actions/cache@v1
with:
path: ~/.ivy2
key: ${{ runner.OS }}-build-${{ hashFiles('**/KnoraBuild.sbt') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Disk Free
run: |
df -h
docker system df
docker system prune --all --force --volumes
df -h
- name: Run build everything
run: sbt clean test:compile it:compile stage
- name: Disk Free After
run: |
df -h
docker system df
api-unit-tests:
name: API Unit Tests
needs: compile
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Checkout private ci-assets
uses: actions/checkout@v2
with:
repository: dasch-swiss/dsp-ci-assets
token: ${{ secrets.GitHub_PAT }} # `GitHub_PAT` is a secret that contains the PAT.
path: ci
- name: cache maven artifacts
uses: actions/cache@v1
with:
path: ~/.ivy2
key: ${{ runner.OS }}-build-${{ hashFiles('**/KnoraBuild.sbt') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Print env file
run: |
make env-file
make print-env-file
- name: Disk Free
run: |
df -h
docker system df
docker system prune --all --force --volumes
df -h
- name: Run API unit tests
run: make test-unit-ci
- name: Disk Free After
run: |
df -h
docker system df
api-e2e-tests:
name: API E2E Tests
needs: compile
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Checkout private ci-assets
uses: actions/checkout@v2
with:
repository: dasch-swiss/dsp-ci-assets
token: ${{ secrets.GitHub_PAT }} # `GitHub_PAT` is a secret that contains the PAT.
path: ci
- name: cache maven artifacts
uses: actions/cache@v1
with:
path: ~/.ivy2
key: ${{ runner.OS }}-build-${{ hashFiles('**/KnoraBuild.sbt') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: print env file
run: |
make env-file
make print-env-file
- name: Disk Free
run: |
df -h
docker system df
docker system prune --all --force --volumes
df -h
- name: run API E2E tests
run: make test-e2e-ci
- name: Disk Free After
run: |
df -h
docker system df
api-integration-tests:
name: API Integration Tests
needs: compile
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Checkout private ci-assets
uses: actions/checkout@v2
with:
repository: dasch-swiss/dsp-ci-assets
token: ${{ secrets.GitHub_PAT }} # `GitHub_PAT` is a secret that contains the PAT.
path: ci
- name: cache maven artifacts
uses: actions/cache@v1
with:
path: ~/.ivy2
key: ${{ runner.OS }}-build-${{ hashFiles('**/KnoraBuild.sbt') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: print env file
run: |
make env-file
make print-env-file
- name: Disk Free
run: |
df -h
docker system df
docker system prune --all --force --volumes
df -h
- name: run API integration tests
run: make test-it-ci
- name: Disk Free After
run: |
df -h
docker system df
upgrade-integration-tests:
name: Upgrade Integration Tests
needs: compile
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Checkout private ci-assets
uses: actions/checkout@v2
with:
repository: dasch-swiss/dsp-ci-assets
token: ${{ secrets.GitHub_PAT }} # `GitHub_PAT` is a secret that contains the PAT.
path: ci
- uses: actions/setup-java@v1
with:
java-version: '11.x.x'
- name: cache maven artifacts
uses: actions/cache@v1
with:
path: ~/.ivy2
key: ${{ runner.OS }}-build-${{ hashFiles('**/KnoraBuild.sbt') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: install requirements
run: sudo apt-get install expect
- name: Disk Free
run: |
df -h
docker system df
docker system prune --all --force --volumes
df -h
- name: test repository update
run: cd $GITHUB_WORKSPACE && make test-repository-update
- name: Disk Free After
run: |
df -h
docker system df
docs-build-test:
name: Docs Build Test
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: cache maven artifacts
uses: actions/cache@v1
with:
path: ~/.ivy2
key: ${{ runner.OS }}-build-${{ hashFiles('**/KnoraBuild.sbt') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Disk Free
run: |
df -h
docker system df
docker system prune --all --force --volumes
df -h
- name: run docs build test
run: |
mkdir -p $GITHUB_WORKSPACE/docs/target
chmod 777 $GITHUB_WORKSPACE/docs/target
make docs-build
- name: Disk Free After
run: |
df -h
docker system df
# publish only on release
publish:
name: Publish to Dockerhub (on release only)
needs: [
api-unit-tests,
api-e2e-tests,
api-integration-tests,
upgrade-integration-tests,
docs-build-test
]
runs-on: ubuntu-latest
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 50
- name: cache maven artifacts
uses: actions/cache@v1
with:
path: ~/.ivy2
key: ${{ runner.OS }}-build-${{ hashFiles('**/KnoraBuild.sbt') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Disk Free
run: |
df -h
docker system df
docker system prune --all --force --volumes
df -h
- name: build and publish all images to Dockerhub
run: |
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin
mkdir -p $( dirname "$KNORA_GDB_LICENSE") && touch "$KNORA_GDB_LICENSE"
make publish-all-images
- name: Disk Free After
run: |
df -h
docker system df
- name: Generate Github release notes
uses: lakto/gren-action@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}