Test Build Script #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | | |
| if [ ! $(command -v sam) ]; then | |
| cd /tmp | |
| wget -q https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip | |
| unzip -q aws-sam-cli-linux-x86_64.zip -d aws-sam-cli-linux-x86_64 | |
| sudo ./aws-sam-cli-linux-x86_64/install | |
| sam --version | |
| fi | |
| - 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 -s | jq | |
| curl localhost:8000/api/v1/models -s -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 wget unzip jq | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Install AWS SAM CLI | |
| run: | | |
| cd /tmp | |
| wget -q https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip | |
| unzip -q aws-sam-cli-linux-x86_64.zip -d aws-sam-cli-linux-x86_64 | |
| sudo ./aws-sam-cli-linux-x86_64/install | |
| sam --version | |
| - name: Test deploy.sh script | |
| run: ./deploy.sh |