Skip to content

Adding id (#112)

Adding id (#112) #211

Workflow file for this run

name: CI Builds
on: [push]
jobs:
run:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true # Fetches all submodules
- uses: actions/setup-java@v5
with:
distribution: 'graalvm' # See 'Supported distributions' for available options
java-version: '25'
- name: Maven build
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./mvnw --batch-mode --no-transfer-progress test verify site properties:read-project-properties -Pjacoco -file pom.xml
- name: Get Maven project version
id: get_version
run: echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- name: E2E Tests
run: |
JAR="cli/target/pml-to-md-${{ steps.get_version.outputs.VERSION }}.jar"
echo "=== Test 1: Main command help ==="
java -jar "$JAR" --help | grep -q "convert\|validate"
if [ $? -ne 0 ]; then
echo "ERROR: Main help should show subcommands"
exit 1
fi
echo "✓ Main command help shows subcommands"
echo "=== Test 2: Convert command help ==="
java -jar "$JAR" convert --help | grep -q "Converts a PML file"
if [ $? -ne 0 ]; then
echo "ERROR: Convert command help should show description"
exit 1
fi
echo "✓ Convert command help works"
echo "=== Test 3: Validate command help ==="
java -jar "$JAR" validate --help | grep -q "Validates a PML file"
if [ $? -ne 0 ]; then
echo "ERROR: Validate command help should show description"
exit 1
fi
echo "✓ Validate command help works"
echo "=== Test 4: Convert valid PML file ==="
java -jar "$JAR" convert cli/src/test/resources/pml/pml-hello-world.xml > /tmp/output.md
if [ ! -s /tmp/output.md ]; then
echo "ERROR: Convert command produced empty output"
exit 1
fi
echo "✓ Convert command succeeded"
echo "=== Test 5: Convert with template replacement ==="
java -jar "$JAR" convert cli/src/test/resources/pml/pml-hello-world.xml --template goal "Updated goal text" > /tmp/output-template.md
if ! grep -q "Updated goal text" /tmp/output-template.md; then
echo "ERROR: Template replacement did not work"
exit 1
fi
echo "✓ Template replacement succeeded"
echo "=== Test 6: Convert with multiple template replacements ==="
java -jar "$JAR" convert cli/src/test/resources/pml/pml-with-multiple-fields.xml \
--template title "New Title" role "New Role" goal "New Goal" > /tmp/output-multiple.md
if ! grep -q "New Title" /tmp/output-multiple.md || ! grep -q "New Role" /tmp/output-multiple.md || ! grep -q "New Goal" /tmp/output-multiple.md; then
echo "ERROR: Multiple template replacements did not work"
exit 1
fi
echo "✓ Multiple template replacements succeeded"
echo "=== Test 7: Validate valid PML file ==="
java -jar "$JAR" validate cli/src/test/resources/pml/pml-hello-world.xml
if [ $? -ne 0 ]; then
echo "ERROR: Validation of valid file failed"
exit 1
fi
echo "✓ Validation of valid file succeeded"
echo "=== All E2E tests passed! ==="
- name: Upload jar
uses: actions/upload-artifact@v7
with:
name: pml-to-md-${{ steps.get_version.outputs.VERSION }}.jar
path: |
./cli/target/pml-to-md-${{ steps.get_version.outputs.VERSION }}.jar