Repository navigation
123 lines (106 loc) · 4.08 KB
/
Copy pathdocument-metadata.yaml
File metadata and controls
123 lines (106 loc) · 4.08 KB
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
name: Document metadata integration
on:
push:
pull_request:
workflow_dispatch:
inputs:
db_ref:
description: Polypheny-DB revision containing document metadata support
required: false
permissions:
contents: read
jobs:
build-polypheny:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: polypheny/Polypheny-DB
ref: ${{ inputs.db_ref || vars.POLYPHENY_DB_REF || '60148752327124249d5263ffaab15fdfc54f4517' }}
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Build server and plugins and validate Java metadata
run: >-
./gradlew :dbms:shadowJar assemblePlugins
:plugins:prism-interface:test
:plugins:mongodb-adapter:test --tests '*MongoIndexMetadataTest'
-PwithoutpullingUi=true --console=plain
- name: Produce final executable server JAR
# dbms:jar and dbms:shadowJar currently share an output path. Run the
# shadow task last so the uploaded artifact contains runtime classes.
run: ./gradlew :dbms:shadowJar -PwithoutpullingUi=true --console=plain
- name: Select executable server JAR
run: |
python - <<'PY'
from pathlib import Path
import shutil
import zipfile
candidates = [path for path in Path('dbms/build/libs').glob('dbms-*.jar')
if not path.stem.endswith(('-tests', '-sources', '-javadoc'))]
assert len(candidates) == 1, f'Expected one executable JAR, found {candidates}'
with zipfile.ZipFile(candidates[0]) as archive:
assert 'org/slf4j/Logger.class' in archive.namelist(), 'Server JAR lacks runtime dependencies'
shutil.copyfile(candidates[0], 'polypheny.jar')
PY
- uses: actions/upload-artifact@v4
with:
name: polypheny-jar
path: polypheny.jar
document-metadata:
timeout-minutes: 15
runs-on: ubuntu-latest
needs: build-polypheny
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Install test dependencies
run: python -m pip install -r requirements.txt pymongo==4.10.1
- name: Start MongoDB replica set
run: |
docker run --detach --name prism-metadata-mongo --publish 27017:27017 mongo:7.0 --replSet prism --bind_ip_all
python - <<'PY'
import time
from pymongo import MongoClient
from pymongo.errors import PyMongoError
client = MongoClient('127.0.0.1', 27017, directConnection=True, serverSelectionTimeoutMS=1000)
deadline = time.monotonic() + 60
while True:
try:
client.admin.command('ping')
break
except PyMongoError:
if time.monotonic() >= deadline:
raise
time.sleep(1)
client.admin.command('replSetInitiate', {'_id': 'prism', 'members': [{'_id': 0, 'host': '127.0.0.1:27017'}]})
while not client.admin.command('hello').get('isWritablePrimary'):
if time.monotonic() >= deadline:
raise RuntimeError('MongoDB did not elect a primary')
time.sleep(0.2)
client.close()
PY
- uses: actions/download-artifact@v4
with:
name: polypheny-jar
- name: Run live document and index metadata suites
uses: polypheny/GitHub-Action-Run-Polypheny@v0.2.0
with:
cmd: python -m pytest -v tests/document_metadata.py tests/document_metadata_mongo.py
jar: polypheny.jar
autodocker: false
timeout-minutes: 10
- name: MongoDB logs
if: failure()
run: docker logs prism-metadata-mongo
- name: Stop MongoDB
if: always()
run: docker rm --force prism-metadata-mongo