Skip to content

Commit d3151ff

Browse files
committed
Create shacl-shacl.yml
1 parent 4971d07 commit d3151ff

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/shacl-shacl.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: SHACL Validation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
validate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Perform SHACL Validation
17+
id: shacl
18+
run: |
19+
DATAFILE=$(base64 -w 0 schemas/ImagingOntologyCombined.ttl)
20+
SHAPESFILE=$(base64 -w 0 src/shacl-shacl.ttl)
21+
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "http://imagingplazadev.epfl.ch:7200/validate" \
22+
-H "Content-Type: application/json" \
23+
-d "{\"datafile\": \"$DATAFILE\", \"shapesfile\": \"$SHAPESFILE\"}")
24+
BODY=$(echo "$RESPONSE" | sed '$d')
25+
HTTP_STATUS=$(echo "$RESPONSE" | tail -n1)
26+
27+
echo "SHACL API Response: $BODY"
28+
echo "HTTP Status: $HTTP_STATUS"
29+
30+
if [[ "$HTTP_STATUS" -ne 200 ]]; then
31+
echo "::error::SHACL validation request failed. HTTP Status: $HTTP_STATUS"
32+
exit 1
33+
fi
34+
35+
if echo "$BODY" | grep -q '"conforms": false'; then
36+
echo "::error::SHACL validation found errors."
37+
exit 1
38+
fi
39+
40+
echo "SHACL validation passed!"
41+
42+
- name: Success message
43+
if: success()
44+
run: echo "✅ SHACL validation passed!"

0 commit comments

Comments
 (0)