-
Notifications
You must be signed in to change notification settings - Fork 3
70 lines (61 loc) · 2.79 KB
/
test_other_formats.yaml
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
name: test generating other formats
on:
push:
branches:
- main
pull_request:
permissions:
contents: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install the required python packages
run: python -m pip install .[test]
- name: Other installations
run: |
sudo apt-get update
sudo apt-get install -y build-essential git wget curl colordiff
- name: Generate other model representations
run: |
cd linkml-schema
mkdir tests_artifacts
mkdir tests_artifacts/json-schema-autogen
mkdir tests_artifacts/jsonld-context-autogen
mkdir tests_artifacts/models_py-autogen
mkdir tests_artifacts/erdiagram-autogen
for file in *.yaml; do
if [[ "$file" != *bican* && "$file" != *core* ]]; then
name=`basename ${file} .yaml`;
echo "Processing $name file..";
gen-json-schema ${file} > tests_artifacts/json-schema-autogen/${name}.json;
echo "Diff in json schema for $name file (comparing to the current version)"
colordiff ../json-schema-autogen/${name}.json tests_artifacts/json-schema-autogen/${name}.json || true
# generating jsonld context and removing generation_date field to avoid constant updates
gen-jsonld-context ${file} > tests_artifacts/jsonld-context-autogen/${name}.context.jsonld;
sed -i "/generation_date/d" tests_artifacts/jsonld-context-autogen/${name}.context.jsonld;
echo "Diff in jsonld context for $name file (comparing to the current version)"
colordiff ../jsonld-context-autogen/${name}.context.jsonld tests_artifacts/jsonld-context-autogen/${name}.context.jsonld || true
gen-pydantic ${file} > tests_artifacts/models_py-autogen/${name}.py;
echo "Diff in pydantic model for $name file (comparing to the current version)"
colordiff ../models_py-autogen/${name}.py tests_artifacts/models_py-autogen/${name}.py || true
if [ ${name} = "library_generation" ] || [ ${name} = "genome_annotation" ]; then
echo "Creating and Fixing diagrams for $name";
python ../utils/fix_and_create_erdiagram.py
else
gen-erdiagram ${file} > tests_artifacts/erdiagram-autogen/${name}.md;
fi
fi
done
ls -l tests_artifacts/json-schema-autogen
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: artifacts
path: linkml-schema/tests_artifacts/*