306 lines (295 loc) · 10.3 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]
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: Run build everything
run: sbt clean test:compile it:compile stage
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: Run API unit tests
run: make test-unit-ci
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: run API E2E tests
run: make test-e2e-ci
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: run API integration tests
run: make test-it-ci
js-lib-tests:
name: JS Lib Tests
needs: compile
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [11.x]
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: install requirements
run: sudo apt-get install expect
- name: print env file
run: |
make env-file
make print-env-file
- name: setup required node version
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: run JS lib tests
run: make test-js-lib-integration
upgrade-unit-tests:
name: Upgrade Unit Tests
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: run upgrade tests
run: sbt "upgrade/test"
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: build all docker images
run: |
make build-all-scala
make build-all-images
- name: start and initialize graphdb-se
run: |
docker network create knora-net
docker run --rm -d --name=db --network=knora-net -p 127.0.0.1:7200:7200 -e GDB_HEAP_SIZE=$GDB_HEAP_SIZE daschswiss/knora-graphdb-se -Dgraphdb.license.file=/graphdb/graphdb.license
sleep 5
make init-db-test-minimal
- name: unzip test data
run: unzip $GITHUB_WORKSPACE/test-data/v7.0.0/v7.0.0-knora-test.trig.zip -d $GITHUB_WORKSPACE/test-data/v7.0.0/
- name: empty repository
run: $GITHUB_WORKSPACE/upgrade/graphdb-se/empty-repository.sh -r knora-test -u gaga -p gaga -h localhost:7200
- name: load v7.0.0 data
run: $GITHUB_WORKSPACE/upgrade/graphdb-se/upload-repository.sh -r knora-test -u gaga -p gaga -h localhost:7200 $GITHUB_WORKSPACE/test-data/v7.0.0/v7.0.0-knora-test.trig
- name: dump repository data
run: |
mkdir -p $GITHUB_WORKSPACE/upgrade/out
$GITHUB_WORKSPACE/upgrade/graphdb-se/dump-repository.sh -r knora-test -u gaga -p gaga -h localhost:7200 $GITHUB_WORKSPACE/upgrade/out/dump.trig
- name: run upgrade from inside docker
run: docker run --rm --network=knora-net -v $GITHUB_WORKSPACE/upgrade/out:/upgrade/out daschswiss/knora-upgrade /upgrade/out/dump.trig /upgrade/out/dump-upgraded.trig
- name: empty repository
run: $GITHUB_WORKSPACE/upgrade/graphdb-se/empty-repository.sh -r knora-test -u gaga -p gaga -h localhost:7200
- name: load upgraded data
run: $GITHUB_WORKSPACE/upgrade/graphdb-se/upload-repository.sh -r knora-test -u gaga -p gaga -h localhost:7200 $GITHUB_WORKSPACE/upgraded/out/dump-upgraded.trig
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: run docs build test
run: |
mkdir -p $GITHUB_WORKSPACE/docs/target
chmod 777 $GITHUB_WORKSPACE/docs/target
make docs-build
# publish only for develop and tags
publish:
name: Publish to Dockerhub
needs: [api-unit-tests, api-e2e-tests, api-integration-tests, upgrade-unit-tests, upgrade-integration-tests, docs-build-test]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop' || 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: build and publish all images to Dockerhub
run: |
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin
make publish-all-images