Skip to content

Commit

Permalink
added github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwembo committed Apr 25, 2024
1 parent b0cd4b9 commit 0d3a2ac
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 60 deletions.
80 changes: 42 additions & 38 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,47 @@
# name: AWS Service CI/CD
name: AWS CDK deploy AI Service API

# on:
# push:
# branches: ['main', 'master']
# pull_request:
# branches: ['main', 'master']
on:
push:
branches: [master, main, dev/*, feature/*, release/*, staging/*, prod/*, qa]
pull_request:
branches: [master, main, dev/*, feature/*, release/*, staging/*, prod/*, qa]

# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_DEFAULT_REGION: "us-east-1"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: "us-east-1"

# jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
# - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
# - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
# - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
# - uses: actions/checkout@v3
# - name: Set up Python 3.9
# uses: actions/setup-python@v4
# with:
# python-version: "3.9"
# - name: Set up Node
# uses: actions/setup-node@v3
# with:
# node-version: "16"
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "16"

# - name: Install Python dependencies and CDK
# run: |
# python -m pip install --upgrade pip
# # install your Python dependencies here
# npm install -g aws-cdk
# pip install -r requirements.txt
# pip install -r requirements-dev.txt
- name: Install Python dependencies and CDK
run: |
python -m pip install --upgrade pip
# install your Python dependencies here
npm install -g aws-cdk
pip install -r requirements.txt
# # - name: Deploy to AWS
# # run: cdk deploy --require-approval=never --no-asset-metadata --force
# - name: Destroy stack
# run: cdk destroy --require-approval=never --no-asset-metadata --force
- name: Deploy to AWS
run: cdk deploy ApiLambdaBedrockStack --require-approval=never --no-asset-metadata --force
env:
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }}

# - name: Destroy stack
# run: cdk destroy --require-approval=never --no-asset-metadata --force
8 changes: 4 additions & 4 deletions .github/workflows/run_python_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
pip install -U coverage
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with pylint
run: |
pylint apps/home
continue-on-error: true
# - name: Lint with pylint
# run: |
# pylint apps/home
# continue-on-error: true
- name: Test with pytest
run: |
# pytest -v -s
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ __pycache__
# CDK asset staging directory
.cdk.staging
cdk.out
venv
./venv
36 changes: 18 additions & 18 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Resources:
CompatibleRuntimes:
- python3.10
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/Boto3Layer/Resource
aws:cdk:path: ApiLambdaBedrockStack/Boto3Layer/Resource
aws:asset:path: asset.71935fa708b6f595452cd5b66b67e4897d4653a82adc544d0c2a2c165c8f1298.zip
aws:asset:is-bundled: false
aws:asset:property: Content
Expand All @@ -31,7 +31,7 @@ Resources:
Roles:
- Ref: MyFunctionServiceRole3C357FF2
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/InvokeModelPolicy/Resource
aws:cdk:path: ApiLambdaBedrockStack/InvokeModelPolicy/Resource
MyFunctionServiceRole3C357FF2:
Type: AWS::IAM::Role
Properties:
Expand All @@ -49,14 +49,14 @@ Resources:
- Ref: AWS::Partition
- :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/MyFunction/ServiceRole/Resource
aws:cdk:path: ApiLambdaBedrockStack/MyFunction/ServiceRole/Resource
MyFunction3BAA72D1:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket:
Fn::Sub: cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}
S3Key: 46c24f26abc575f4718a49ec1a295357c936d89c73d1f1f3f05d7d686940a2aa.zip
S3Key: 29069b9cd3de018f1196a1ccde2785ab561f68630b89c6e2f3d3a2fe6290b764.zip
Role:
Fn::GetAtt:
- MyFunctionServiceRole3C357FF2
Expand All @@ -69,17 +69,17 @@ Resources:
DependsOn:
- MyFunctionServiceRole3C357FF2
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/MyFunction/Resource
aws:asset:path: asset.46c24f26abc575f4718a49ec1a295357c936d89c73d1f1f3f05d7d686940a2aa
aws:cdk:path: ApiLambdaBedrockStack/MyFunction/Resource
aws:asset:path: asset.29069b9cd3de018f1196a1ccde2785ab561f68630b89c6e2f3d3a2fe6290b764
aws:asset:is-bundled: false
aws:asset:property: Code
ServerlessLandGenAI3932CB69:
Type: AWS::ApiGateway::RestApi
Properties:
Name: ServerlessLandGenAI
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/ServerlessLandGenAI/Resource
ServerlessLandGenAIDeploymentAB06D0199bd18db26d65736d1507b2c05681161e:
aws:cdk:path: ApiLambdaBedrockStack/ServerlessLandGenAI/Resource
ServerlessLandGenAIDeploymentAB06D01945513ae789644cc31803ae8f429f99bd:
Type: AWS::ApiGateway::Deployment
Properties:
RestApiId:
Expand All @@ -89,17 +89,17 @@ Resources:
- ServerlessLandGenAItextgenPOSTD9CF9A37
- ServerlessLandGenAItextgen7DB7CAB2
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/ServerlessLandGenAI/Deployment/Resource
aws:cdk:path: ApiLambdaBedrockStack/ServerlessLandGenAI/Deployment/Resource
ServerlessLandGenAIDeploymentStageprodD2F4F2E0:
Type: AWS::ApiGateway::Stage
Properties:
RestApiId:
Ref: ServerlessLandGenAI3932CB69
DeploymentId:
Ref: ServerlessLandGenAIDeploymentAB06D0199bd18db26d65736d1507b2c05681161e
Ref: ServerlessLandGenAIDeploymentAB06D01945513ae789644cc31803ae8f429f99bd
StageName: prod
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/ServerlessLandGenAI/DeploymentStage.prod/Resource
aws:cdk:path: ApiLambdaBedrockStack/ServerlessLandGenAI/DeploymentStage.prod/Resource
ServerlessLandGenAItextgen7DB7CAB2:
Type: AWS::ApiGateway::Resource
Properties:
Expand All @@ -111,8 +111,8 @@ Resources:
RestApiId:
Ref: ServerlessLandGenAI3932CB69
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/ServerlessLandGenAI/Default/text_gen/Resource
ServerlessLandGenAItextgenPOSTApiPermissionApigwLambdaBedrockStackServerlessLandGenAIF613D839POSTtextgenCAEF386D:
aws:cdk:path: ApiLambdaBedrockStack/ServerlessLandGenAI/Default/text_gen/Resource
ServerlessLandGenAItextgenPOSTApiPermissionApiLambdaBedrockStackServerlessLandGenAIABB29318POSTtextgen8EBA4F6E:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
Expand All @@ -136,8 +136,8 @@ Resources:
- Ref: ServerlessLandGenAIDeploymentStageprodD2F4F2E0
- /POST/text_gen
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/ServerlessLandGenAI/Default/text_gen/POST/ApiPermission.ApigwLambdaBedrockStackServerlessLandGenAIF613D839.POST..text_gen
ServerlessLandGenAItextgenPOSTApiPermissionTestApigwLambdaBedrockStackServerlessLandGenAIF613D839POSTtextgen7F67980E:
aws:cdk:path: ApiLambdaBedrockStack/ServerlessLandGenAI/Default/text_gen/POST/ApiPermission.ApiLambdaBedrockStackServerlessLandGenAIABB29318.POST..text_gen
ServerlessLandGenAItextgenPOSTApiPermissionTestApiLambdaBedrockStackServerlessLandGenAIABB29318POSTtextgen4267402C:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
Expand All @@ -159,7 +159,7 @@ Resources:
- Ref: ServerlessLandGenAI3932CB69
- /test-invoke-stage/POST/text_gen
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/ServerlessLandGenAI/Default/text_gen/POST/ApiPermission.Test.ApigwLambdaBedrockStackServerlessLandGenAIF613D839.POST..text_gen
aws:cdk:path: ApiLambdaBedrockStack/ServerlessLandGenAI/Default/text_gen/POST/ApiPermission.Test.ApiLambdaBedrockStackServerlessLandGenAIABB29318.POST..text_gen
ServerlessLandGenAItextgenPOSTD9CF9A37:
Type: AWS::ApiGateway::Method
Properties:
Expand All @@ -185,13 +185,13 @@ Resources:
- Arn
- /invocations
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/ServerlessLandGenAI/Default/text_gen/POST/Resource
aws:cdk:path: ApiLambdaBedrockStack/ServerlessLandGenAI/Default/text_gen/POST/Resource
CDKMetadata:
Type: AWS::CDK::Metadata
Properties:
Analytics: v2:deflate64:H4sIAAAAAAAA/1WPQW+DMAyFf0vvIdvgsmvLtNOmISrtWrnBpS6QIOwIIcR/nxKYVE7ve3ae7aT6PdWvBxg5MVWTtHTV81nANApGvswtdNcK9PwFEw6/ODA5q/Kb3flPb41sjWcucOiIw5NFcXYBZhTWxyCKM33ypkE5AaMi6PRcuJbMFIMrla7FYIMuCnqqQXCESc8lshx7is0NP7Bv3dShlVB9cmeBOo5ZoUR2fjAY9/6bbdDK3yh3V4XSSsui4s0hT7behX689F528fxmc2crkvjvYpK7sy+Zfkt1engwUTJ4K9ShLlf9AyBqMtqCAQAA
Metadata:
aws:cdk:path: ApigwLambdaBedrockStack/CDKMetadata/Default
aws:cdk:path: ApiLambdaBedrockStack/CDKMetadata/Default
Condition: CDKMetadataAvailable
Outputs:
ServerlessLandGenAIEndpoint41934CF9:
Expand Down

0 comments on commit 0d3a2ac

Please sign in to comment.