Skip to content

Commit 775495f

Browse files
author
Gabriel Koo
committed
Add GitHub Actions workflow for testing build process
1 parent 30d83ef commit 775495f

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

.github/workflows/test-build.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ jobs:
2525
python-version: '3.12'
2626

2727
- name: Install AWS SAM CLI
28-
run: pip install aws-sam-cli
28+
run: |
29+
cd /tmp
30+
wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip
31+
unzip aws-sam-cli-linux-x86_64.zip -d aws-sam-cli-linux-x86_64
32+
sudo ./aws-sam-cli-linux-x86_64/install
33+
sam --version
2934
3035
- name: Test deploy.sh script
3136
run: ./deploy.sh
@@ -35,8 +40,8 @@ jobs:
3540
mv .aws-sam/build/BedrockAccessGatewayLayer/python/* ./app
3641
(cd app && ./run.sh &)
3742
timeout 30 bash -c 'while ! nc -z localhost 8000; do sleep 1; done'
38-
curl localhost:8000/health | jq
39-
curl localhost:8000/api/v1/models -H 'Authorization: Bearer bedrock' | jq
43+
curl localhost:8000/health -s | jq
44+
curl localhost:8000/api/v1/models -s -H 'Authorization: Bearer bedrock' | jq
4045
4146
test-cloudshell-build:
4247
runs-on: ubuntu-latest
@@ -48,12 +53,18 @@ jobs:
4853

4954
steps:
5055
- name: Install dependencies
51-
run: |
52-
yum install -y sudo python3-pip tar git
53-
pip3 install aws-sam-cli
56+
run: yum install -y sudo python3-pip tar git wget unzip jq
5457

5558
- name: Checkout code
5659
uses: actions/checkout@v3
5760

61+
- name: Install AWS SAM CLI
62+
run: |
63+
cd /tmp
64+
wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip
65+
unzip aws-sam-cli-linux-x86_64.zip -d aws-sam-cli-linux-x86_64
66+
sudo ./aws-sam-cli-linux-x86_64/install
67+
sam --version
68+
5869
- name: Test deploy.sh script
5970
run: ./deploy.sh

deploy.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
export PYTHON_VERSION=3.12
4-
export SAM_CLI_TELEMETRY=0
4+
export SAM_CLI_TELEMETRY=0
55

66
# Parse command line arguments
77
while [[ $# -gt 0 ]]; do
@@ -29,6 +29,10 @@ fi
2929

3030
sam build $USE_CONTAINER
3131

32+
AWS_REGION=${AWS_REGION:-us-east-1}
33+
34+
sam validate --region $AWS_REGION --lint
35+
3236
if [[ ! -z "$CI" ]]; then
3337
exit
3438
fi

template.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Parameters:
2929
Default: amazon.nova-premier-v1:0
3030
AllowedPattern: "([a-z]+\\.)?[a-z0-9-]+\\.[a-z0-9-]+(:\\d+)?"
3131
ConstraintDescription: "Must be a valid Bedrock model ID, cross regioninference profiles are also supported (e.g., us.amazon.nova-premier-v1:0)"
32-
DEBUG:
32+
Debug:
3333
Type: String
3434
Description: "Enable debug mode"
3535
Default: "false"
@@ -45,13 +45,12 @@ Metadata:
4545
Parameters:
4646
- LambdaAdapterLayerVersion
4747
- PythonRuntime
48-
- Architecture
4948
- Label:
5049
default: "Application Configuration"
5150
Parameters:
5251
- ApiKey
5352
- DefaultModel
54-
- DEBUG
53+
- Debug
5554

5655
Globals:
5756
Function:
@@ -85,7 +84,7 @@ Resources:
8584
AWS_LWA_INVOKE_MODE: RESPONSE_STREAM
8685
# Align with `app/api/app.py` in the `uvicorn.run` line
8786
AWS_LWA_PORT: 8000
88-
DEBUG: !Ref DEBUG
87+
DEBUG: !Ref Debug
8988
DEFAULT_MODEL: !Ref DefaultModel
9089
ENABLE_CROSS_REGION_INFERENCE: 'true'
9190
Layers:

0 commit comments

Comments
 (0)