Skip to content

Remove incomplete tutorial draft #63

Remove incomplete tutorial draft

Remove incomplete tutorial draft #63

on:
push:
paths:
- 'src/main/**'
- 'pom.xml'
workflow_dispatch:
jobs:
test-tutorial:
runs-on: ubuntu-latest
env:
NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Pull Naftiko Docker image
run: docker pull ghcr.io/naftiko/framework:latest
- name: Run Naftiko with My First Capability
run: |
docker run -d \
-p 8081:8081 \
-v ${{ github.workspace }}/src/main/resources/schemas/tutorial/step-1-my-first-capability.yml:/app/step-1-my-first-capability.yml \
--name my_first_capability \
ghcr.io/naftiko/framework:latest \
/app/step-1-my-first-capability.yml
# Wait for the Naftiko framework to fully start before hitting the endpoint
sleep 2
- name: Consume /hello endpoint - My First Capability
run: |
RESPONSE=$(curl -s -f http://localhost:8081/hello || true)
if [[ -z "$RESPONSE" ]]; then
echo "My First Capability endpoint did not respond in time"
exit 1
fi
echo "Response: $RESPONSE"
- name: Show logs - My First Capability
if: always()
run: docker logs my_first_capability
- name: Stop My First Capability container
if: always()
run: |
docker stop my_first_capability
docker rm my_first_capability
- name: Run Naftiko with Forwarding API Resource
run: |
docker run -d \
-p 8081:8081 \
-v ${{ github.workspace }}/src/main/resources/schemas/tutorial/step-2-forwarding-api-resource.yml:/app/step-2-forwarding-api-resource.yml \
--name forwarding_api_resource \
ghcr.io/naftiko/framework:latest \
/app/step-2-forwarding-api-resource.yml
# Wait for the Naftiko framework to fully start before hitting the endpoint
sleep 2
- name: Consume /notion/users/me endpoint - Forwarding API Resource
run: |
RESPONSE=$(curl -s -f \
-H "Authorization: Bearer $NOTION_API_KEY" \
-H "Notion-Version: 2025-09-03" \
http://localhost:8081/notion/users/me || true)
if [[ -z "$RESPONSE" ]]; then
echo "Forwarding API Resource endpoint did not respond in time"
exit 1
fi
echo "Response: $RESPONSE"
- name: Show logs - Forwarding API Resource
if: always()
run: docker logs forwarding_api_resource
- name: Stop Forwarding API Resource container
if: always()
run: |
docker stop forwarding_api_resource
docker rm forwarding_api_resource
- name: Run Naftiko with Encapsulating Headers
run: |
docker run -d \
-p 8081:8081 \
-v ${{ github.workspace }}/src/main/resources/schemas/tutorial/step-3-encapsulating-headers.yml:/app/step-3-encapsulating-headers.yml \
--env notion_api_key=$NOTION_API_KEY \
--name encapsulating_headers \
ghcr.io/naftiko/framework:latest \
/app/step-3-encapsulating-headers.yml
# Wait for the Naftiko framework to fully start before hitting the endpoint
sleep 2
- name: Consume /notion/users/me endpoint - Encapsulating Headers
run: |
RESPONSE=$(curl -s -f http://localhost:8081/notion/users/me || true)
if [[ -z "$RESPONSE" ]]; then
echo "Encapsulating Headers endpoint did not respond in time"
exit 1
fi
echo "Response: $RESPONSE"
- name: Show logs - Encapsulating Headers
if: always()
run: docker logs encapsulating_headers
- name: Stop Encapsulating Headers container
if: always()
run: |
docker stop encapsulating_headers
docker rm encapsulating_headers
- name: Run Naftiko with Filter Response
run: |
docker run -d \
-p 8081:8081 \
-v ${{ github.workspace }}/src/main/resources/schemas/tutorial/step-4-filter-reponse.yml:/app/step-4-filter-reponse.yml \
--env notion_api_key=$NOTION_API_KEY \
--name filter_response \
ghcr.io/naftiko/framework:latest \
/app/step-4-filter-reponse.yml
# Wait for the Naftiko framework to fully start before hitting the endpoint
sleep 2
- name: Consume /notion/users/me endpoint - Filter Response
run: |
RESPONSE=$(curl -s -f http://localhost:8081/notion/users/me || true)
if [[ -z "$RESPONSE" ]]; then
echo "Filter Response endpoint did not respond in time"
exit 1
fi
echo "Response: $RESPONSE"
- name: Show logs - Filter Response
if: always()
run: docker logs filter_response
- name: Stop Step - Filter Response
if: always()
run: |
docker stop filter_response
docker rm filter_response
- name: Run Naftiko with Multi Steps
run: |
docker run -d \
-p 8081:8081 \
-v ${{ github.workspace }}/src/main/resources/schemas/tutorial/step-5-multi-steps.yml:/app/step-5-multi-steps.yml \
--env notion_api_key=$NOTION_API_KEY \
--name multi_steps \
ghcr.io/naftiko/framework:latest \
/app/step-5-multi-steps.yml
# Wait for the Naftiko framework to fully start before hitting the endpoint
sleep 2
- name: Consume /notion/my-full-user endpoint - Multi Steps
run: |
RESPONSE=$(curl -s -f http://localhost:8081/notion/my-full-user || true)
if [[ -z "$RESPONSE" ]]; then
echo "Multi Steps endpoint did not respond in time"
exit 1
fi
echo "Response: $RESPONSE"
- name: Show logs - Multi Steps
if: always()
run: docker logs multi_steps
- name: Stop Multi Steps container
if: always()
run: |
docker stop multi_steps
docker rm multi_steps
- name: Run Naftiko with MCP Server
run: |
docker run -d \
-p 9091:9091 \
-v ${{ github.workspace }}/src/main/resources/schemas/tutorial/step-6-mcp.yml:/app/step-6-mcp.yml \
--env notion_api_key=$NOTION_API_KEY \
--name mcp_server \
ghcr.io/naftiko/framework:latest \
/app/step-6-mcp.yml
# Wait for the Naftiko framework to fully start before hitting the endpoint
sleep 2
- name: Calling MCP server
run: |
if ! nc -z localhost 9091; then
echo "MCP server did not start in time"
exit 1
fi
echo "MCP server ready"
- name: Install yq
run: |
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
- name: Test MCP tools/list
run: |
RESPONSE=$(curl -s -f -X POST http://localhost:9091 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' || true)
if [[ -z "$RESPONSE" ]]; then
echo "MCP tools/list did not respond"
exit 1
fi
echo "Response: $RESPONSE"
CAPABILITY_FILE="${{ github.workspace }}/src/main/resources/schemas/tutorial/step-6-mcp.yml"
EXPECTED_COUNT=$(yq '.capability.exposes[0].tools | length' "$CAPABILITY_FILE")
EXPECTED_NAMES=$(yq '.capability.exposes[0].tools[].name' "$CAPABILITY_FILE")
ACTUAL_COUNT=$(echo "$RESPONSE" | jq '.result.tools | length')
if [[ "$ACTUAL_COUNT" != "$EXPECTED_COUNT" ]]; then
echo "Expected $EXPECTED_COUNT tool(s), got $ACTUAL_COUNT"
exit 1
fi
while IFS= read -r EXPECTED_NAME; do
FOUND=$(echo "$RESPONSE" | jq -r --arg name "$EXPECTED_NAME" '.result.tools[] | select(.name == $name) | .name')
if [[ -z "$FOUND" ]]; then
echo "Expected tool '$EXPECTED_NAME' not found in response"
exit 1
fi
done <<< "$EXPECTED_NAMES"
echo "tools/list validation passed: $ACTUAL_COUNT tool(s) matched"
- name: Show logs MCP Server
if: always()
run: docker logs mcp_server
- name: Stop MCP Server container
if: always()
run: |
docker stop mcp_server
docker rm mcp_server