Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
MatKuhr committed Jul 30, 2024
1 parent e0adcb5 commit de597b2
Show file tree
Hide file tree
Showing 9 changed files with 735 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/actions/setup-cloud-foundry/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Setup Cloud Foundy"
description: "Install the Cloud Foundry CLI and login to the AI SDK development space"

inputs:
username:
description: "The username of a technical user to login to Cloud Foundry"
required: true
password:
description: "The password of a technical user to login to Cloud Foundry"
required: true

runs:
using: composite
steps:
- name: Install Cloud Foundry CLI
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
run: |
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
sudo apt-get -qq update
sudo apt-get -qq install cf8-cli
echo "Installed CF CLI in version: $(cf -v)"
- name: Cloud Foundry Login
run: |
cf api https://api.cf.eu12-001.hana.ondemand.com/
cf login -u ${{ inputs.username }} -p ${{ inputs.password }}
cf target -o 'AI_Core Potsdam_gen-ai-hub-sdk-8pengs8d' -s dev
shell: bash
62 changes: 62 additions & 0 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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 https://ai-sdk-js-e2e-test.cfapps.eu12-001.hana.ondemand.com"
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 20
- name: "Setup Cloud Foundry"
uses: ./.github/actions/setup-cloud-foundry
with:
username: ${{ secrets.CF_USERNAME }}
password: ${{ secrets.CF_PASSWORD }}
- name: Create .env file
env:
aicore: ${{ secrets.AIRCORE_ENV_SECRET }}
run: echo "aicore='$aicore'" > .env
- name: "Build"
run: npm install
- name: "Deploy"
run: |
cd sample-code
cf push
- name: "Health Check"
run: |
wget "$WGET_ARGS/"
- name: "OpenAI Chat Completion"
run: |
wget "$WGET_ARGS/llm"
- name: "OpenAI Text Embedding"
run: |
wget "$WGET_ARGS/embedding"
- name: "Stop App"
if: always()
run: |
cf stop e2e-app-js
- name: "Slack Notification"
if: false
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
Loading

0 comments on commit de597b2

Please sign in to comment.