Skip to content

Merge origin/main: updated example outputs #132

Merge origin/main: updated example outputs

Merge origin/main: updated example outputs #132

Workflow file for this run

name: TestExamples
on:
push:
branches:
- main
- develop
workflow_dispatch:
env:
WORKING_DIR: ./examples
APP_PORT: 6003
PARSER_PORT: 3001
MAPPER_PORT: 4000
CONVERTER_PORT: 5000
YARRRML_URL: http://yarrrml-parser:3001
MAPPER_URL: http://rmlmapper:4000
APP_MODE: development
SSL_VERIFY: "False"
jobs:
TestExamples:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq curl
- name: Create .env for Docker Compose
run: |
cat <<EOF > .env
PARSER_PORT=${PARSER_PORT}
APP_PORT=${APP_PORT}
MAPPER_PORT=${MAPPER_PORT}
CONVERTER_PORT=${CONVERTER_PORT}
YARRRML_URL=${YARRRML_URL}
MAPPER_URL=${MAPPER_URL}
APP_MODE=${APP_MODE}
SSL_VERIFY=${SSL_VERIFY}
EOF
- name: Start services
run: |
docker compose -f docker-compose.develop.yml up -d --build
echo "Waiting for services to be ready..."
sleep 30
docker compose ps
- name: Test API endpoints with example mappings
working-directory: ${{ env.WORKING_DIR }}
run: |
echo "Testing all YAML mapping files..."
for file in *.yaml
do
if [ -f "$file" ]; then
echo "================================================"
echo "Processing: $file"
echo "================================================"
BASENAME="${file%.yaml}"
MAPPING_URL="https://github.com/${{ github.repository }}/raw/${{ github.ref_name }}/examples/$file"
echo "Mapping URL: $MAPPING_URL"
# Test 1: Convert YARRRML to RML
echo "→ Testing /api/yarrrmltorml endpoint..."
curl -s -X POST "http://localhost:${APP_PORT}/api/yarrrmltorml" \
-H "Content-Type: application/json" \
-d "{\"mapping_url\":\"${MAPPING_URL}\"}" \
-o "${BASENAME}.rml"
if [ -s "${BASENAME}.rml" ]; then
echo "✓ Generated ${BASENAME}.rml"
else
echo "✗ Failed to generate ${BASENAME}.rml"
fi
# Test 2: Create RDF from mapping
echo "→ Testing /api/createrdf endpoint..."
RESULT=$(curl -s -X POST "http://localhost:${APP_PORT}/api/createrdf" \
-H "Content-Type: application/json" \
-d "{\"mapping_url\":\"${MAPPING_URL}\"}")
echo "$RESULT" | jq -r '.graph' > "${BASENAME}.rdf"
if [ -s "${BASENAME}.rdf" ]; then
NUM_APPLIED=$(echo "$RESULT" | jq -r '.num_mappings_applied')
NUM_SKIPPED=$(echo "$RESULT" | jq -r '.num_mappings_skipped')
echo "✓ Generated ${BASENAME}.rdf"
echo " - Mappings applied: ${NUM_APPLIED}"
echo " - Mappings skipped: ${NUM_SKIPPED}"
else
echo "✗ Failed to generate ${BASENAME}.rdf"
fi
echo ""
fi
done
- name: Print service logs
if: always()
run: docker compose logs
- name: Commit generated files
uses: EndBug/add-and-commit@v9
with:
message: updated example outputs
add: "*.rml *.rdf --force"
cwd: ./examples/