Skip to content

Merge branch 'main' into chore/e2e-test #6

Merge branch 'main' into chore/e2e-test

Merge branch 'main' into chore/e2e-test #6

Workflow file for this run

name: "E2E Test"
on:
push:
branches:
- chore/e2e-test
workflow_dispatch:
schedule:
- cron: 0 22 * * *
jobs:
e2e-test:
name: "Build, Deploy and Test"
runs-on: ubuntu-latest
env:
WGET_ARGS: "-qO- -S --content-on-error"
WGET_URL: "localhost:8080"
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 9.5.0
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- run: pnpm i --frozen-lockfile
- name: Create .env file
env:
aicore: ${{ secrets.AIRCORE_ENV_SECRET }}
working-directory: ./sample-code
run: echo "aicore='$aicore'" > .env
- name: "Start App"
working-directory: ./sample-code
run: |
pnpm run local &
timeout=15
while ! nc -z localhost 8080; do
sleep 1
timeout=$((timeout - 1))
if [ $timeout -le 0 ]; then
echo "Server did not start within 15 seconds."
exit 1
fi
done
- name: "Health Check"
run: |
wget "$WGET_ARGS" "$WGET_URL/health"
- name: "OpenAI Chat Completion"
run: |
wget "$WGET_ARGS" "$WGET_URL/llm"
- name: "OpenAI Text Embedding"
run: |
wget "$WGET_ARGS" "$WGET_URL/embedding"
- name: "Slack Notification"
if: failure()
uses: slackapi/[email protected]
with:
payload: |
{
"username": "GitHub E2E Test Runner",
"text": "⚠️ E2E Test Failed! 😬 Please inspect & fix by clicking <https://github.com/SAP/ai-sdk-js/actions/runs/${{ github.run_id }}|here>"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK