Skip to content

Commit

Permalink
Split warning and error validation #29
Browse files Browse the repository at this point in the history
  • Loading branch information
sroertgen committed Mar 19, 2024
1 parent cff5ed3 commit 99583b3
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Validate TTL Files
on: [push]

jobs:
validate-ttl:
validate-for-warnings:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -12,35 +12,39 @@ jobs:
- name: Check for Warnings
continue-on-error: true
run: |
curl -s https://raw.githubusercontent.com/skohub-io/shapes/main/scripts/checkForWarning.rq >> checkForWarning.rq
find . -type f -name '*.ttl' | while read file; do
# Adjust the file path to remove the './' part
adjusted_file_path=$(echo "$file" | sed 's|^./||')
echo "Processing $adjusted_file_path with Docker..."
docker run --rm -v "$(pwd)/$adjusted_file_path:/rdf/test.ttl" skohub/jena:4.6.1 riot --validate /rdf/test.ttl
result="$(docker run --rm -v "$(pwd)/$adjusted_file_path:/rdf/test.ttl" skohub/jena:4.6.1 shacl validate --shapes https://raw.githubusercontent.com/skohub-io/shapes/main/skohub.shacl.ttl --data /rdf/test.ttl)"
echo $result > result.ttl
curl -s https://raw.githubusercontent.com/skohub-io/shapes/main/scripts/checkForWarning.rq >> checkForWarning.rq
validationResult="$(docker run --rm --mount type=bind,source=./checkForWarning.rq,target=/rdf/checkForViolation.rq --mount type=bind,source=./result.ttl,target=/rdf/result.ttl skohub/jena:4.6.1 arq --data /rdf/result.ttl --query /rdf/checkForViolation.rq)"
echo $validationResult
lines=$(echo "$validationResult" | wc -l )
validation_result="$(docker run --rm --mount type=bind,source=./checkForWarning.rq,target=/rdf/checkForViolation.rq --mount type=bind,source=./result.ttl,target=/rdf/result.ttl skohub/jena:4.6.1 arq --data /rdf/result.ttl --query /rdf/checkForViolation.rq)"
echo $validation_result
lines=$(echo "$validation_result" | wc -l )
# Correct validation has 4 lines of output
[[ ${lines} -eq 4 ]] || die "$validationResult"
[[ ${lines} -eq 4 ]] || exit 1
done
validate-for-errors:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check for Errors
run: |
curl -s https://raw.githubusercontent.com/skohub-io/shapes/main/scripts/checkForViolation.rq >> checkForViolation.rq
find . -type f -name '*.ttl' | while read file; do
# Adjust the file path to remove the './' part
adjusted_file_path=$(echo "$file" | sed 's|^./||')
echo "Processing $adjusted_file_path with Docker..."
docker run --rm -v "$(pwd)/$adjusted_file_path:/rdf/test.ttl" skohub/jena:4.6.1 riot --validate /rdf/test.ttl
result="$(docker run --rm -v "$(pwd)/$adjusted_file_path:/rdf/test.ttl" skohub/jena:4.6.1 shacl validate --shapes https://raw.githubusercontent.com/skohub-io/shapes/main/skohub.shacl.ttl --data /rdf/test.ttl)"
echo $result > result.ttl
curl -s https://raw.githubusercontent.com/skohub-io/shapes/main/scripts/checkForViolation.rq >> checkForViolation.rq
validationResult="$(docker run --rm --mount type=bind,source=./checkForViolation.rq,target=/rdf/checkForViolation.rq --mount type=bind,source=./result.ttl,target=/rdf/result.ttl skohub/jena:4.6.1 arq --data /rdf/result.ttl --query /rdf/checkForViolation.rq)"
echo $validationResult
lines=$(echo "$validationResult" | wc -l )
validation_result="$(docker run --rm --mount type=bind,source=./checkForViolation.rq,target=/rdf/checkForViolation.rq --mount type=bind,source=./result.ttl,target=/rdf/result.ttl skohub/jena:4.6.1 arq --data /rdf/result.ttl --query /rdf/checkForViolation.rq)"
echo $validation_result
lines=$(echo "$validation_result" | wc -l )
# Correct validation has 4 lines of output
[[ ${lines} -eq 4 ]] || die "$validationResult"
[[ ${lines} -eq 4 ]] || exit 1
done

0 comments on commit 99583b3

Please sign in to comment.