Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Test Build Script

on:
schedule:
- cron: "0 0 * * 0"
push:
branches:
- main
pull_request:
branches:
- '*'

jobs:
test-local-build-and-e2e:
runs-on: ubuntu-latest
name: Test deploy.sh in standard environment

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install AWS SAM CLI
run: pip install aws-sam-cli

- name: Test deploy.sh script
run: ./deploy.sh

- name: Test local uvicorn/FastAPI server
run: |
mv .aws-sam/build/BedrockAccessGatewayLayer/python/* ./app
(cd app && ./run.sh &)
timeout 30 bash -c 'while ! nc -z localhost 8000; do sleep 1; done'
curl localhost:8000/health | jq
curl localhost:8000/api/v1/models -H 'Authorization: Bearer bedrock' | jq

test-cloudshell-build:
runs-on: ubuntu-latest
name: Test deploy.sh in CloudShell environment
container:
image: public.ecr.aws/amazonlinux/amazonlinux:2023
env:
AWS_EXECUTION_ENV: CloudShell

steps:
- name: Install dependencies
run: |
yum install -y sudo python3-pip tar git
pip3 install aws-sam-cli

- name: Checkout code
uses: actions/checkout@v3

- name: Test deploy.sh script
run: ./deploy.sh
Empty file modified app/run.sh
100644 → 100755
Empty file.
8 changes: 7 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

PYTHON_VERSION=3.12
export PYTHON_VERSION=3.12
export SAM_CLI_TELEMETRY=0

# Parse command line arguments
while [[ $# -gt 0 ]]; do
Expand All @@ -27,4 +28,9 @@ fi
./prepare_source.sh $NO_EMBEDDINGS

sam build $USE_CONTAINER

if [[ ! -z "$CI" ]]; then
exit
fi

sam deploy --guided
3 changes: 3 additions & 0 deletions prepare_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ fi

cp -r $REPO_DIR/src/api app/api

# To surpress warnings
echo "" > app/requirements.txt

# Remove "Manum" from requirements.txt, as LWA is used instead.
grep -v "mangum" $REPO_DIR/src/requirements.txt > layer/requirements.txt
grep -v "Mangum" $REPO_DIR/src/api/app.py > app/api/app.py
Expand Down